aboutsummaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorAaron Davidson <aaron@databricks.com>2014-07-21 14:35:15 -0700
committerMichael Armbrust <michael@databricks.com>2014-07-21 14:35:15 -0700
commitabeacffb7bcdfa3eeb1e969aa546029a7b464eaa (patch)
tree4130c72f0577607c4e85e41d709ebaa2083bfa97 /sql
parent872538c600a452ead52638c1ccba90643a9fa41c (diff)
downloadspark-abeacffb7bcdfa3eeb1e969aa546029a7b464eaa.tar.gz
spark-abeacffb7bcdfa3eeb1e969aa546029a7b464eaa.tar.bz2
spark-abeacffb7bcdfa3eeb1e969aa546029a7b464eaa.zip
Fix flakey HiveQuerySuite test
Result may not be returned in the expected order, so relax that constraint. Author: Aaron Davidson <aaron@databricks.com> Closes #1514 from aarondav/flakey and squashes the following commits: e5af823 [Aaron Davidson] Fix flakey HiveQuerySuite test
Diffstat (limited to 'sql')
-rw-r--r--sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/HiveQuerySuite.scala45
1 files changed, 22 insertions, 23 deletions
diff --git a/sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/HiveQuerySuite.scala b/sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/HiveQuerySuite.scala
index d57e99db18..eb7df71728 100644
--- a/sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/HiveQuerySuite.scala
+++ b/sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/HiveQuerySuite.scala
@@ -421,64 +421,63 @@ class HiveQuerySuite extends HiveComparisonTest {
val testKey = "spark.sql.key.usedfortestonly"
val testVal = "test.val.0"
val nonexistentKey = "nonexistent"
- def rowsToPairs(rows: Array[Row]) = rows.map { case Row(key: String, value: String) =>
- key -> value
- }
+ def collectResults(rdd: SchemaRDD): Set[(String, String)] =
+ rdd.collect().map { case Row(key: String, value: String) => key -> value }.toSet
clear()
// "set" itself returns all config variables currently specified in SQLConf.
assert(hql("SET").collect().size == 0)
- assertResult(Array(testKey -> testVal)) {
- rowsToPairs(hql(s"SET $testKey=$testVal").collect())
+ assertResult(Set(testKey -> testVal)) {
+ collectResults(hql(s"SET $testKey=$testVal"))
}
assert(hiveconf.get(testKey, "") == testVal)
- assertResult(Array(testKey -> testVal)) {
- rowsToPairs(hql("SET").collect())
+ assertResult(Set(testKey -> testVal)) {
+ collectResults(hql("SET"))
}
hql(s"SET ${testKey + testKey}=${testVal + testVal}")
assert(hiveconf.get(testKey + testKey, "") == testVal + testVal)
- assertResult(Array(testKey -> testVal, (testKey + testKey) -> (testVal + testVal))) {
- rowsToPairs(hql("SET").collect())
+ assertResult(Set(testKey -> testVal, (testKey + testKey) -> (testVal + testVal))) {
+ collectResults(hql("SET"))
}
// "set key"
- assertResult(Array(testKey -> testVal)) {
- rowsToPairs(hql(s"SET $testKey").collect())
+ assertResult(Set(testKey -> testVal)) {
+ collectResults(hql(s"SET $testKey"))
}
- assertResult(Array(nonexistentKey -> "<undefined>")) {
- rowsToPairs(hql(s"SET $nonexistentKey").collect())
+ assertResult(Set(nonexistentKey -> "<undefined>")) {
+ collectResults(hql(s"SET $nonexistentKey"))
}
// Assert that sql() should have the same effects as hql() by repeating the above using sql().
clear()
assert(sql("SET").collect().size == 0)
- assertResult(Array(testKey -> testVal)) {
- rowsToPairs(sql(s"SET $testKey=$testVal").collect())
+ assertResult(Set(testKey -> testVal)) {
+ collectResults(sql(s"SET $testKey=$testVal"))
}
assert(hiveconf.get(testKey, "") == testVal)
- assertResult(Array(testKey -> testVal)) {
- rowsToPairs(sql("SET").collect())
+ assertResult(Set(testKey -> testVal)) {
+ collectResults(sql("SET"))
}
sql(s"SET ${testKey + testKey}=${testVal + testVal}")
assert(hiveconf.get(testKey + testKey, "") == testVal + testVal)
- assertResult(Array(testKey -> testVal, (testKey + testKey) -> (testVal + testVal))) {
- rowsToPairs(sql("SET").collect())
+ assertResult(Set(testKey -> testVal, (testKey + testKey) -> (testVal + testVal))) {
+ collectResults(sql("SET"))
}
- assertResult(Array(testKey -> testVal)) {
- rowsToPairs(sql(s"SET $testKey").collect())
+ assertResult(Set(testKey -> testVal)) {
+ collectResults(sql(s"SET $testKey"))
}
- assertResult(Array(nonexistentKey -> "<undefined>")) {
- rowsToPairs(sql(s"SET $nonexistentKey").collect())
+ assertResult(Set(nonexistentKey -> "<undefined>")) {
+ collectResults(sql(s"SET $nonexistentKey"))
}
clear()