forward3d / rbhive

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

No version identifier, old protocol client error with Spark 3 #55

Closed ankane closed 3 years ago

ankane commented 3 years ago

Hi, thanks for this gem! I'm hoping to use it with the Thrift JDBC/ODBC server that ships with Spark 3 (./sbin/start-thriftserver.sh), but I'm getting the following error:

Traceback (most recent call last):
    6: from main.rb:3:in `<main>'
    5: from /Users/andrew/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rbhive-1.0.0/lib/rbhive/t_c_l_i_connection.rb:56:in `tcli_connect'
    4: from /Users/andrew/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rbhive-1.0.0/lib/rbhive/t_c_l_i_connection.rb:155:in `open_session'
    3: from /Users/andrew/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rbhive-1.0.0/lib/thrift/t_c_l_i_service.rb:18:in `OpenSession'
    2: from /Users/andrew/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rbhive-1.0.0/lib/thrift/t_c_l_i_service.rb:26:in `recv_OpenSession'
    1: from /Users/andrew/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/thrift-0.11.0.0/lib/thrift/client.rb:54:in `receive_message'
/Users/andrew/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/thrift-0.11.0.0/lib/thrift/protocol/binary_protocol.rb:131:in `read_message_begin': No version identifier, old protocol client? (Thrift::ProtocolException)

Script

require "rbhive"

RBHive.tcli_connect('localhost', 10000, {logger: Logger.new(STDOUT), hive_version: 13}) do |connection|
  p connection.fetch('SHOW TABLES')
end

I've tried it with all the hive_versions, but no luck.

ankane commented 3 years ago

For future readers, the Spark SQL Thrift server uses SASL by default.

require "rbhive"

RBHive.tcli_connect('localhost', 10000, {transport: :sasl, sasl_params: {}}) do |connection|
  p connection.fetch('SHOW TABLES')
end