presto-client 0.4.13 → 0.4.14
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/ChangeLog +5 -0
- data/lib/presto/client/client.rb +4 -0
- data/lib/presto/client/query.rb +15 -1
- data/lib/presto/client/statement_client.rb +8 -2
- data/lib/presto/client/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1f05ad7fb71f97a4804e24451a201d8043d3518a
|
4
|
+
data.tar.gz: 369f6523a275ead5350cf42a95f0c22d56b52c22
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 938b3b5ae20a354a659713f3ad29952619403d45f01dbf41a1ca8907659250a7b5597787fdcfc3b028e049cc27e819c39b6721b38a0ab5695d86dcbc6b55e911
|
7
|
+
data.tar.gz: 81353b8f0f53784533c282e2471f1c79d4f28de2cdd8506ceb7e291fb8d7fb3c7d979342d952dc7e47f09b1c4b3a7833abcefed85b425bf9a7ed25c59ee88ea5
|
data/ChangeLog
CHANGED
data/lib/presto/client/client.rb
CHANGED
data/lib/presto/client/query.rb
CHANGED
@@ -22,6 +22,14 @@ module Presto::Client
|
|
22
22
|
|
23
23
|
class Query
|
24
24
|
def self.start(query, options)
|
25
|
+
new StatementClient.new(faraday_client(options), query, options)
|
26
|
+
end
|
27
|
+
|
28
|
+
def self.resume(next_uri, options)
|
29
|
+
new StatementClient.new(faraday_client(options), nil, options, next_uri)
|
30
|
+
end
|
31
|
+
|
32
|
+
def self.faraday_client(options)
|
25
33
|
server = options[:server]
|
26
34
|
unless server
|
27
35
|
raise ArgumentError, ":server option is required"
|
@@ -34,9 +42,11 @@ module Presto::Client
|
|
34
42
|
faraday.adapter Faraday.default_adapter
|
35
43
|
end
|
36
44
|
|
37
|
-
|
45
|
+
return faraday
|
38
46
|
end
|
39
47
|
|
48
|
+
private_class_method :faraday_client
|
49
|
+
|
40
50
|
def initialize(api)
|
41
51
|
@api = api
|
42
52
|
end
|
@@ -104,6 +114,10 @@ module Presto::Client
|
|
104
114
|
@api.query_info
|
105
115
|
end
|
106
116
|
|
117
|
+
def next_uri
|
118
|
+
@api.current_results.next_uri
|
119
|
+
end
|
120
|
+
|
107
121
|
def cancel
|
108
122
|
@api.cancel_leaf_stage
|
109
123
|
end
|
@@ -39,7 +39,7 @@ module Presto::Client
|
|
39
39
|
"User-Agent" => "presto-ruby/#{VERSION}",
|
40
40
|
}
|
41
41
|
|
42
|
-
def initialize(faraday, query, options)
|
42
|
+
def initialize(faraday, query, options, next_uri=nil)
|
43
43
|
@faraday = faraday
|
44
44
|
@faraday.headers.merge!(HEADERS)
|
45
45
|
|
@@ -49,7 +49,13 @@ module Presto::Client
|
|
49
49
|
@exception = nil
|
50
50
|
|
51
51
|
@faraday.headers.merge!(optional_headers)
|
52
|
-
|
52
|
+
|
53
|
+
if next_uri
|
54
|
+
body = faraday_get_with_retry(next_uri)
|
55
|
+
@results = Models::QueryResults.decode(MultiJson.load(body))
|
56
|
+
else
|
57
|
+
post_query_request!
|
58
|
+
end
|
53
59
|
end
|
54
60
|
|
55
61
|
def optional_headers
|