forward3d / rbhive

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

Invalid value of field serverProtocolVersion! (Thrift::ProtocolException) #16

Closed Rockyyost closed 10 years ago

Rockyyost commented 10 years ago

I've had to upgrade Cloudera to CDH5. With Hue, I can connect to Hiveserver2, however, when I try through rbhive, I get 'Invalid value of field serverProtocolVersion! (Thrift::ProtocolException)' as an error when trying to connect. I looked at the Hive logs, and it seems like things connected okay. Here are the relevant lines from the Hive logs:

2014-03-01 15:18:40,655 INFO org.apache.hive.service.cli.thrift.ThriftCLIService: Client protocol version: HIVE_CLI_SERVICE_PROTOCOL_V3
2014-03-01 15:18:40,789 WARN org.apache.hadoop.hive.conf.HiveConf: DEPRECATED: Configuration property hive.metastore.local no longer has any effect. Make sure to provide a valid value for hive.metastore.uris if you are connecting to a remote metastore.
2014-03-01 15:18:40,877 WARN org.apache.hadoop.hive.conf.HiveConf: DEPRECATED: Configuration property hive.metastore.local no longer has any effect. Make sure to provide a valid value for hive.metastore.uris if you are connecting to a remote metastore.
2014-03-01 15:18:40,878 INFO org.apache.hive.service.cli.CLIService: SessionHandle [bdb9f8f3-439b-483f-9874-01a1e02c9f27]: openSession()
andytinycat commented 10 years ago

Can you show me your connection code?

CDH5 has Hive 0.12, which will require you to set the Thrift protocol version to the one that Hive 0.12 supports, using the :hive_version parameter.

RBHive.tcli_connect('hive.server.address', 10_000, {:hive_version => 12}) do |connection|
  ...your code here...
end
Rockyyost commented 10 years ago

I have been passing the version. Here's what I have:

RBHive.tcli_connect(server_address, 10_000, {:hive_version => 12, :transport => :sasl, :sasl_params => {} }) do |connection|
         code
end
andytinycat commented 10 years ago

I'll have a look at the CDH5 Hive release and see what version number it expects in the field.

andytinycat commented 10 years ago

Ok, it looks like there was an additional version added to the protocol, but was missing from the Hive TCLIService.thrift file until this fix was merged.

I'll regenerate the Thrift files and release a new version in the next day or so.

andytinycat commented 10 years ago

I've regenerated the Thrift files - you'll want to pass the symbol :cdh5 as your Hive version, and that should work. Let me know if it doesn't - closing this for now.

Rockyyost commented 10 years ago

Cool! Thanks, I'll give it a shot soon.

On Mar 28, 2014, at 11:31 AM, Andy Sykes notifications@github.com wrote:

I've regenerated the Thrift files - you'll want to pass the symbol :cdh5 as your Hive version, and that should work. Let me know if it doesn't - closing this for now.

— Reply to this email directly or view it on GitHub.