Nikhil Sheoran created SPARK-46640: -------------------------------------- Summary: RemoveRedundantAliases does not account for references in SubqueryExpression when removing aliases Key: SPARK-46640 URL: https://issues.apache.org/jira/browse/SPARK-46640 Project: Spark Issue Type: Bug Components: Optimizer Affects Versions: 4.0.0 Reporter: Nikhil Sheoran Fix For: 4.0.0
`RemoveRedundantAliases{{{}`{}}} does not take into account the outer attributes of a `SubqueryExpression` aliases, potentially removing them if it thinks they are redundant. This can cause scenarios where a subquery expression has conditions like `a#x = a#x` i.e. both the attribute names and the expression ID(s) are the same. This can then lead to conflicting expression ID(s) error. In `RemoveRedundantAliases`, we have an excluded AttributeSet argument denoting the references for which we should not remove aliases. For a query with a subquery expression, adding the references of this subquery in the excluded set prevents such rewrite from happening. -- This message was sent by Atlassian Jira (v8.20.10#820010) --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org For additional commands, e-mail: issues-h...@spark.apache.org