mingmwang commented on code in PR #4447:
URL: https://github.com/apache/arrow-datafusion/pull/4447#discussion_r1036654318


##########
datafusion/optimizer/src/push_down_filter.rs:
##########
@@ -643,18 +643,25 @@ impl OptimizerRule for PushDownFilter {
                 for expr in predicates {
                     let columns = expr.to_columns()?;
                     if columns.is_empty()
-                        || !columns
-                            .intersection(&used_columns)
-                            .collect::<HashSet<_>>()
-                            .is_empty()

Review Comment:
   As I mentioned in the last PR, I think we do not need to check the aggregate 
Exprs, but just check the group by Exprs. In some cases, the same column can 
exist in both aggregate Exprs and group by Exprs, for example `select 
count(distinct col_a),  col_a from table  group by col_a; ` .  If there is a 
Filter applied to col_a, the Filter can still be pushed down even it is 
referred  by the agg Exprs.



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