trino-client 2.2.1 → 2.2.3

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: a44518a87285ae0051f9543aa73cb869a5d34c355adea490ee43107a88476e56
4
- data.tar.gz: 28a0d53b23d0a74a165e1c83d5c9cfbe87fe926d885c0f5eb8161d7c39c1fa8d
3
+ metadata.gz: 1c843bb17e992cc4b85e75d9c42b1d28defaab68b26226bd3f5157c9d3f66904
4
+ data.tar.gz: ade30ecd070ae456b719d3339bde72fd3e869a939f1a51dca5044015fd999f43
5
5
  SHA512:
6
- metadata.gz: 39630d06e5b300f764c1b861a488c63bbe7c465eee0dc0d8b1979904194429a33c2685a67e47c4c81904fd39e604aa4ed2e4ec93263594f872b924061ad543e3
7
- data.tar.gz: 77c635eed6243bdb7eaccace39a2aee3e22fe8c0654b514644f1acb7d374fb365de7c4920daa72e1a647aa3b4406388ab6b59ef5900f5e4d7807053dc081c2c1
6
+ metadata.gz: 054b13b290fb880b8813a04803fd51d9d131ad225ed496b2fdc9df1c7441314692d6d52809fa3bfcafdb15dbebeebcfa94472e6dacbc4358ecc704c7264d8fed
7
+ data.tar.gz: 03674c67087e069bbf0976f612260da62987d394fa262d717a5f11dd1677f7e1fd4b326cc6609e0c9676e953052435516114199f4d09c2276955a37dc440e20d
@@ -0,0 +1,15 @@
1
+ ---
2
+ repos:
3
+ - repo: https://github.com/pre-commit/pre-commit-hooks
4
+ rev: v4.6.0
5
+ hooks:
6
+ - id: trailing-whitespace
7
+ - id: end-of-file-fixer
8
+ - id: check-yaml
9
+ - id: check-added-large-files
10
+ - id: check-merge-conflict
11
+ - id: check-json
12
+ - id: check-case-conflict
13
+ - id: mixed-line-ending
14
+ args: ['--fix=lf']
15
+ - id: forbid-submodules
data/CLAUDE.md ADDED
@@ -0,0 +1,74 @@
1
+ # CLAUDE.md
2
+
3
+ This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4
+
5
+ ## Development Commands
6
+
7
+ ### Testing
8
+ - `bundle exec rake spec` - Run all RSpec tests
9
+ - `bundle exec rspec spec/[filename]_spec.rb` - Run specific test file
10
+
11
+ ### Building
12
+ - `bundle exec rake build` - Build the gem
13
+ - `bundle exec rake` - Default task (runs spec and build)
14
+
15
+ ### Code Quality
16
+ - `bundle exec standardrb` - Run StandardRB linter (code style enforcement)
17
+ - `bundle exec standardrb --fix` - Auto-fix style issues
18
+
19
+ ### Model Generation
20
+ - `bundle exec rake modelgen:latest` - Generate model files from latest Trino version
21
+ - `bundle exec rake modelgen:all` - Generate all model versions
22
+
23
+ ## Architecture Overview
24
+
25
+ This is a Ruby client library for Trino (distributed SQL query engine). The architecture is layered:
26
+
27
+ ### Core Components
28
+
29
+ 1. **Client Layer** (`lib/trino/client/client.rb`):
30
+ - `Trino::Client::Client` - Main API entry point
31
+ - Provides `run()`, `run_with_names()`, `query()`, `kill()` methods
32
+ - Handles synchronous and streaming query execution
33
+
34
+ 2. **Query Layer** (`lib/trino/client/query.rb`):
35
+ - `Query` class - Manages query execution lifecycle
36
+ - Handles streaming results via `each_row`, `each_row_chunk`
37
+ - Provides column metadata and result transformation
38
+
39
+ 3. **Statement Client** (`lib/trino/client/statement_client.rb`):
40
+ - `StatementClient` - Low-level HTTP communication with Trino
41
+ - Manages query state machine (running, finished, failed, aborted)
42
+ - Handles retries, timeouts, and error conditions
43
+ - Supports both JSON and MessagePack response formats
44
+
45
+ 4. **HTTP Layer** (`lib/trino/client/faraday_client.rb`):
46
+ - Uses Faraday for HTTP requests with middleware for gzip and redirects
47
+ - Handles authentication, SSL configuration, proxy settings
48
+
49
+ ### Model System
50
+
51
+ - **Versioned Models** (`lib/trino/client/model_versions/`):
52
+ - Generated from Trino source code for different Trino versions
53
+ - Each version (351, 316, 303, etc.) has its own model definitions
54
+ - Default is version 351
55
+
56
+ - **Model Generation** (`modelgen/`):
57
+ - Automated model generation from Trino Java source
58
+ - Downloads Trino source and extracts model definitions
59
+
60
+ ### Key Features
61
+
62
+ - **Streaming Results**: Query results can be processed row-by-row without loading all data into memory
63
+ - **Timeout Control**: Supports both query-level and plan-level timeouts
64
+ - **Error Recovery**: Built-in retry logic for transient failures (502, 503, 504)
65
+ - **Multiple Result Formats**: Raw arrays, named hashes, or streaming iteration
66
+ - **ROW Type Support**: Can parse Trino ROW types into Ruby hashes via `transform_row`
67
+
68
+ ### Testing
69
+
70
+ Tests are organized by component:
71
+ - `spec/client_spec.rb` - Client API tests
72
+ - `spec/statement_client_spec.rb` - Low-level protocol tests
73
+ - `spec/column_value_parser_spec.rb` - Data parsing tests
74
+ - `spec/tpch_query_spec.rb` - Integration tests with TPC-H queries
data/ChangeLog.md CHANGED
@@ -1,5 +1,16 @@
1
1
  trino-client-ruby
2
2
  ====
3
+ ## 2.2.3
4
+ - Add .github/workflows/publisher.yml [[f9643b2](https://github.com/treasure-data/trino-client-ruby/commit/f9643b2)]
5
+ - Bump actions/checkout from 4 to 5 ([#141](https://github.com/treasure-data/trino-client-ruby/issues/141)) [[61372d4](https://github.com/treasure-data/trino-client-ruby/commit/61372d4)]
6
+ - Update standard requirement from ~> 1.35.0 to ~> 1.50.0 ([#139](https://github.com/treasure-data/trino-client-ruby/issues/139)) [[e4c95a6](https://github.com/treasure-data/trino-client-ruby/commit/e4c95a6)]
7
+ - misc: Add CLAUDE.md and etc ([#138](https://github.com/treasure-data/trino-client-ruby/issues/138)) [[1a0e975](https://github.com/treasure-data/trino-client-ruby/commit/1a0e975)]
8
+
9
+ ## 2.2.2
10
+ - Close StatementClient when hitting client-side timeout ([#136](https://github.com/treasure-data/trino-client-ruby/issues/136)) [[b3261b1](https://github.com/treasure-data/trino-client-ruby/commit/b3261b1)]
11
+ - Tune Ruby versions in CI / Drop ruby 2.7, 3.0 and 3.1 supports ([#135](https://github.com/treasure-data/trino-client-ruby/issues/135)) [[da87c84](https://github.com/treasure-data/trino-client-ruby/commit/da87c84)]
12
+ - Update standard requirement from ~> 1.30.1 to ~> 1.35.0 ([#132](https://github.com/treasure-data/trino-client-ruby/issues/132)) [[4f05141](https://github.com/treasure-data/trino-client-ruby/commit/4f05141)]
13
+
3
14
  ## 2.2.1
4
15
  - fix: Retry GET against 502, 503 responses ([#129](https://github.com/treasure-data/trino-client-ruby/issues/129)) [[80f342d](https://github.com/treasure-data/trino-client-ruby/commit/80f342d)]
5
16
  - Update CODEOWNERS ([#127](https://github.com/treasure-data/trino-client-ruby/issues/127)) [[bad4b34](https://github.com/treasure-data/trino-client-ruby/commit/bad4b34)]
@@ -72,7 +72,7 @@ module Trino::Client
72
72
  end
73
73
  end
74
74
 
75
- def self.new(*args)
76
- Client.new(*args)
75
+ def self.new(...)
76
+ Client.new(...)
77
77
  end
78
78
  end
@@ -233,6 +233,7 @@ module Trino::Client
233
233
  elapsed = Process.clock_gettime(Process::CLOCK_MONOTONIC) - @started_at
234
234
 
235
235
  if @query_timeout && elapsed > @query_timeout
236
+ close
236
237
  raise_timeout_error!
237
238
  end
238
239
 
@@ -240,6 +241,7 @@ module Trino::Client
240
241
  elapsed > @plan_timeout
241
242
  # @results is not set (even first faraday_get_with_retry isn't called yet) or
242
243
  # result from Trino doesn't include result schema. Query planning isn't done yet.
244
+ close
243
245
  raise_timeout_error!
244
246
  end
245
247
  end
@@ -15,6 +15,6 @@
15
15
  #
16
16
  module Trino
17
17
  module Client
18
- VERSION = "2.2.1"
18
+ VERSION = "2.2.3"
19
19
  end
20
20
  end
data/trino-client.gemspec CHANGED
@@ -15,18 +15,22 @@ Gem::Specification.new do |gem|
15
15
  gem.executables = gem.files.grep(%r{^bin/}).map { |f| File.basename(f) }
16
16
  gem.require_paths = ["lib"]
17
17
 
18
- gem.required_ruby_version = ">= 2.7.0"
18
+ gem.required_ruby_version = ">= 3.2.0"
19
19
 
20
20
  gem.add_dependency "faraday", ">= 1", "< 3"
21
21
  gem.add_dependency "faraday-gzip", ">= 1"
22
22
  gem.add_dependency "faraday-follow_redirects", ">= 0.3"
23
23
  gem.add_dependency "msgpack", [">= 1.5.1"]
24
24
 
25
+ if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("3.4")
26
+ gem.add_dependency("base64")
27
+ end
28
+
25
29
  gem.add_development_dependency "rake", [">= 0.9.2", "< 14.0"]
26
30
  gem.add_development_dependency "rspec", "~> 3.13.0"
27
31
  gem.add_development_dependency "webmock", ["~> 3.0"]
28
32
  gem.add_development_dependency "addressable", "~> 2.8.1" # 2.5.0 doesn't support Ruby 1.9.3
29
33
  gem.add_development_dependency "simplecov", "~> 0.22.0"
30
- gem.add_development_dependency "standard", "~> 1.30.1"
34
+ gem.add_development_dependency "standard", "~> 1.50.0"
31
35
  gem.add_development_dependency "psych", "~> 3"
32
36
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: trino-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.1
4
+ version: 2.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sadayuki Furuhashi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-11-11 00:00:00.000000000 Z
11
+ date: 2025-09-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -154,14 +154,14 @@ dependencies:
154
154
  requirements:
155
155
  - - "~>"
156
156
  - !ruby/object:Gem::Version
157
- version: 1.30.1
157
+ version: 1.50.0
158
158
  type: :development
159
159
  prerelease: false
160
160
  version_requirements: !ruby/object:Gem::Requirement
161
161
  requirements:
162
162
  - - "~>"
163
163
  - !ruby/object:Gem::Version
164
- version: 1.30.1
164
+ version: 1.50.0
165
165
  - !ruby/object:Gem::Dependency
166
166
  name: psych
167
167
  requirement: !ruby/object:Gem::Requirement
@@ -183,6 +183,8 @@ executables: []
183
183
  extensions: []
184
184
  extra_rdoc_files: []
185
185
  files:
186
+ - ".pre-commit-config.yaml"
187
+ - CLAUDE.md
186
188
  - ChangeLog.md
187
189
  - LICENSE
188
190
  - README.md
@@ -218,14 +220,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
218
220
  requirements:
219
221
  - - ">="
220
222
  - !ruby/object:Gem::Version
221
- version: 2.7.0
223
+ version: 3.2.0
222
224
  required_rubygems_version: !ruby/object:Gem::Requirement
223
225
  requirements:
224
226
  - - ">="
225
227
  - !ruby/object:Gem::Version
226
228
  version: '0'
227
229
  requirements: []
228
- rubygems_version: 3.3.7
230
+ rubygems_version: 3.4.19
229
231
  signing_key:
230
232
  specification_version: 4
231
233
  summary: Trino client library