pinot-client 1.16.0 → 1.18.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cfa501b22e0b1a69addd7cb33728772fb9717f60fd3986c3fd98c31ba0f3d2a9
4
- data.tar.gz: 4e20a3f3c908b5da5afd357dcff60139334929ee086fc58ac044732c5c73205b
3
+ metadata.gz: 22de970391b9faa4d6f889e1891e84e69c2d045b4f22132d5d892a619b85659d
4
+ data.tar.gz: 64d0af1ca75e2a1ac9b074d8958d1a8b9df4599fdaf1f0570d95a1395f2faeb0
5
5
  SHA512:
6
- metadata.gz: bb715615d2af17557a6ea45b97c14b8a00079841c28259708b66431f837290cfaa31ae3b863d13bfaf416d78c568f2f8bfe1d2758eded1e6e6081e84203abdd8
7
- data.tar.gz: 738c06c6e6c5629a675fe793ccec5ea919dadae5b39c4da39cc6eefcdac88ec9962a8929f6fd016e16367003aa309f8c595450c736e721e55a27dbf3f792d91e
6
+ metadata.gz: 4654c1ca25d89bea2e4b1723153e079f016b15af06b736f7c3577475c34eb728ba2e19e8889273a6bf2f39742e9fb243460bb64fae7a9fe701cb7c9b8e4ecbd5
7
+ data.tar.gz: 52c5de1088080bba980bca3914b2e626c57e8d0e965b0127043ded49e3a165fbc6273e1f485e57111260d191086b0e35937ca5d40a950a46d47f9701a3913545
@@ -32,8 +32,6 @@ module Pinot
32
32
  effective_timeout = query_timeout_ms || @query_timeout_ms
33
33
  @transport.execute(broker, build_request(query, timeout_ms: effective_timeout))
34
34
  end
35
- rescue => e
36
- raise "unable to execute SQL on table #{table}: #{e.message}"
37
35
  end
38
36
 
39
37
  def execute_sql_with_timeout(table, query, timeout_ms)
@@ -18,7 +18,7 @@ module Pinot
18
18
  def execute(broker_address, request)
19
19
  stub = build_stub(broker_address)
20
20
  grpc_request = build_request(request)
21
- call_opts = build_call_opts
21
+ call_opts = build_call_opts(request)
22
22
 
23
23
  grpc_response = stub.submit(grpc_request, **call_opts)
24
24
  BrokerResponse.from_json(grpc_response.payload)
@@ -55,12 +55,19 @@ module Pinot
55
55
  def build_query_options(request)
56
56
  parts = ["groupByMode=sql", "responseFormat=sql"]
57
57
  parts << "useMultistageEngine=true" if request.use_multistage_engine
58
+ parts << "timeoutMs=#{request.query_timeout_ms}" if request.query_timeout_ms
58
59
  parts.join(";")
59
60
  end
60
61
 
61
- def build_call_opts
62
+ def build_call_opts(request)
62
63
  opts = {}
63
- opts[:deadline] = Time.now + @config.timeout if @config.timeout
64
+ # Per-request timeout takes precedence over config-level timeout
65
+ timeout_s = if request.query_timeout_ms
66
+ request.query_timeout_ms / 1000.0
67
+ elsif @config.timeout
68
+ @config.timeout
69
+ end
70
+ opts[:deadline] = Time.now + timeout_s if timeout_s
64
71
  opts[:metadata] = @config.extra_metadata unless @config.extra_metadata.empty?
65
72
  opts
66
73
  end
@@ -4,6 +4,8 @@ module Pinot
4
4
 
5
5
  def initialize(broker_list)
6
6
  @broker_list = broker_list.dup.freeze
7
+ @mutex = Mutex.new
8
+ @index = 0
7
9
  end
8
10
 
9
11
  def init
@@ -12,7 +14,11 @@ module Pinot
12
14
 
13
15
  def select_broker(_table)
14
16
  raise BrokerNotFoundError, "no pre-configured broker lists" if @broker_list.empty?
15
- @broker_list.sample
17
+ @mutex.synchronize do
18
+ broker = @broker_list[@index % @broker_list.size]
19
+ @index += 1
20
+ broker
21
+ end
16
22
  end
17
23
  end
18
24
  end
@@ -38,6 +38,16 @@ module Pinot
38
38
  end
39
39
  end
40
40
 
41
+ def close
42
+ @reaper.kill rescue nil
43
+ @pool_mutex.synchronize do
44
+ @pool.each_value do |entries|
45
+ entries.each { |entry| entry.http.finish rescue nil }
46
+ end
47
+ @pool.clear
48
+ end
49
+ end
50
+
41
51
  private
42
52
 
43
53
  def with_connection(url)
data/lib/pinot/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Pinot
2
- VERSION = "1.16.0"
2
+ VERSION = "1.18.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pinot-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.16.0
4
+ version: 1.18.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Xiang Fu
@@ -115,7 +115,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
115
115
  requirements:
116
116
  - - ">="
117
117
  - !ruby/object:Gem::Version
118
- version: '2.6'
118
+ version: '3.2'
119
119
  required_rubygems_version: !ruby/object:Gem::Requirement
120
120
  requirements:
121
121
  - - ">="