findepi commented on code in PR #16362: URL: https://github.com/apache/datafusion/pull/16362#discussion_r2139769713
########## datafusion/optimizer/src/push_down_filter.rs: ########## @@ -778,6 +779,16 @@ impl OptimizerRule for PushDownFilter { return Ok(Transformed::no(plan)); }; + let predicate = split_conjunction_owned(filter.predicate.clone()); + let old_predicate_len = predicate.len(); + let new_predicates = simplify_predicates(predicate)?; + if old_predicate_len != new_predicates.len() { + let Some(new_predicate) = conjunction(new_predicates) else { + return plan_err!("at least one expression exists"); Review Comment: The caller of that function doesn't need to hard-code this assumption. What if `simplify_predicates` realizes that the only predicate is trivially true and can be removed (for example `x = x` and we know x is not null). -- 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: github-unsubscr...@datafusion.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org For additional commands, e-mail: github-h...@datafusion.apache.org