GitHub user liancheng opened a pull request:

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

    [SPARK-16291][SQL] CheckAnalysis should capture nested aggregate functions 
that reference no input attributes

    ## What changes were proposed in this pull request?
    
    `MAX(COUNT(*))` is invalid since aggregate expression can't be nested 
within another aggregate expression. This case should be captured at analysis 
phase, but somehow sneaks off to runtime.
    
    The reason is that when checking aggregate expressions in `CheckAnalysis`, 
a checking branch treats all expressions that reference no input attributes as 
valid ones. However, `MAX(COUNT(*))` is translated into `MAX(COUNT(1))` at 
analysis phase and also references no input attribute.
    
    This PR fixes this issue by removing the aforementioned branch.
    
    ## How was this patch tested?
    
    New test case added in `AnalysisErrorSuite`.

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

    $ git pull https://github.com/liancheng/spark 
spark-16291-nested-agg-functions

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

    https://github.com/apache/spark/pull/13968.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 #13968
    
----
commit 18e74855968fe404dea86a49e03c689c01b1b737
Author: Cheng Lian <[email protected]>
Date:   2016-06-29T08:00:20Z

    CheckAnalysis should capture nested aggregate functions that reference no 
input attributes.

----


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