diff --git a/sql/core/src/main/scala/org/apache/spark/sql/execution/commands.scala b/sql/core/src/main/scala/org/apache/spark/sql/execution/commands.scala index e9efe28723745..0377290af5926 100644 --- a/sql/core/src/main/scala/org/apache/spark/sql/execution/commands.scala +++ b/sql/core/src/main/scala/org/apache/spark/sql/execution/commands.scala @@ -48,7 +48,7 @@ case class SetCommand( // Set value for key k. case (Some(k), Some(v)) => context.set(k, v) - Array.empty[(String, String)] + Array(k -> v) // Query the value bound to key k. case (Some(k), _) => 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 0b64c0a970348..0d656c556965d 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 @@ -250,10 +250,12 @@ class HiveQuerySuite extends HiveComparisonTest { clear() // "set" itself returns all config variables currently specified in SQLConf. - assert(hql("set").collect().size == 0) + assert(hql("SET").collect().size == 0) + + assertResult(Array(testKey -> testVal)) { + rowsToPairs(hql(s"SET $testKey=$testVal").collect()) + } - // "set key=val" - hql(s"SET $testKey=$testVal") assert(hiveconf.get(testKey, "") == testVal) assertResult(Array(testKey -> testVal)) { rowsToPairs(hql("SET").collect()) @@ -278,7 +280,10 @@ class HiveQuerySuite extends HiveComparisonTest { clear() assert(sql("SET").collect().size == 0) - sql(s"SET $testKey=$testVal") + assertResult(Array(testKey -> testVal)) { + rowsToPairs(sql(s"SET $testKey=$testVal").collect()) + } + assert(hiveconf.get(testKey, "") == testVal) assertResult(Array(testKey -> testVal)) { rowsToPairs(sql("SET").collect())