forward3d / rbhive

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

ParseException : missing EOF #21

Closed kshitij-badani closed 10 years ago

kshitij-badani commented 10 years ago

I am using this gem to connect to the HiveServer via thrift and for the following sample query- i am getting parseException error

Query: RBHive.tcli_connect('my.host.name',10_000,{}) do |c| c.fetch("USE dbname;SHOW TABLES") end

Initializing transport buffered Connecting to HiveServer2 my.host.name on port 10000 Executing Hive Query: USE dbname;SHOW TABLES /usr/local/lib/ruby/gems/1.9.1/gems/rbhive-0.6.0/lib/rbhive/t_c_l_i_connection.rb:336:in raise_error_if_failed!': Error while processing statement: FAILED: ParseException line 1:7 missing EOF at ';' near 'dbname' (RuntimeError) from /usr/local/lib/ruby/gems/1.9.1/gems/rbhive-0.6.0/lib/rbhive/t_c_l_i_connection.rb:203:inblock in fetch' from /usr/local/lib/ruby/gems/1.9.1/gems/rbhive-0.6.0/lib/rbhive/t_c_l_i_connection.rb:294:in block in safe' from <internal:prelude>:10:insynchronize' from /usr/local/lib/ruby/gems/1.9.1/gems/rbhive-0.6.0/lib/rbhive/t_c_l_i_connection.rb:294:in safe' from /usr/local/lib/ruby/gems/1.9.1/gems/rbhive-0.6.0/lib/rbhive/t_c_l_i_connection.rb:200:infetch' from hive.rb:4:in block in <main>' from /usr/local/lib/ruby/gems/1.9.1/gems/rbhive-0.6.0/lib/rbhive/t_c_l_i_connection.rb:56:intcli_connect' from hive.rb:3:in `

'

However following works fine: RBHive.tcli_connect('my.host.name',10_000,{}) do |c| c.fetch("USE dbname")
c.fetch("SHOW TABLES") end

andytinycat commented 10 years ago

You can't supply multiple commands in the same call to fetch() or execute(). This is not a limitation of RBHive - it's how the Thrift service works. It isn't the same as the CLI interface, which would allow this.