neilconway commented on code in PR #25908:
URL: https://github.com/apache/datafusion/pull/25908#discussion_r4220834416


##########
datafusion/physical-plan/src/filter.rs:
##########
@@ -1867,6 +1874,156 @@ mod tests {
         Ok(())
     }
 
+    #[test]
+    fn test_filter_statistics_large_in_list() -> Result<()> {

Review Comment:
   What if we extended `test_filter_statistics_in_list_on_a_unique_column` 
rather than adding a brand new test that overlaps with it?



##########
datafusion/physical-plan/src/filter.rs:
##########
@@ -1118,6 +1118,13 @@ fn unique_match_limit(
     predicate: &Arc<dyn PhysicalExpr>,
     statistics: &Statistics,
 ) -> Option<usize> {
+    if !statistics
+        .column_statistics
+        .iter()
+        .any(|column| holds_each_value_once(column, &statistics.num_rows))
+    {
+        return None;
+    }

Review Comment:
   This is still coarse: if the table has a column that satisfies 
`holds_each_value_once` but that column is a different one than the predicate 
is being applied to, we still do a bunch of wasted work below. We could revise 
this to make the check more precise -- wdyt?



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