kosiew commented on code in PR #26969:
URL: https://github.com/apache/datafusion/pull/26969#discussion_r4676742233
##########
datafusion/optimizer/src/extract_leaf_expressions.rs:
##########
@@ -1049,7 +1142,7 @@ fn split_and_push_projection(
recovery_exprs.push(expr.clone());
proj_exprs_captured += 1;
} else if let Expr::Alias(alias) = expr
- && alias.name.starts_with(EXTRACTED_EXPR_PREFIX)
+ && is_extracted_alias(alias)
Review Comment:
Reusing a user-selected alias that matches an input field causes
AmbiguousReference. Please route colliding aliases through routing_extract to
allocate a fresh name, preserve the original output alias, and add a regression
test.
For example, this still fails:
```
CREATE TABLE review_alias_collision AS
SELECT column1 AS __datafusion_extracted_manual, column2 AS s
FROM VALUES (0, {a: 1}), (1, {a: 2});
SELECT s['a'] AS __datafusion_extracted_manual
FROM review_alias_collision AS t
WHERE t.__datafusion_extracted_manual > 0;
```
--
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]