jonahgao commented on code in PR #11307:
URL: https://github.com/apache/datafusion/pull/11307#discussion_r1668840897


##########
datafusion/expr/src/logical_plan/plan.rs:
##########
@@ -2130,16 +2130,10 @@ impl Filter {
             }
         }
 
-        // filter predicates should not be aliased
-        if let Expr::Alias(Alias { expr, name, .. }) = predicate {
-            return plan_err!(
-                "Attempted to create Filter predicate with \
-                expression `{expr}` aliased as '{name}'. Filter predicates 
should not be \
-                aliased."
-            );
-        }
-
-        Ok(Self { predicate, input })
+        Ok(Self {
+            predicate: predicate.unalias_nested().data,

Review Comment:
   My thought is to execute `unalias_nested` when creating the initial logical 
plan. 
   
   But the current implementation is also acceptable to me. Thank you 
@samuelcolvin .  If we follow the current implementation, we also need to 
remove the redundant `unalias_nested` calls outside of try_new.
   
   cc @alamb 



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to