impala 0.5.0 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 488007beb7a8a2ecc5e1663356305ea2d2a705d1
4
- data.tar.gz: 4e7276e73ee5d17e790116fc38f59938e00d5e15
3
+ metadata.gz: d6d04d8e537a01c0ba40812df78ee3746c11ef63
4
+ data.tar.gz: 3de3a3dea1535e62fa72fe55efa3ae60506b7802
5
5
  SHA512:
6
- metadata.gz: 6e903365b98beb2a78e2a2a4bea721035ca58344b54e196ba67ae15ac814a20024ef79565d019dc390a58529ff80cc760f254d67080833e21fdb44f90f164eeb
7
- data.tar.gz: 0d43d9e6442237bd7ecc27ff9770bc3e51058d166a847200c1830b5466bb3c51250be848b8563922618dc10199c716f487bd01d3e5c40ba97188205d137375e4
6
+ metadata.gz: 9e1b70f914e5ce0fb488d19c0048f53506c1a9c329126385919831e396833db7b867d68db356aa99ff29129b100a1be61c9c70dfa8c4b4c506d5be63a59f5dc6
7
+ data.tar.gz: 1a5e96394a14b0af13d9e1e388a896bc7d4265b7acee77a7875cef8ca32abc2be9d4c60c645f0207982685a99ecf8e770a6e0aa97ebd7a2a3cb727b53b7da578
@@ -65,8 +65,8 @@ module Impala
65
65
  # except for :user, see TImpalaQueryOptions in ImpalaService.thrift
66
66
  # @option query_options [String] :user the user runs the query
67
67
  # @return [Array<Hash>] an array of hashes, one for each row.
68
- def query(raw_query, query_options = {})
69
- execute(raw_query, query_options).fetch_all
68
+ def query(query, query_options = {})
69
+ execute(query, query_options).fetch_all
70
70
  end
71
71
 
72
72
  # Perform a query and return a cursor for iterating over the results.
@@ -75,29 +75,19 @@ module Impala
75
75
  # except for :user, see TImpalaQueryOptions in ImpalaService.thrift
76
76
  # @option query_options [String] :user the user runs the query
77
77
  # @return [Cursor] a cursor for the result rows
78
- def execute(raw_query, query_options = {})
78
+ def execute(query, query_options = {})
79
79
  raise ConnectionError.new("Connection closed") unless open?
80
80
 
81
- query = sanitize_query(raw_query)
82
81
  handle = send_query(query, query_options)
83
-
84
82
  check_result(handle)
85
83
  Cursor.new(handle, @service)
86
84
  end
87
85
 
88
86
  private
89
87
 
90
- def sanitize_query(raw_query)
91
- words = raw_query.split
92
- raise InvalidQueryError.new("Empty query") if words.empty?
93
-
94
- command = words.first.downcase
95
- ([command] + words[1..-1]).join(' ')
96
- end
97
-
98
- def send_query(sanitized_query, query_options)
88
+ def send_query(query_text, query_options)
99
89
  query = Protocol::Beeswax::Query.new
100
- query.query = sanitized_query
90
+ query.query = query_text
101
91
 
102
92
  query.hadoop_user = query_options.delete(:user) if query_options[:user]
103
93
  query.configuration = query_options.map do |key, value|
@@ -1,3 +1,3 @@
1
1
  module Impala
2
- VERSION = "0.5.0"
2
+ VERSION = "0.5.1"
3
3
  end
@@ -29,22 +29,6 @@ describe 'Impala.connect' do
29
29
  end
30
30
 
31
31
  describe Impala::Connection do
32
- describe '#sanitize_query' do
33
- before do
34
- Impala::Connection.any_instance.stubs(:open)
35
- @connection = Impala::Connection.new('test', 1234)
36
- end
37
-
38
- it 'should downcase the command but nothing else' do
39
- query = 'SELECT blah FROM Blah'
40
- assert_equal('select blah FROM Blah', @connection.send(:sanitize_query, query))
41
- end
42
-
43
- it 'should reject empty or invalid queries' do
44
- assert_raises(Impala::InvalidQueryError) { @connection.send(:sanitize_query, '')}
45
- end
46
- end
47
-
48
32
  describe '#check_result' do
49
33
  before do
50
34
  Impala::Connection.any_instance.stubs(:open)
@@ -66,12 +50,12 @@ describe Impala::Connection do
66
50
  Impala::Connection.any_instance.stubs(:open)
67
51
  Impala::Cursor.stubs(:new)
68
52
  @connection = Impala::Connection.new('test', 1234)
69
- @connection.stubs(:open? => true, :sanitize_query => 'sanitized_query', :check_result => nil)
53
+ @connection.stubs(:open? => true, :check_result => nil)
70
54
  end
71
55
 
72
- it 'should call Protocol::ImpalaService::Client#executeAndWait with the sanitized query' do
56
+ it 'should call Protocol::ImpalaService::Client#executeAndWait with the query' do
73
57
  query = Impala::Protocol::Beeswax::Query.new
74
- query.query = 'sanitized_query'
58
+ query.query = 'query'
75
59
  query.configuration = []
76
60
 
77
61
  @service = stub()
@@ -83,7 +67,7 @@ describe Impala::Connection do
83
67
 
84
68
  it 'should call Protocol::ImpalaService::Client#executeAndWait with the hadoop_user and configuration if passed as parameter' do
85
69
  query = Impala::Protocol::Beeswax::Query.new
86
- query.query = 'sanitized_query'
70
+ query.query = 'query'
87
71
  query.hadoop_user = 'impala'
88
72
  query.configuration = %w|NUM_SCANNER_THREADS=8 MEM_LIMIT=3221225472|
89
73
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: impala
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Colin Marc
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-09-25 00:00:00.000000000 Z
11
+ date: 2017-01-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thrift
@@ -202,7 +202,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
202
202
  version: '0'
203
203
  requirements: []
204
204
  rubyforge_project:
205
- rubygems_version: 2.4.5.1
205
+ rubygems_version: 2.4.5.2
206
206
  signing_key:
207
207
  specification_version: 4
208
208
  summary: A ruby client for Cloudera's Impala