JeonDaehong commented on code in PR #1145:
URL: https://github.com/apache/paimon-rust/pull/1145#discussion_r4369392734


##########
crates/paimon/src/table/global_index_scanner/evaluator.rs:
##########
@@ -386,6 +387,28 @@ impl GlobalIndexScanner {
         &self,
         entries: &[&GlobalIndexEntry],
         predicates: &[(PredicateOperator, &[Datum], &DataType)],
+    ) -> Result<Option<(Vec<RowRange>, Vec<RowRange>, bool)>> {
+        // A bitmap answers floating ranges and negations with every non-null
+        // row (see `bitmap_meta_may_match`), so those results are candidates
+        // only. Sorted indexes answer them exactly.
+        // An all-NULL bitmap shard is pruned before it answers anything.
+        let bitmap_superset = entries.iter().any(|entry| {

Review Comment:
   Fixed in 1d42473. Exactness is now decided after every conjunct is applied, 
from the bitmap shards that actually stay in the plan. I added your `f > 1.5 
AND f = 2` case as 
`bitmap_pruned_by_another_conjunct_keeps_btree_answer_exact`. It returns `[]` 
without the change and `[2]` with it.
   



##########
crates/paimon/src/arrow/residual.rs:
##########
@@ -166,9 +166,16 @@ pub(crate) fn evaluate_predicate_mask(
             else {
                 return Ok(None);
             };
-            Ok(Some(boolean_mask_from_predicate(mask.len(), |row_index| {
-                !mask.value(row_index)
-            })))
+            let negated =
+                boolean_mask_from_predicate(mask.len(), |row_index| 
!mask.value(row_index));
+            if let Some(guard) = inner.not_null_guard() {

Review Comment:
   Fixed in 6e9d54e. NOT is now pushed down to the leaves with De Morgan before 
evaluation, in both the residual (`evaluate_negated_mask`) and BinaryRow 
(`eval_row_negated`) paths. Only leaves get negated, and each keeps its NULL 
guard. `raw_double_negation_keeps_null_rows_out` now also covers `NOT(NOT(v = 
10) AND id >= 0)`, with and without widening.
   
   I also checked both paths against a three-valued reference on 20k random 
NOT/AND/OR trees over nullable columns: 0 mismatches now, about 3k before.
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to