rbhive 0.5.0 → 0.5.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -33,6 +33,26 @@ connecting, you must specify the Hive version or you may get an exception.
33
33
 
34
34
  RBHive implements this client with the `RBHive::TCLIConnection` class.
35
35
 
36
+ #### Warning!
37
+
38
+ We had to set the following in hive-site.xml to get the BufferedTransport Thrift service
39
+ to work with RBHive:
40
+
41
+ <property>
42
+ <name>hive.server2.enable.doAs</name>
43
+ <value>false</value>
44
+ </property>
45
+
46
+ Otherwise you'll get this nasty-looking exception in the logs:
47
+
48
+ ERROR server.TThreadPoolServer: Error occurred during processing of message.
49
+ java.lang.ClassCastException: org.apache.thrift.transport.TSocket cannot be cast to org.apache.thrift.transport.TSaslServerTransport
50
+ at org.apache.hive.service.auth.TUGIContainingProcessor.process(TUGIContainingProcessor.java:35)
51
+ at org.apache.thrift.server.TThreadPoolServer$WorkerProcess.run(TThreadPoolServer.java:206)
52
+ at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
53
+ at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
54
+ at java.lang.Thread.run(Thread.java:662)
55
+
36
56
  ### Other Hive-compatible services
37
57
 
38
58
  Consult the documentation for the service, as this will vary depending on the service you're using.
@@ -174,6 +174,16 @@ module RBHive
174
174
  @logger.info("Setting #{name}=#{value}")
175
175
  self.execute("SET #{name}=#{value}")
176
176
  end
177
+
178
+ # Performs a explain on the supplied query on the server, returns it as a ExplainResult.
179
+ # (Only works on 0.12 if you have this patch - https://issues.apache.org/jira/browse/HIVE-5492)
180
+ def explain(query)
181
+ rows = []
182
+ fetch_in_batch("EXPLAIN " + query) do |batch|
183
+ rows << batch.map { |b| b[:Explain] }
184
+ end
185
+ ExplainResult.new(rows.flatten)
186
+ end
177
187
 
178
188
  # Performs a query on the server, fetches up to *max_rows* rows and returns them as an array.
179
189
  def fetch(query, max_rows = 100)
@@ -1,3 +1,3 @@
1
1
  module RBHive
2
- VERSION = '0.5.0'
2
+ VERSION = '0.5.1'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rbhive
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2013-10-23 00:00:00.000000000 Z
13
+ date: 2013-11-27 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: thrift