chalk_ruby 0.4.0 → 0.4.1
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/chalk_ruby.gemspec +1 -1
- data/lib/chalk_ruby/client.rb +14 -4
- data/lib/chalk_ruby/grpc_client.rb +18 -0
- data/lib/chalk_ruby/version.rb +1 -1
- metadata +16 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: be8baa09bb22ab16fe18d5d82d89fa4d5ca75f2216f60daeb240ee185aecafc1
|
4
|
+
data.tar.gz: 07cfafd2ff5de2898f492697f17eba513e5cdea23df58ed8489b637c3a5b6b40
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: befc8666980d27db057207bcf38a97e8f347879ed0938a9f8a5fcd3cbb07fe06d00e458ec50b7a54c0f308ab1f8ad2c331abe5c63213acde8073e04954ae1442
|
7
|
+
data.tar.gz: b8fdb9a0157d03e68047bcc5da8ecd569441cbc60c93f9b42378c6a227a401b99b0a3eede639f5ec1bcf44891193fc619ea3ca7e5e64bc470e8cf40eeec3dc31
|
data/chalk_ruby.gemspec
CHANGED
@@ -42,11 +42,11 @@ Gem::Specification.new do |spec|
|
|
42
42
|
|
43
43
|
spec.add_dependency 'multi_json', '~> 1.0'
|
44
44
|
spec.add_dependency 'net-http-persistent'
|
45
|
-
spec.add_dependency 'red-arrow', '~> 18.0.0'
|
46
45
|
|
47
46
|
spec.add_development_dependency 'httpclient'
|
48
47
|
spec.add_development_dependency 'm'
|
49
48
|
spec.add_development_dependency 'minitest'
|
50
49
|
spec.add_development_dependency 'minitest-hooks'
|
51
50
|
spec.add_development_dependency 'minitest-proveit'
|
51
|
+
spec.add_development_dependency 'red-arrow', '~> 18.0.0'
|
52
52
|
end
|
data/lib/chalk_ruby/client.rb
CHANGED
@@ -228,7 +228,7 @@ module ChalkRuby
|
|
228
228
|
end
|
229
229
|
|
230
230
|
# Warm up connections to the API and query servers by establishing
|
231
|
-
# connections
|
231
|
+
# TCP connections with lightweight HEAD requests
|
232
232
|
def warm_connections
|
233
233
|
# Get the query server host
|
234
234
|
query_host = query_server_host
|
@@ -242,13 +242,23 @@ module ChalkRuby
|
|
242
242
|
|
243
243
|
private
|
244
244
|
|
245
|
-
# Establish a connection to a host
|
245
|
+
# Establish a connection to a host by making a lightweight request
|
246
246
|
def warm_connection(host)
|
247
247
|
# Access the underlying HTTP requester
|
248
248
|
requester = @transporter.instance_variable_get(:@http_requester)
|
249
249
|
|
250
|
-
#
|
251
|
-
requester.connection(host)
|
250
|
+
# Create the Faraday connection object
|
251
|
+
connection = requester.connection(host)
|
252
|
+
|
253
|
+
# Make a HEAD request to "/" to actually establish the TCP connection
|
254
|
+
# HEAD is used as it's lightweight and most servers support it
|
255
|
+
begin
|
256
|
+
connection.head('/')
|
257
|
+
rescue => e
|
258
|
+
# Ignore errors - we're just warming the connection
|
259
|
+
# The server might not support HEAD on /, but the TCP connection
|
260
|
+
# will still be established
|
261
|
+
end
|
252
262
|
end
|
253
263
|
|
254
264
|
def api_server_request(method:, path:, body:, headers:)
|
@@ -168,6 +168,9 @@ module ChalkRuby
|
|
168
168
|
correlation_id: nil,
|
169
169
|
planner_options: nil
|
170
170
|
)
|
171
|
+
unless red_arrow_available?
|
172
|
+
raise NotImplementedError, "query_bulk requires the 'red-arrow' gem. Please add it to your Gemfile: gem 'red-arrow', '~> 18.0.0'"
|
173
|
+
end
|
171
174
|
# Convert input to feather format
|
172
175
|
inputs_feather = to_feather(input)
|
173
176
|
|
@@ -412,10 +415,22 @@ module ChalkRuby
|
|
412
415
|
|
413
416
|
private
|
414
417
|
|
418
|
+
def red_arrow_available?
|
419
|
+
@red_arrow_available ||= begin
|
420
|
+
require 'arrow'
|
421
|
+
true
|
422
|
+
rescue LoadError
|
423
|
+
false
|
424
|
+
end
|
425
|
+
end
|
426
|
+
|
415
427
|
# Converts Arrow binary data to an array of hashes
|
416
428
|
# @param arrow_data [String] Binary Arrow data (IPC stream format)
|
417
429
|
# @return [Array<Hash>] Array of hashes with column name as keys and Ruby values
|
418
430
|
def arrow_table_to_array(arrow_data)
|
431
|
+
unless red_arrow_available?
|
432
|
+
raise NotImplementedError, "arrow_table_to_array requires the 'red-arrow' gem. Please add it to your Gemfile: gem 'red-arrow', '~> 18.0.0'"
|
433
|
+
end
|
419
434
|
require 'arrow'
|
420
435
|
|
421
436
|
buffer = Arrow::Buffer.new(arrow_data)
|
@@ -454,6 +469,9 @@ module ChalkRuby
|
|
454
469
|
end
|
455
470
|
|
456
471
|
def to_feather(input_hash)
|
472
|
+
unless red_arrow_available?
|
473
|
+
raise NotImplementedError, "to_feather requires the 'red-arrow' gem. Please add it to your Gemfile: gem 'red-arrow', '~> 18.0.0'"
|
474
|
+
end
|
457
475
|
require 'arrow'
|
458
476
|
|
459
477
|
# Ensure all values in the input hash are arrays
|
data/lib/chalk_ruby/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chalk_ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chalk AI, Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-07-
|
11
|
+
date: 2025-07-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -140,20 +140,6 @@ dependencies:
|
|
140
140
|
- - ">="
|
141
141
|
- !ruby/object:Gem::Version
|
142
142
|
version: '0'
|
143
|
-
- !ruby/object:Gem::Dependency
|
144
|
-
name: red-arrow
|
145
|
-
requirement: !ruby/object:Gem::Requirement
|
146
|
-
requirements:
|
147
|
-
- - "~>"
|
148
|
-
- !ruby/object:Gem::Version
|
149
|
-
version: 18.0.0
|
150
|
-
type: :runtime
|
151
|
-
prerelease: false
|
152
|
-
version_requirements: !ruby/object:Gem::Requirement
|
153
|
-
requirements:
|
154
|
-
- - "~>"
|
155
|
-
- !ruby/object:Gem::Version
|
156
|
-
version: 18.0.0
|
157
143
|
- !ruby/object:Gem::Dependency
|
158
144
|
name: httpclient
|
159
145
|
requirement: !ruby/object:Gem::Requirement
|
@@ -224,6 +210,20 @@ dependencies:
|
|
224
210
|
- - ">="
|
225
211
|
- !ruby/object:Gem::Version
|
226
212
|
version: '0'
|
213
|
+
- !ruby/object:Gem::Dependency
|
214
|
+
name: red-arrow
|
215
|
+
requirement: !ruby/object:Gem::Requirement
|
216
|
+
requirements:
|
217
|
+
- - "~>"
|
218
|
+
- !ruby/object:Gem::Version
|
219
|
+
version: 18.0.0
|
220
|
+
type: :development
|
221
|
+
prerelease: false
|
222
|
+
version_requirements: !ruby/object:Gem::Requirement
|
223
|
+
requirements:
|
224
|
+
- - "~>"
|
225
|
+
- !ruby/object:Gem::Version
|
226
|
+
version: 18.0.0
|
227
227
|
description: A simple Ruby client for Chalk
|
228
228
|
email:
|
229
229
|
- help@chalk.ai
|