Skip to content

Commit 18387f1

Browse files
committed
Add test for HAVING without GROUP BY
1 parent b880bef commit 18387f1

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/HiveQuerySuite.scala

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ class HiveQuerySuite extends HiveComparisonTest {
224224
TestHive.reset()
225225
}
226226

227-
test("SPARK-2180: HAVING support in GROUP BY clauses") {
227+
test("SPARK-2180: HAVING support in GROUP BY clauses (positive)") {
228228
val fixture = List(("foo", 2), ("bar", 1), ("foo", 4), ("bar", 3))
229229
.zipWithIndex.map {case Pair(Pair(value, attr), key) => HavingRow(key, value, attr)}
230230

@@ -239,6 +239,12 @@ class HiveQuerySuite extends HiveComparisonTest {
239239
TestHive.reset()
240240
}
241241

242+
test("SPARK-2180: HAVING without GROUP BY raises exception") {
243+
intercept[Exception] {
244+
hql("SELECT value, attr FROM having_test HAVING attr > 3")
245+
}
246+
}
247+
242248
test("Query Hive native command execution result") {
243249
val tableName = "test_native_commands"
244250

0 commit comments

Comments
 (0)