presto-client 0.4.17 → 0.5.0
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 +4 -4
- data/.travis.yml +1 -1
- data/README.md +7 -0
- data/Rakefile +30 -8
- data/lib/presto/client/model_versions/0.149.rb +1683 -0
- data/lib/presto/client/model_versions/0.153.rb +1711 -0
- data/lib/presto/client/models.rb +7 -1677
- data/lib/presto/client/statement_client.rb +10 -4
- data/lib/presto/client/version.rb +1 -1
- data/modelgen/model_versions.rb +247 -0
- data/modelgen/modelgen.rb +6 -4
- data/modelgen/models.rb +7 -223
- data/modelgen/presto_models.rb +1 -1
- data/spec/model_spec.rb +35 -0
- data/spec/statement_client_spec.rb +18 -4
- metadata +7 -2
data/modelgen/presto_models.rb
CHANGED
@@ -214,7 +214,7 @@ module PrestoModels
|
|
214
214
|
def convert_expression(type, base_type, key)
|
215
215
|
if @special_types[type]
|
216
216
|
special.call(key)
|
217
|
-
elsif @enum_types.include?(type)
|
217
|
+
elsif @enum_types.include?(type) || @enum_types.include?(base_type)
|
218
218
|
"#{key}.downcase.to_sym"
|
219
219
|
elsif @primitive_types.include?(base_type)
|
220
220
|
key
|
data/spec/model_spec.rb
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Presto::Client::Models do
|
4
|
+
describe 'rehash of BlockedReason' do
|
5
|
+
h = {
|
6
|
+
"operatorId" => 0,
|
7
|
+
"planNodeId" => "47",
|
8
|
+
"operatorType" => "ScanFilterAndProjectOperator",
|
9
|
+
"addInputCalls" => 0,
|
10
|
+
"addInputWall" => "0.00ns",
|
11
|
+
"addInputCpu" => "0.00ns",
|
12
|
+
"addInputUser" => "0.00ns",
|
13
|
+
"inputDataSize" => "9.46MB",
|
14
|
+
"inputPositions" => 440674,
|
15
|
+
"getOutputCalls" => 734,
|
16
|
+
"getOutputWall" => "7.29s",
|
17
|
+
"getOutputCpu" => "0.00ns",
|
18
|
+
"getOutputUser" => "0.00ns",
|
19
|
+
"outputDataSize" => "36.99MB",
|
20
|
+
"outputPositions" => 440674,
|
21
|
+
"blockedWall" => "0.00ns",
|
22
|
+
"finishCalls" => 0,
|
23
|
+
"finishWall" => "0.00ns",
|
24
|
+
"finishCpu" => "0.00ns",
|
25
|
+
"finishUser" => "0.00ns",
|
26
|
+
"memoryReservation" => "0B",
|
27
|
+
"systemMemoryReservation" => "0b",
|
28
|
+
"blockedReason" => "WAITING_FOR_MEMORY",
|
29
|
+
"info" => {"k" => "v"}
|
30
|
+
}
|
31
|
+
|
32
|
+
stats = Models::OperatorStats.decode(h)
|
33
|
+
stats.blocked_reason.should == :waiting_for_memory
|
34
|
+
end
|
35
|
+
end
|
@@ -85,13 +85,11 @@ describe Presto::Client::StatementClient do
|
|
85
85
|
it "decodes DeleteHandle" do
|
86
86
|
dh = Models::DeleteHandle.decode({
|
87
87
|
"handle" => {
|
88
|
-
"
|
89
|
-
"connectorHandle" => {},
|
88
|
+
"connectorHandle" => {}
|
90
89
|
}
|
91
90
|
})
|
92
91
|
dh.handle.should be_a_kind_of Models::TableHandle
|
93
|
-
|
94
|
-
dh.handle.connector_handle.should == {}
|
92
|
+
dh.handle.connector_handle.should == nil
|
95
93
|
end
|
96
94
|
|
97
95
|
it "validates models" do
|
@@ -180,5 +178,21 @@ describe Presto::Client::StatementClient do
|
|
180
178
|
end.should raise_error(ArgumentError, /:ssl/)
|
181
179
|
end
|
182
180
|
end
|
181
|
+
|
182
|
+
it "supports multiple model versions" do
|
183
|
+
stub_request(:post, "localhost/v1/statement").
|
184
|
+
with({body: query}).
|
185
|
+
to_return(body: response_json.to_json)
|
186
|
+
|
187
|
+
faraday = Faraday.new(url: "http://localhost")
|
188
|
+
client = StatementClient.new(faraday, query, options.merge(model_version: "0.149"))
|
189
|
+
client.current_results.should be_a_kind_of(ModelVersions::V0_149::QueryResults)
|
190
|
+
end
|
191
|
+
|
192
|
+
it "rejects unsupported model version" do
|
193
|
+
lambda do
|
194
|
+
StatementClient.new(faraday, query, options.merge(model_version: "0.111"))
|
195
|
+
end.should raise_error(NameError)
|
196
|
+
end
|
183
197
|
end
|
184
198
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: presto-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sadayuki Furuhashi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-10-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -117,15 +117,19 @@ files:
|
|
117
117
|
- lib/presto/client.rb
|
118
118
|
- lib/presto/client/client.rb
|
119
119
|
- lib/presto/client/errors.rb
|
120
|
+
- lib/presto/client/model_versions/0.149.rb
|
121
|
+
- lib/presto/client/model_versions/0.153.rb
|
120
122
|
- lib/presto/client/models.rb
|
121
123
|
- lib/presto/client/query.rb
|
122
124
|
- lib/presto/client/statement_client.rb
|
123
125
|
- lib/presto/client/version.rb
|
126
|
+
- modelgen/model_versions.rb
|
124
127
|
- modelgen/modelgen.rb
|
125
128
|
- modelgen/models.rb
|
126
129
|
- modelgen/presto_models.rb
|
127
130
|
- presto-client.gemspec
|
128
131
|
- spec/client_spec.rb
|
132
|
+
- spec/model_spec.rb
|
129
133
|
- spec/spec_helper.rb
|
130
134
|
- spec/statement_client_spec.rb
|
131
135
|
homepage: https://github.com/treasure-data/presto-client-ruby
|
@@ -154,5 +158,6 @@ specification_version: 4
|
|
154
158
|
summary: Presto client library
|
155
159
|
test_files:
|
156
160
|
- spec/client_spec.rb
|
161
|
+
- spec/model_spec.rb
|
157
162
|
- spec/spec_helper.rb
|
158
163
|
- spec/statement_client_spec.rb
|