alamb commented on code in PR #2729: URL: https://github.com/apache/arrow-datafusion/pull/2729#discussion_r897290860
########## datafusion/optimizer/src/filter_push_down.rs: ########## @@ -122,6 +122,27 @@ fn remove_filters( .collect::<Vec<_>>() } +// rename all filter columns which have alias name +fn rename_filters_column_name( + filters: &mut [Predicate], + alias_cols_expr_and_name: &HashMap<&Expr, &String>, +) { + for (expr, columns) in filters { + if alias_cols_expr_and_name.contains_key(expr) { + let col_string = <&std::string::String>::clone( + alias_cols_expr_and_name.get(expr).unwrap(), + ); Review Comment: ```suggestion let col_string = alias_cols_expr_and_name.get(expr).unwrap(); ``` Seemed to work for me locally ########## datafusion/optimizer/src/filter_push_down.rs: ########## @@ -336,6 +357,18 @@ fn optimize(plan: &LogicalPlan, mut state: State) -> Result<LogicalPlan> { LogicalPlan::Analyze { .. } => push_down(&state, plan), LogicalPlan::Filter(Filter { input, predicate }) => { let mut predicates = vec![]; + let mut alias_cols_expr_and_name = HashMap::new(); + //Need rewrite column name before push down + let input_plan = &*input.clone(); + if let LogicalPlan::Projection(projection) = input_plan { Review Comment: I wonder if you can use the `LogicalPlan`'s output schema to detect the case you are looking for I am still a little confused about where the issue is -- is the filter push down logic adding an extra alias? Or is it not adding an alias it should? -- 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...@arrow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org