forward3d / rbhive

Ruby gem for querying Apache Hive
http://www.forward3d.com
MIT License
98 stars 74 forks source link

#execute SET with leading spaces faulty in Hive 2 with :hive_version 12 #12

Closed tiredpixel closed 4 years ago

tiredpixel commented 10 years ago

There appears to be an issue with using SET commands where there are leading spaces in the query. This affects Hive 2 #tcli_connect with options { :hive_version => 12 }. In Hive 1 with #connect, however, this appears to work as expected. Compare the working:

RBHive.tcli_connect('hive.example.com', 10002, { :hive_version => 12 }) do |conn|
  conn.execute("SET mapred.fairscheduler.pool=swimming")
  conn.execute("SELECT * FROM chairs")
end

which results in mapred.fairscheduler.pool being set to swimming, with the seemingly faulty:

RBHive.tcli_connect('hive.example.com', 10002, { :hive_version => 12 }) do |conn|
  conn.execute("    SET mapred.fairscheduler.pool=swimming")
  conn.execute("SELECT * FROM chairs")
end

RBHive.tcli_connect('hive.example.com', 10002, { :hive_version => 12 }) do |conn|
  conn.execute(%Q{
    SET mapred.fairscheduler.pool=swimming
  })
  conn.execute("SELECT * FROM chairs")
end

which results in SET mapred.fairscheduler.pool being set to swimming and the setting not being applied (note the leading SET).

tiredpixel commented 4 years ago

Since there has been no reply to this in over 6 years, I'll go ahead and close it.