kosiew commented on code in PR #24781:
URL: https://github.com/apache/datafusion/pull/24781#discussion_r3912481994


##########
datafusion/pruning/src/string_in_list.rs:
##########
@@ -151,19 +184,46 @@ impl PhysicalExpr for StringInListPruningExpr {
                         // uses actual Arrow partition values. 
PrunableStatistics
                         // trusts file providers' bounds: there is no ordering 
gate
                         // for arbitrary statistics providers here.
-                        let index = self.values.partition_point(|v| 
v.as_bytes() < min);
-                        Some(self.values.get(index).is_some_and(|v| 
v.as_bytes() <= max))
+                        match self.membership {
+                            SetMembership::In => {
+                                let index =
+                                    self.values.partition_point(|v| 
v.as_bytes() < min);
+                                Some(
+                                    self.values
+                                        .get(index)
+                                        .is_some_and(|v| v.as_bytes() <= max),
+                                )
+                            }
+                            // A wider interval can always hold a value 
outside the
+                            // domain, which satisfies NOT IN. Only an interval
+                            // pinned to one domain value rules out every row.
+                            // Truncated Parquet bounds cannot fake that: min
+                            // truncates downward and max upward, so equal 
bounds

Review Comment:
   Could we add an end-to-end `NOT IN` case with deliberately truncated Parquet 
statistics or page-index bounds? This arm relies on truncation producing a 
lower min and upper max. The current integration coverage uses exact short 
strings, while the unit test uses synthetic bounds. A small writer setup with a 
short truncate length would help lock in the conservative behavior and ensure 
we never incorrectly prune in this case.



-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to