Github user gatorsmile commented on a diff in the pull request: https://github.com/apache/spark/pull/15857#discussion_r87862736 --- Diff: sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/optimizer/FoldablePropagationSuite.scala --- @@ -118,14 +118,30 @@ class FoldablePropagationSuite extends PlanTest { Seq( testRelation.select(Literal(1).as('x), 'a).select('x + 'a), testRelation.select(Literal(2).as('x), 'a).select('x + 'a))) - .select('x) --- End diff -- ``` test("Propagate in subqueries of Union queries") { val query = Union( Seq( testRelation.select(Literal(1).as('x), 'a).select('x, 'x + 'a), testRelation.select(Literal(2).as('x), 'a).select('x, 'x + 'a))) .select('x) val optimized = Optimize.execute(query.analyze) val correctAnswer = Union( Seq( testRelation.select(Literal(1).as('x), 'a) .select(Literal(1).as('x), (Literal(1).as('x) + 'a).as("(x + a)")), testRelation.select(Literal(2).as('x), 'a) .select(Literal(2).as('x), (Literal(2).as('x) + 'a).as("(x + a)")))) .select('x).analyze comparePlans(optimized, correctAnswer) } ``` How about this? The `x` (under `Union`) is transformed as the alias of a literal but the top `x` (above `Union`) is not propagated. This can validate the white list does not include `Union`.
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org