pinot-client 1.16.0 → 1.19.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: bdea2c828052e0f38c39017c3a87b160f0022c18bcbfc2df13161a9147c6794a
4
+ data.tar.gz: af9ac6c3e45d38cc91ed4b7ef20ec53cee56fbe853187ceefa92a1b79920d7ac
5
5
  SHA512:
6
- metadata.gz: bb715615d2af17557a6ea45b97c14b8a00079841c28259708b66431f837290cfaa31ae3b863d13bfaf416d78c568f2f8bfe1d2758eded1e6e6081e84203abdd8
7
- data.tar.gz: 738c06c6e6c5629a675fe793ccec5ea919dadae5b39c4da39cc6eefcdac88ec9962a8929f6fd016e16367003aa309f8c595450c736e721e55a27dbf3f792d91e
6
+ metadata.gz: '0648832d123002c54acc059f439a49396405514b1addfbf88802e45182305060f7a0d274ac5fd3999cf041b35326833361eadabf3738f944030926cae76b9806'
7
+ data.tar.gz: b3bd1ed17cb209626da077dee9892e050292148ccef4af39e787ef1ca7f65ec40feace8e20d39b23be7027d1d28f2f3d71ba826eba885daa76e463ef72b5401b
@@ -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.19.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.19.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Xiang Fu
@@ -66,6 +66,34 @@ dependencies:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: '13.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: simplecov
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '0.22'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '0.22'
83
+ - !ruby/object:Gem::Dependency
84
+ name: simplecov-lcov
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '0.8'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '0.8'
69
97
  description: A Ruby client for Apache Pinot, mirroring the Go client API
70
98
  email:
71
99
  executables: []
@@ -115,7 +143,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
115
143
  requirements:
116
144
  - - ">="
117
145
  - !ruby/object:Gem::Version
118
- version: '2.6'
146
+ version: '3.2'
119
147
  required_rubygems_version: !ruby/object:Gem::Requirement
120
148
  requirements:
121
149
  - - ">="