diff options
author | Herman van Hovell <hvanhovell@questtec.nl> | 2015-11-07 13:37:37 -0800 |
---|---|---|
committer | Yin Huai <yhuai@databricks.com> | 2015-11-07 13:37:37 -0800 |
commit | ef362846eb448769bcf774fc9090a5013d459464 (patch) | |
tree | 028176c2c4cd5fdc3c3c3a2bcaf2e3a9022b2c86 /sql/hive/src | |
parent | 2ff0e79a8647cca5c9c57f613a07e739ac4f677e (diff) | |
download | spark-ef362846eb448769bcf774fc9090a5013d459464.tar.gz spark-ef362846eb448769bcf774fc9090a5013d459464.tar.bz2 spark-ef362846eb448769bcf774fc9090a5013d459464.zip |
[SPARK-9241][SQL] Supporting multiple DISTINCT columns - follow-up
This PR is a follow up for PR https://github.com/apache/spark/pull/9406. It adds more documentation to the rewriting rule, removes a redundant if expression in the non-distinct aggregation path and adds a multiple distinct test to the AggregationQuerySuite.
cc yhuai marmbrus
Author: Herman van Hovell <hvanhovell@questtec.nl>
Closes #9541 from hvanhovell/SPARK-9241-followup.
Diffstat (limited to 'sql/hive/src')
-rw-r--r-- | sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/AggregationQuerySuite.scala | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/AggregationQuerySuite.scala b/sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/AggregationQuerySuite.scala index ea80060e37..7f6fe33923 100644 --- a/sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/AggregationQuerySuite.scala +++ b/sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/AggregationQuerySuite.scala @@ -516,6 +516,23 @@ abstract class AggregationQuerySuite extends QueryTest with SQLTestUtils with Te Row(3, 4, 4, 3, null) :: Nil) } + test("multiple distinct column sets") { + checkAnswer( + sqlContext.sql( + """ + |SELECT + | key, + | count(distinct value1), + | count(distinct value2) + |FROM agg2 + |GROUP BY key + """.stripMargin), + Row(null, 3, 3) :: + Row(1, 2, 3) :: + Row(2, 2, 1) :: + Row(3, 0, 1) :: Nil) + } + test("test count") { checkAnswer( sqlContext.sql( |