GitHub user hvanhovell opened a pull request: https://github.com/apache/spark/pull/15857
[SPARK-18300][SQL] Do not apply foldable propagation with expand as a child. ## What changes were proposed in this pull request? The `FoldablePropagation` optimizer rule, pulls foldable values out from under an `Expand`. This breaks the `Expand` in two ways: - It rewrites the output attributes of the `Expand`. We explicitly define output attributes for `Expand`, these are (unfortunately) considered as part of the expressions of the `Expand` and can be rewritten. - Expand can actually change the column (it will typically re-use the attributes or the underlying plan). This means that we cannot safely propagate the expressions from under an `Expand`. ## How was this patch tested? Added tests to `FoldablePropagationSuite` and to `SQLQueryTestSuite`. You can merge this pull request into a Git repository by running: $ git pull https://github.com/hvanhovell/spark SPARK-18300 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/spark/pull/15857.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #15857 ---- commit d98f8f930330b368fbeade07d435197b0cdd2228 Author: Herman van Hovell <hvanhov...@databricks.com> Date: 2016-11-11T23:39:44Z Do not apply foldable propagation with expand as a child. ---- --- 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