td-client 0.8.46 → 0.8.47
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.
- data/ChangeLog +5 -0
- data/README.rdoc +4 -0
- data/lib/td/client.rb +5 -2
- data/lib/td/client/api.rb +12 -2
- data/lib/td/client/version.rb +1 -1
- metadata +2 -2
data/ChangeLog
CHANGED
data/README.rdoc
CHANGED
data/lib/td/client.rb
CHANGED
@@ -121,8 +121,11 @@ class Client
|
|
121
121
|
|
122
122
|
# => Job
|
123
123
|
def query(db_name, q, result_url=nil, priority=nil, retry_limit=nil, opts={})
|
124
|
-
|
125
|
-
|
124
|
+
# for compatibility, assume type is hive unless specifically specified
|
125
|
+
type = opts[:type] || opts['type'] || :hive
|
126
|
+
raise ArgumentError, "only 'hive' and 'pig' types are supported" unless [:hive, :pig].include? type
|
127
|
+
job_id = @api.query(q, type, db_name, result_url, priority, retry_limit, opts)
|
128
|
+
Job.new(self, job_id, type, q)
|
126
129
|
end
|
127
130
|
|
128
131
|
# => [Job]
|
data/lib/td/client/api.rb
CHANGED
@@ -56,7 +56,7 @@ class API
|
|
56
56
|
end
|
57
57
|
|
58
58
|
@http_proxy = opts[:http_proxy] || ENV['HTTP_PROXY']
|
59
|
-
if @http_proxy
|
59
|
+
if @http_proxy
|
60
60
|
if @http_proxy =~ /\Ahttp:\/\/(.*)\z/
|
61
61
|
@http_proxy = $~[1]
|
62
62
|
end
|
@@ -474,11 +474,21 @@ class API
|
|
474
474
|
|
475
475
|
# => jobId:String
|
476
476
|
def hive_query(q, db=nil, result_url=nil, priority=nil, retry_limit=nil, opts={})
|
477
|
+
query(q, :hive, db, result_url, priority, retry_limit, opts)
|
478
|
+
end
|
479
|
+
|
480
|
+
# => jobId:String
|
481
|
+
def pig_query(q, db=nil, result_url=nil, priority=nil, retry_limit=nil, opts={})
|
482
|
+
query(q, :pig, db, result_url, priority, retry_limit, opts)
|
483
|
+
end
|
484
|
+
|
485
|
+
# => jobId:String
|
486
|
+
def query(q, type=:hive, db=nil, result_url=nil, priority=nil, retry_limit=nil, opts={})
|
477
487
|
params = {'query' => q}.merge(opts)
|
478
488
|
params['result'] = result_url if result_url
|
479
489
|
params['priority'] = priority if priority
|
480
490
|
params['retry_limit'] = retry_limit if retry_limit
|
481
|
-
code, body, res = post("/v3/job/issue
|
491
|
+
code, body, res = post("/v3/job/issue/#{type}/#{e db}", params)
|
482
492
|
if code != "200"
|
483
493
|
raise_error("Query failed", res)
|
484
494
|
end
|
data/lib/td/client/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: td-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.47
|
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: 2013-
|
12
|
+
date: 2013-04-09 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: msgpack
|