Skip to content
Snippets Groups Projects
Commit df9adb5e authored by xin Wu's avatar xin Wu Committed by Wenchen Fan
Browse files

[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.
parent 8f0a3d5b
No related branches found
No related tags found
No related merge requests found
......@@ -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)
)
)
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment