cloud-fan commented on code in PR #44645:
URL: https://github.com/apache/spark/pull/44645#discussion_r1448870295
##########
sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/optimizer/RemoveRedundantAliasAndProjectSuite.scala:
##########
@@ -130,4 +131,63 @@ class RemoveRedundantAliasAndProjectSuite extends PlanTest
{
correlated = false)
comparePlans(optimized, expected)
}
+
+ test("SPARK-46640: do not remove outer references from a subquery
expression") {
+ val a = AttributeReference("a", IntegerType)() // a#0
+ // Keep the same name, otherwise the alias is not removed fearing schema
change.
+ val a_alias = Alias(a, "a")() // a#0 as a#1
+ val a_alias_expression = AttributeReference("a", IntegerType)(exprId =
a_alias.exprId) // a#1
Review Comment:
`a_alias.toAttribute`
##########
sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/optimizer/RemoveRedundantAliasAndProjectSuite.scala:
##########
@@ -130,4 +131,63 @@ class RemoveRedundantAliasAndProjectSuite extends PlanTest
{
correlated = false)
comparePlans(optimized, expected)
}
+
+ test("SPARK-46640: do not remove outer references from a subquery
expression") {
+ val a = AttributeReference("a", IntegerType)() // a#0
+ // Keep the same name, otherwise the alias is not removed fearing schema
change.
+ val a_alias = Alias(a, "a")() // a#0 as a#1
+ val a_alias_expression = AttributeReference("a", IntegerType)(exprId =
a_alias.exprId) // a#1
+ val b = AttributeReference("b", IntegerType)()
Review Comment:
ditto
--
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]