Skip to content

Commit

Permalink
Made "SET key=value" returns the newly set key value pair
Browse files Browse the repository at this point in the history
  • Loading branch information
liancheng committed Jun 13, 2014
1 parent f6c7715 commit d005b03
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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), _) =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand All @@ -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())
Expand Down

0 comments on commit d005b03

Please sign in to comment.