crepererum commented on code in PR #5419:
URL: https://github.com/apache/arrow-datafusion/pull/5419#discussion_r1120489517


##########
datafusion/core/src/physical_optimizer/pruning.rs:
##########
@@ -1840,12 +2034,34 @@ mod tests {
         (schema, statistics, expected_true, expected_false)
     }
 
+    #[test]
+    fn prune_bool_const_expr() {
+        let (schema, statistics, _, _) = bool_setup();
+
+        // true
+        let expr = lit(true);
+        let expr = logical2physical(&expr, &schema);
+        let p = PruningPredicate::try_new(expr, schema.clone()).unwrap();
+        let result = p.prune(&statistics).unwrap();
+        assert_eq!(result, vec![true, true, true, true, true]);
+
+        // false
+        // constant literals that do NOT refer to any columns are currently 
not evaluated at all, hence the result is
+        // "all true"
+        let expr = lit(false);

Review Comment:
   It's not making things worse. This was the state of the art even before 
#5386, but I was asked here 
https://github.com/apache/arrow-datafusion/pull/5386#discussion_r1117641476 for 
the concrete semantics and I couldn't find a test that already covered that, so 
I've added one.



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