GitHub user dongjoon-hyun opened a pull request:

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

    [SPARK-14830][SQL] Add RemoveRepetitionFromGroupExpressions optimizer.

    ## What changes were proposed in this pull request?
    
    This PR aims to optimize GroupExpressions by removing repeating expressions.
    `RemoveRepetitionFromGroupExpressions` is added.
    
    **Before**
    ```scala
    scala> sql("select a from (select explode(array(1,2)) a) T group by a, a, 
a").explain()
    == Physical Plan ==
    WholeStageCodegen
    :  +- TungstenAggregate(key=[a#5,a#5,a#5], functions=[], output=[a#5])
    :     +- INPUT
    +- Exchange hashpartitioning(a#5, a#5, a#5, 200), None
       +- WholeStageCodegen
          :  +- TungstenAggregate(key=[a#5,a#5,a#5], functions=[], 
output=[a#5,a#5,a#5])
          :     +- INPUT
          +- Generate explode([1,2]), false, false, [a#5]
             +- Scan OneRowRelation[]
    ```
    
    **After**
    ```scala
    scala> sql("select a from (select explode(array(1,2)) a) T group by a, a, 
a").explain()
    == Physical Plan ==
    WholeStageCodegen
    :  +- TungstenAggregate(key=[a#5], functions=[], output=[a#5])
    :     +- INPUT
    +- Exchange hashpartitioning(a#5, 200), None
       +- WholeStageCodegen
          :  +- TungstenAggregate(key=[a#5], functions=[], output=[a#5])
          :     +- INPUT
          +- Generate explode([1,2]), false, false, [a#5]
             +- Scan OneRowRelation[]
    ```
    
    ## How was this patch tested?
    
    Pass the Jenkins tests (with a new testcase)

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/dongjoon-hyun/spark SPARK-14830

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

    https://github.com/apache/spark/pull/12590.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 #12590
    
----
commit 75b8f7353454cbe6aa8dafa070f51c90d0f430e5
Author: Dongjoon Hyun <[email protected]>
Date:   2016-04-22T00:08:32Z

    [SPARK-14830][SQL] Add RemoveRepetitionFromGroupExpressions optimizer.

----


---
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