mirror of
https://github.com/qdrant/qdrant.git
synced 2026-09-21 13:37:46 -05:00
This reverts commit 50fe2e8139.
This commit is contained in:
@@ -76,10 +76,6 @@ mod tests {
|
||||
|
||||
let filter_is_null = FieldCondition::new_is_null(key.clone(), true);
|
||||
|
||||
let filter_is_not_null = FieldCondition::new_is_null(key.clone(), false);
|
||||
|
||||
let filter_is_empty = FieldCondition::new_is_empty(key.clone(), true);
|
||||
|
||||
let filter_is_not_empty = FieldCondition {
|
||||
key: key.clone(),
|
||||
r#match: None,
|
||||
@@ -156,22 +152,9 @@ mod tests {
|
||||
.estimate_cardinality(&filter_is_not_empty, &hw_cell)
|
||||
.unwrap()
|
||||
.unwrap();
|
||||
let is_empty_cardinality = null_index
|
||||
.estimate_cardinality(&filter_is_empty, &hw_cell)
|
||||
.unwrap()
|
||||
.unwrap();
|
||||
let not_null_cardinality = null_index
|
||||
.estimate_cardinality(&filter_is_not_null, &hw_cell)
|
||||
.unwrap()
|
||||
.unwrap();
|
||||
|
||||
assert_eq!(is_null_cardinality.exp, 50);
|
||||
assert_eq!(non_empty_cardinality.exp, 50);
|
||||
// Complement estimates use total − indexed count (no arbitrary delete discount).
|
||||
assert_eq!(is_empty_cardinality.exp, 50);
|
||||
assert_eq!(is_empty_cardinality.max, 50);
|
||||
assert_eq!(not_null_cardinality.exp, 50);
|
||||
assert_eq!(not_null_cardinality.max, 50);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -180,12 +180,11 @@ pub(super) fn estimate_cardinality<N: NullIndexRead>(
|
||||
let estimation = if let Some(is_empty) = is_empty {
|
||||
if *is_empty {
|
||||
let has_values_count = has_values_flags.count_trues()?;
|
||||
// Upper bound: may include soft-deleted offsets (index has no deleted bitslice).
|
||||
let estimated = total_point_count.saturating_sub(has_values_count);
|
||||
|
||||
CardinalityEstimation {
|
||||
min: 0,
|
||||
exp: estimated,
|
||||
exp: 2 * estimated / 3, // assuming 1/3 of the points are deleted
|
||||
max: estimated,
|
||||
primary_clauses: vec![PrimaryCondition::from(FieldCondition::new_is_empty(
|
||||
key.clone(),
|
||||
@@ -206,12 +205,11 @@ pub(super) fn estimate_cardinality<N: NullIndexRead>(
|
||||
))
|
||||
} else {
|
||||
let is_null_count = is_null_flags.count_trues()?;
|
||||
// Upper bound: may include soft-deleted offsets (index has no deleted bitslice).
|
||||
let estimated = total_point_count.saturating_sub(is_null_count);
|
||||
|
||||
CardinalityEstimation {
|
||||
min: 0,
|
||||
exp: estimated,
|
||||
exp: 2 * estimated / 3, // assuming 1/3 of the points are deleted
|
||||
max: estimated,
|
||||
primary_clauses: vec![PrimaryCondition::from(FieldCondition::new_is_null(
|
||||
key.clone(),
|
||||
|
||||
Reference in New Issue
Block a user