GitHub user davies opened a pull request:

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

    [SPARK-12740] support grouping()/grouping_id() in having/order clause

    ## What changes were proposed in this pull request?
    
    This PR brings the support of using grouping()/grouping_id() in 
HAVING/ORDER BY clause.
    
    The resolved grouping()/grouping_id() will be replaced by unresolved 
"spark_gropuing_id" virtual attribute, then resolved by ResolveMissingAttribute.
    
    This PR also fix the HAVING clause that access a grouping column that is 
not presented in SELECT clause, for example:
    ```sql
    select count(1) from (select 1 as a) t group by a having a > 0
    ```
    ## How was this patch tested?
    
    Add new tests.
    


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

    $ git pull https://github.com/davies/spark grouping_having

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

    https://github.com/apache/spark/pull/12235.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 #12235
    
----
commit fe6ece755b2a5b315effe7ce8da8a9a4769459f3
Author: Davies Liu <[email protected]>
Date:   2016-04-07T05:53:29Z

    support grouping()/grouping_id() in having clause

commit 7ad43fe5b8fe6ca87ca3da9e50fbe6cd2729e113
Author: Davies Liu <[email protected]>
Date:   2016-04-07T07:38:04Z

    support grouping() in sort

commit f60fcb4ef5aeadf824e88a85f13f40afc0fa097f
Author: Davies Liu <[email protected]>
Date:   2016-04-07T07:43:26Z

    update comments

commit 2412671877724011adbe70d5f7e953f1ed7a966b
Author: Davies Liu <[email protected]>
Date:   2016-04-07T07:46:24Z

    add a test for having

----


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