@@ -975,14 +975,7 @@ impl OptimizerRule for PushDownFilter {
975975 }
976976 LogicalPlan :: Aggregate ( mut agg) => {
977977 // We can push down Predicate which in groupby_expr.
978- let group_expr_columns: HashSet < Column > = agg
979- . group_expr
980- . iter ( )
981- . map ( |expr| {
982- let ( relation, name) = expr. qualified_name ( ) ;
983- Column :: new ( relation, name)
984- } )
985- . collect ( ) ;
978+ let group_expr_columns = expr_columns ( & agg. group_expr ) ;
986979
987980 // As for plan Filter: Column(a+b) > 0 -- Agg: groupby:[Column(a)+Column(b)]
988981 // After push, we need to replace `a+b` with Column(a)+Column(b)
@@ -1034,14 +1027,7 @@ impl OptimizerRule for PushDownFilter {
10341027 // Therefore, we need to ensure that any potential partition key returned is used in
10351028 // ALL window functions. Otherwise, filters cannot be pushed by through that column.
10361029 fn extract_partition_keys ( func : & WindowFunction ) -> HashSet < Column > {
1037- func. params
1038- . partition_by
1039- . iter ( )
1040- . map ( |expr| {
1041- let ( relation, name) = expr. qualified_name ( ) ;
1042- Column :: new ( relation, name)
1043- } )
1044- . collect ( )
1030+ expr_columns ( & func. params . partition_by )
10451031 }
10461032
10471033 let potential_partition_keys = window
@@ -1386,6 +1372,16 @@ fn with_filters(predicates: Vec<Expr>, plan: LogicalPlan) -> LogicalPlan {
13861372 }
13871373}
13881374
1375+ fn expr_columns ( exprs : & [ Expr ] ) -> HashSet < Column > {
1376+ exprs
1377+ . iter ( )
1378+ . map ( |expr| {
1379+ let ( relation, name) = expr. qualified_name ( ) ;
1380+ Column :: new ( relation, name)
1381+ } )
1382+ . collect ( )
1383+ }
1384+
13891385#[ cfg( test) ]
13901386mod tests {
13911387 use std:: any:: Any ;
0 commit comments