GitHub user hvanhovell opened a pull request:

    https://github.com/apache/spark/pull/15892

    [SPARK-18300][SQL] Do not apply foldable propagation with expand as a child 
[BRANCH-2.0]

    ## 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`.
    
    This PR fixes this and (hopefully) other issues by explicitly whitelisting 
allowed operators.
    
    This is a backport of https://github.com/apache/spark/pull/15857
    
    ## 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-branch-2.0

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/spark/pull/15892.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 #15892
    
----
commit 7911feb52bdaab4a9c1fa9ea04fe3c7e8cb4e2b9
Author: Herman van Hovell <[email protected]>
Date:   2016-11-15T22:08:39Z

    Fix foldable propagation rule.

----


---
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 [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to