pinot-client 1.1.0 → 1.2.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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +59 -1
  3. data/lib/pinot/version.rb +1 -1
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2f2e2377c6f9af1cb73b472bd5b7c9ad2bfa512ec0594c67d3298c884bee5f0a
4
- data.tar.gz: 608b9a1f070dd22d71a793ad1e4817dcdbe4100b14e3aa4033e71643fc2de9a8
3
+ metadata.gz: 8307d3d291be0af45b13a63512bd9f7d2f10d1c4db6383edd72b9ab5bb7c1e03
4
+ data.tar.gz: c74a5865da644b9edf2db66cfcc79eb6021e8ac06a872ab7e2d2528448ea1ea2
5
5
  SHA512:
6
- metadata.gz: bd247b8088c5be2b20d78e95e0cc16effd8b8c24e136810101f5a136d630dcbca002127ace5ea56f98a9c9308a0d7ae42c20d16a32d9ebba8ad3f11656ceff08
7
- data.tar.gz: 02ecaf1df43b2117a2ad86cf481ec241412668c3e96a49fc046e2a730fd92e6d44edad99f34f9ab68eac44d457cd88d5acda636226241ab7bbe82206ae99ea0c
6
+ metadata.gz: ae76f79806e4a0eef9f18f7ea7253a2ad4aba9f098bdf389e91b5cb1e2463d1e5637f158984523ceb9e99de0da293f541e37c36ac322d877d78c0be024ff6883
7
+ data.tar.gz: 034d035acefa3616c6f4892f22bd6cfc9569e43ffa5189930b96efc6a232a0e0fe11795a96e4546be6d7577425da3e590afab42223730ae682d86abb868d16e5
data/README.md CHANGED
@@ -67,7 +67,7 @@ client = Pinot.from_controller("localhost:9000")
67
67
  ```ruby
68
68
  config = Pinot::ClientConfig.new(
69
69
  broker_list: ["localhost:8000"],
70
- http_timeout: 10, # seconds
70
+ http_timeout: 10, # seconds — sets open_timeout, read_timeout, and write_timeout on the underlying Net::HTTP connection
71
71
  extra_http_header: { "Authorization" => "Bearer <token>" },
72
72
  use_multistage_engine: false,
73
73
  controller_config: Pinot::ControllerConfig.new(
@@ -79,6 +79,38 @@ config = Pinot::ClientConfig.new(
79
79
  client = Pinot.from_config(config)
80
80
  ```
81
81
 
82
+ ### With TLS
83
+
84
+ ```ruby
85
+ tls = Pinot::TlsConfig.new(
86
+ ca_cert_file: "/path/to/ca.pem",
87
+ client_cert_file: "/path/to/client.crt",
88
+ client_key_file: "/path/to/client.key",
89
+ insecure_skip_verify: false # set true to skip cert verification
90
+ )
91
+ config = Pinot::ClientConfig.new(
92
+ broker_list: ["https://pinot-broker.example.com:8000"],
93
+ tls_config: tls
94
+ )
95
+ client = Pinot.from_config(config)
96
+ ```
97
+
98
+ ## Logging
99
+
100
+ By default the client logs warnings to stdout. Configure a custom logger globally or per-client:
101
+
102
+ ```ruby
103
+ # Global logger
104
+ Pinot::Logging.logger = Logger.new("pinot.log", level: Logger::DEBUG)
105
+
106
+ # Per-client logger via ClientConfig
107
+ config = Pinot::ClientConfig.new(
108
+ broker_list: ["localhost:8000"],
109
+ logger: Logger.new($stdout, level: Logger::INFO)
110
+ )
111
+ client = Pinot.from_config(config)
112
+ ```
113
+
82
114
  ## Executing Queries
83
115
 
84
116
  ### Simple SQL
@@ -124,6 +156,32 @@ resp = client.execute_sql("baseballStats", "SELECT count(*) FROM baseballStats")
124
156
  client.close_trace
125
157
  ```
126
158
 
159
+ ## Error Handling
160
+
161
+ All errors raised by the client inherit from `Pinot::Error < StandardError`:
162
+
163
+ | Class | Raised when |
164
+ |-------|-------------|
165
+ | `Pinot::BrokerNotFoundError` | No broker available (empty list or all offline) |
166
+ | `Pinot::TableNotFoundError` | Named table not found in broker map |
167
+ | `Pinot::TransportError` | Non-200 HTTP response from broker |
168
+ | `Pinot::PreparedStatementClosedError` | Operation on a closed prepared statement |
169
+ | `Pinot::ConfigurationError` | Invalid config (bad URL scheme, missing broker source) |
170
+
171
+ Example:
172
+
173
+ ```ruby
174
+ begin
175
+ resp = client.execute_sql("myTable", "SELECT * FROM myTable")
176
+ rescue Pinot::TableNotFoundError => e
177
+ puts "Table missing: #{e.message}"
178
+ rescue Pinot::TransportError => e
179
+ puts "Broker error: #{e.message}"
180
+ rescue Pinot::Error => e
181
+ puts "Pinot error: #{e.message}"
182
+ end
183
+ ```
184
+
127
185
  ## Reading Results
128
186
 
129
187
  `execute_sql` returns a `Pinot::BrokerResponse`. Results are in `result_table`:
data/lib/pinot/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Pinot
2
- VERSION = "1.1.0"
2
+ VERSION = "1.2.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.1.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Xiang Fu