impala 0.4.0 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/impala/connection.rb +4 -1
- data/lib/impala/version.rb +1 -1
- data/test/test_impala.rb +15 -0
- metadata +8 -2
data/lib/impala/connection.rb
CHANGED
@@ -58,7 +58,10 @@ module Impala
|
|
58
58
|
# @option query_options [String] :user the user runs the query
|
59
59
|
# @return [Array<Hash>] an array of hashes, one for each row.
|
60
60
|
def query(raw_query, query_options = {})
|
61
|
-
execute(raw_query, query_options)
|
61
|
+
cursor = execute(raw_query, query_options)
|
62
|
+
cursor.fetch_all
|
63
|
+
ensure
|
64
|
+
cursor.close
|
62
65
|
end
|
63
66
|
|
64
67
|
# Perform a query and return a cursor for iterating over the results.
|
data/lib/impala/version.rb
CHANGED
data/test/test_impala.rb
CHANGED
@@ -99,4 +99,19 @@ describe Impala::Connection do
|
|
99
99
|
@connection.execute('query', opt)
|
100
100
|
end
|
101
101
|
end
|
102
|
+
|
103
|
+
describe '#query' do
|
104
|
+
before do
|
105
|
+
Impala::Cursor.any_instance.stubs(:fetch_more)
|
106
|
+
@cursor = Impala::Cursor.new(nil, nil)
|
107
|
+
Impala::Connection.any_instance.stubs(:open)
|
108
|
+
@connection = Impala::Connection.new('test', 1234)
|
109
|
+
@connection.stubs(:open? => true, :sanitize_query => 'sanitized_query', :check_result => nil, :execute => @cursor)
|
110
|
+
end
|
111
|
+
|
112
|
+
it 'should close the cursor after returning a value' do
|
113
|
+
@cursor.expects(:close).once
|
114
|
+
@connection.query('query')
|
115
|
+
end
|
116
|
+
end
|
102
117
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: impala
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-
|
12
|
+
date: 2014-06-10 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: thrift
|
@@ -228,12 +228,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
228
228
|
- - ! '>='
|
229
229
|
- !ruby/object:Gem::Version
|
230
230
|
version: '0'
|
231
|
+
segments:
|
232
|
+
- 0
|
233
|
+
hash: -146128838497320562
|
231
234
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
232
235
|
none: false
|
233
236
|
requirements:
|
234
237
|
- - ! '>='
|
235
238
|
- !ruby/object:Gem::Version
|
236
239
|
version: '0'
|
240
|
+
segments:
|
241
|
+
- 0
|
242
|
+
hash: -146128838497320562
|
237
243
|
requirements: []
|
238
244
|
rubyforge_project:
|
239
245
|
rubygems_version: 1.8.23
|