Skip to content

Commit 5b7911f

Browse files
Add a regression test.
1 parent 1bfa379 commit 5b7911f

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
package org.apache.spark.sql.hive.execution
1919

2020
import org.apache.spark.sql.hive.test.TestHive._
21+
import org.apache.spark.sql.hive.test.TestHive
2122

2223
/**
2324
* A set of test cases expressed in Hive QL that are not covered by the tests included in the hive distribution.
@@ -160,4 +161,14 @@ class HiveQuerySuite extends HiveComparisonTest {
160161
hql("SELECT * FROM src").toString
161162
}
162163

164+
test("SPARK-1704: Explain commands as a SchemaRDD") {
165+
hql("CREATE TABLE IF NOT EXISTS src (key INT, value STRING)")
166+
val rdd = hql("explain select key, count(value) from src group by key")
167+
assert(rdd.collect().size == 1)
168+
assert(rdd.toString.contains("ExplainCommand"))
169+
assert(rdd.filter(row => row.toString.contains("ExplainCommand")).collect().size == 0,
170+
"actual contents of the result should be the plans of the query to be explained")
171+
TestHive.reset()
172+
}
173+
163174
}

0 commit comments

Comments
 (0)