spark-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wenc...@apache.org
Subject spark git commit: [SPARK-15206][SQL] add testcases for distinct aggregate in having clause
Date Sun, 22 May 2016 04:41:13 GMT
Repository: spark
Updated Branches:
  refs/heads/master 8f0a3d5bc -> df9adb5ec


[SPARK-15206][SQL] add testcases for distinct aggregate in having clause

## What changes were proposed in this pull request?
Add new test cases for including distinct aggregate in having clause in 2.0 branch.
This is a followup PR for [#12974](https://github.com/apache/spark/pull/12974), which is for
1.6 branch.

Author: xin Wu <xinwu@us.ibm.com>

Closes #12984 from xwu0226/SPARK-15206.


Project: http://git-wip-us.apache.org/repos/asf/spark/repo
Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/df9adb5e
Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/df9adb5e
Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/df9adb5e

Branch: refs/heads/master
Commit: df9adb5ec994f054b2fa58e492867bbc5a60c234
Parents: 8f0a3d5
Author: xin Wu <xinwu@us.ibm.com>
Authored: Sat May 21 21:41:12 2016 -0700
Committer: Wenchen Fan <wenchen@databricks.com>
Committed: Sat May 21 21:41:12 2016 -0700

----------------------------------------------------------------------
 .../hive/execution/AggregationQuerySuite.scala  | 31 ++++++++++++++++++++
 1 file changed, 31 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/spark/blob/df9adb5e/sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/AggregationQuerySuite.scala
----------------------------------------------------------------------
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 a2bae2e..9fc5628 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
@@ -958,6 +958,37 @@ abstract class AggregationQuerySuite extends QueryTest with SQLTestUtils
with Te
         Row(11) :: Nil)
     }
   }
+
+  test("SPARK-15206: single distinct aggregate function in having clause") {
+    checkAnswer(
+      sql(
+        """
+          |select key, count(distinct value1)
+          |from agg2 group by key
+          |having count(distinct value1) > 0
+        """.stripMargin),
+      Seq(
+        Row(null, 3),
+        Row(1, 2),
+        Row(2, 2)
+      )
+    )
+  }
+
+  test("SPARK-15206: multiple distinct aggregate function in having clause") {
+    checkAnswer(
+      sql(
+        """
+          |select key, count(distinct value1), count(distinct value2)
+          |from agg2 group by key
+          |having count(distinct value1) > 0 and count(distinct value2) = 3
+        """.stripMargin),
+      Seq(
+        Row(null, 3, 3),
+        Row(1, 2, 3)
+      )
+    )
+  }
 }
 
 


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@spark.apache.org
For additional commands, e-mail: commits-help@spark.apache.org


Mime
View raw message