GitHub user hvanhovell opened a pull request:
https://github.com/apache/spark/pull/15076
[SPARK-17114][SQL] Fix aggregates grouped by literals with empty input.
## What changes were proposed in this pull request?
This PR fixes an issue with aggregates that have an empty input, and use a
literals as their grouping keys. These aggregates are currently interpreted as
aggregates **without** grouping keys, this triggers the ungrouped code path
(which aways returns a single row).
This PR fixes this by adding a `isGrouped` flag to `Aggregate`. This flag
is inferred when the `Aggregate` is created, but is kept when we change the
`Aggregate`s grouping expressions. I have tried to implement this by wrapping
the `groupingExpressions` in an `Option` but this is much more invasive and
leads to much harder to use code.
## How was this patch tested?
Added tests to `SQLQueryTestSuite`.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/hvanhovell/spark SPARK-17114-2
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/spark/pull/15076.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 #15076
----
commit f8f1ebb2c10fab8c02d37ec6f3bf667f34fea762
Author: Herman van Hovell <[email protected]>
Date: 2016-09-13T08:54:54Z
fix aggregates that are grouped by a literal with empty input.
----
---
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]