rbhive 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/rbhive/connection.rb +11 -1
- metadata +5 -6
data/lib/rbhive/connection.rb
CHANGED
@@ -14,13 +14,22 @@ module RBHive
|
|
14
14
|
end
|
15
15
|
module_function :connect
|
16
16
|
|
17
|
+
class StdOutLogger
|
18
|
+
%w(fatal error warn info debug).each do |level|
|
19
|
+
define_method level.to_sym do |message|
|
20
|
+
STDOUT.puts(message)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
17
25
|
class Connection
|
18
26
|
attr_reader :client
|
19
|
-
def initialize(server, port=10_000)
|
27
|
+
def initialize(server, port=10_000, logger=StdOutLogger.new)
|
20
28
|
@socket = Thrift::Socket.new(server, port)
|
21
29
|
@transport = Thrift::BufferedTransport.new(@socket)
|
22
30
|
@protocol = Thrift::BinaryProtocol.new(@transport)
|
23
31
|
@client = ThriftHive::Client.new(@protocol)
|
32
|
+
@logger = logger
|
24
33
|
end
|
25
34
|
|
26
35
|
def open
|
@@ -36,6 +45,7 @@ module RBHive
|
|
36
45
|
end
|
37
46
|
|
38
47
|
def execute(query)
|
48
|
+
@logger.info("Executing Hive Query: #{query}")
|
39
49
|
client.execute(query)
|
40
50
|
end
|
41
51
|
|
metadata
CHANGED
@@ -1,22 +1,21 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rbhive
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 19
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 4
|
10
|
+
version: 0.1.4
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
|
-
-
|
14
|
-
- Paul Ingles
|
13
|
+
- Forward Internet Group
|
15
14
|
autorequire:
|
16
15
|
bindir: bin
|
17
16
|
cert_chain: []
|
18
17
|
|
19
|
-
date: 2010-09-
|
18
|
+
date: 2010-09-29 00:00:00 +01:00
|
20
19
|
default_executable:
|
21
20
|
dependencies:
|
22
21
|
- !ruby/object:Gem::Dependency
|