pinot-client 1.12.0 → 1.16.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/README.md +16 -0
- data/lib/pinot/connection.rb +6 -9
- data/lib/pinot/connection_factory.rb +5 -2
- data/lib/pinot/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: cfa501b22e0b1a69addd7cb33728772fb9717f60fd3986c3fd98c31ba0f3d2a9
|
|
4
|
+
data.tar.gz: 4e20a3f3c908b5da5afd357dcff60139334929ee086fc58ac044732c5c73205b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: bb715615d2af17557a6ea45b97c14b8a00079841c28259708b66431f837290cfaa31ae3b863d13bfaf416d78c568f2f8bfe1d2758eded1e6e6081e84203abdd8
|
|
7
|
+
data.tar.gz: 738c06c6e6c5629a675fe793ccec5ea919dadae5b39c4da39cc6eefcdac88ec9962a8929f6fd016e16367003aa309f8c595450c736e721e55a27dbf3f792d91e
|
data/README.md
CHANGED
|
@@ -40,6 +40,22 @@ resp = client.execute_sql("baseballStats", "SELECT count(*) AS cnt FROM baseba
|
|
|
40
40
|
puts resp.result_table.get_long(0, 0) # => 97889
|
|
41
41
|
```
|
|
42
42
|
|
|
43
|
+
## Examples
|
|
44
|
+
|
|
45
|
+
The [`examples/`](examples/) directory contains runnable scripts demonstrating common usage patterns:
|
|
46
|
+
|
|
47
|
+
- [`basic_query.rb`](examples/basic_query.rb) — simple SQL query and result iteration
|
|
48
|
+
- [`prepared_statement.rb`](examples/prepared_statement.rb) — parameterized queries with PreparedStatement
|
|
49
|
+
- [`controller_discovery.rb`](examples/controller_discovery.rb) — automatic broker discovery via Controller
|
|
50
|
+
- [`instrumentation.rb`](examples/instrumentation.rb) — attaching metrics/logging hooks
|
|
51
|
+
- [`multistage_query.rb`](examples/multistage_query.rb) — multi-stage query engine usage
|
|
52
|
+
|
|
53
|
+
Run any example against a local Pinot quickstart cluster:
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
ruby examples/basic_query.rb
|
|
57
|
+
```
|
|
58
|
+
|
|
43
59
|
## Creating a Connection
|
|
44
60
|
|
|
45
61
|
### From a broker list
|
data/lib/pinot/connection.rb
CHANGED
|
@@ -25,27 +25,24 @@ module Pinot
|
|
|
25
25
|
@trace = false
|
|
26
26
|
end
|
|
27
27
|
|
|
28
|
-
def execute_sql(table, query)
|
|
28
|
+
def execute_sql(table, query, query_timeout_ms: nil)
|
|
29
29
|
Pinot::Instrumentation.instrument(table: table, query: query) do
|
|
30
30
|
logger.debug "Executing SQL on table=#{table}: #{query}"
|
|
31
31
|
broker = @broker_selector.select_broker(table)
|
|
32
|
-
@
|
|
32
|
+
effective_timeout = query_timeout_ms || @query_timeout_ms
|
|
33
|
+
@transport.execute(broker, build_request(query, timeout_ms: effective_timeout))
|
|
33
34
|
end
|
|
34
35
|
rescue => e
|
|
35
36
|
raise "unable to execute SQL on table #{table}: #{e.message}"
|
|
36
37
|
end
|
|
37
38
|
|
|
38
39
|
def execute_sql_with_timeout(table, query, timeout_ms)
|
|
39
|
-
|
|
40
|
-
broker = @broker_selector.select_broker(table)
|
|
41
|
-
@transport.execute(broker, build_request(query, timeout_ms: timeout_ms))
|
|
42
|
-
rescue => e
|
|
43
|
-
raise "unable to execute SQL on table #{table}: #{e.message}"
|
|
40
|
+
execute_sql(table, query, query_timeout_ms: timeout_ms)
|
|
44
41
|
end
|
|
45
42
|
|
|
46
|
-
def execute_sql_with_params(table, query_pattern, params)
|
|
43
|
+
def execute_sql_with_params(table, query_pattern, params, query_timeout_ms: nil)
|
|
47
44
|
query = format_query(query_pattern, params)
|
|
48
|
-
execute_sql(table, query)
|
|
45
|
+
execute_sql(table, query, query_timeout_ms: query_timeout_ms)
|
|
49
46
|
rescue => e
|
|
50
47
|
# Re-raise format errors directly (they already have the right message)
|
|
51
48
|
raise e
|
|
@@ -22,7 +22,8 @@ module Pinot
|
|
|
22
22
|
transport: transport,
|
|
23
23
|
broker_selector: selector,
|
|
24
24
|
use_multistage_engine: config.use_multistage_engine || false,
|
|
25
|
-
logger: config.logger
|
|
25
|
+
logger: config.logger,
|
|
26
|
+
query_timeout_ms: config.query_timeout_ms
|
|
26
27
|
)
|
|
27
28
|
|
|
28
29
|
selector.init
|
|
@@ -38,6 +39,7 @@ module Pinot
|
|
|
38
39
|
http_client: inner,
|
|
39
40
|
extra_headers: config.extra_http_header || {},
|
|
40
41
|
logger: config.logger,
|
|
42
|
+
timeout_ms: config.query_timeout_ms,
|
|
41
43
|
max_retries: config.max_retries || 0,
|
|
42
44
|
retry_interval_ms: config.retry_interval_ms || 200
|
|
43
45
|
)
|
|
@@ -46,7 +48,8 @@ module Pinot
|
|
|
46
48
|
transport: transport,
|
|
47
49
|
broker_selector: selector,
|
|
48
50
|
use_multistage_engine: config.use_multistage_engine || false,
|
|
49
|
-
logger: config.logger
|
|
51
|
+
logger: config.logger,
|
|
52
|
+
query_timeout_ms: config.query_timeout_ms
|
|
50
53
|
)
|
|
51
54
|
end
|
|
52
55
|
|
data/lib/pinot/version.rb
CHANGED
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.
|
|
4
|
+
version: 1.16.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Xiang Fu
|
|
@@ -104,6 +104,7 @@ licenses:
|
|
|
104
104
|
metadata:
|
|
105
105
|
homepage_uri: https://github.com/startreedata/ruby-pinot-client
|
|
106
106
|
source_code_uri: https://github.com/startreedata/ruby-pinot-client
|
|
107
|
+
changelog_uri: https://github.com/startreedata/ruby-pinot-client/blob/main/CHANGELOG.md
|
|
107
108
|
bug_tracker_uri: https://github.com/startreedata/ruby-pinot-client/issues
|
|
108
109
|
github_repo: ssh://git@github.com/startreedata/ruby-pinot-client
|
|
109
110
|
post_install_message:
|