jayzhan211 commented on code in PR #24242:
URL: https://github.com/apache/datafusion/pull/24242#discussion_r3775351493


##########
datafusion/optimizer/src/extract_leaf_expressions.rs:
##########
@@ -833,6 +833,15 @@ fn split_and_push_projection(
     for (expr, (qualifier, field)) in 
proj.expr.iter().zip(original_schema.iter()) {
         if let Expr::Alias(alias) = expr
             && alias.name.starts_with(EXTRACTED_EXPR_PREFIX)
+            && let Expr::Column(inner_col) = alias.expr.as_ref()
+            && inner_col.name == alias.name
+        {
+            // passthrough alias: treat it as one that already exists in the 
input
+            extractors[0].columns_needed.insert(inner_col.clone());
+            recovery_exprs.push(expr.clone());
+            proj_exprs_captured += 1;
+        } else if let Expr::Alias(alias) = expr
+            && alias.name.starts_with(EXTRACTED_EXPR_PREFIX)

Review Comment:
   The logic is quite similar to the 3rd branch `else if let Expr::Column(col) 
= expr {`
   
   I wonder if we could simplified the logic here to have a more 
straightforward one instead of many if/else.



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