You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2022/02/08 19:50:39 UTC

[GitHub] [arrow-datafusion] korowa commented on a change in pull request #1781: rewrite predicates before pushing to union inputs

korowa commented on a change in pull request #1781:
URL: https://github.com/apache/arrow-datafusion/pull/1781#discussion_r802003027



##########
File path: datafusion/src/optimizer/filter_push_down.rs
##########
@@ -346,14 +346,18 @@ fn optimize(plan: &LogicalPlan, mut state: State) -> Result<LogicalPlan> {
                 .fields()
                 .iter()
                 .enumerate()
-                .map(|(i, field)| {
+                .flat_map(|(i, field)| {
                     // strip alias, as they should not be part of filters
                     let expr = match &expr[i] {
                         Expr::Alias(expr, _) => expr.as_ref().clone(),
                         expr => expr.clone(),
                     };
 
-                    (field.qualified_name(), expr)
+                    // considering both qualified and unqualified names as rewriting option
+                    [
+                        (field.name().clone(), expr.clone()),
+                        (field.qualified_name(), expr),
+                    ]

Review comment:
       Yes, that change is not really necessary, i guess - all downstream operations manages to resolve proper objects for forwarding filters (at least I checked both simple projections and joins). It just looked more consistent to support unqualified columns resolution.
   
   I can revert this change if other parts look fine, np.




-- 
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-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org