red-arrow-flight 17.0.0 → 18.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/arrow-flight/client.rb +44 -0
- data/lib/arrow-flight/version.rb +1 -1
- data/test/helper/server.rb +11 -0
- data/test/test-client.rb +31 -0
- metadata +8 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 22f7a942d6a30d57ffa672a887f43146efa76b933c445c1258396fb4eec5a02a
|
4
|
+
data.tar.gz: fff8010cdf6d698d8e792e606138cb2880ce9b451372a25832ed61d05e2b3bbc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d75c578fbecbe923dbfbd1e74a929d3e68a3efe86a68278689b6322244c6e311678608188bf1f6c70dee0b3f00d982cf8feec37c0fcf278dc7f66b563cfccb6d
|
7
|
+
data.tar.gz: 555bf926bc7fcdb761f6cb13f570f36d1af9c9578a7173131c1fc4411ec622d9fc2dd772dfd42fe0ae254307da1aa65bcee4e1f3c62f81485c8f407bcc123d5a
|
data/lib/arrow-flight/client.rb
CHANGED
@@ -47,5 +47,49 @@ module ArrowFlight
|
|
47
47
|
end
|
48
48
|
options
|
49
49
|
end
|
50
|
+
|
51
|
+
alias_method :do_put_raw, :do_put
|
52
|
+
# Upload data to a Flight described by the given descriptor. The
|
53
|
+
# caller must call `#close` on the returned stream once they are
|
54
|
+
# done writing. Note that it's automatically done when you use
|
55
|
+
# block.
|
56
|
+
#
|
57
|
+
# The reader and writer are linked; closing the writer will also
|
58
|
+
# close the reader. Use GArrowFlight::StreamWriter#done_writing to
|
59
|
+
# only close the write side of the channel.
|
60
|
+
#
|
61
|
+
# @param descriptor [GArrowFlight::Descriptor] Descriptor to be uploaded.
|
62
|
+
# @param schema [GArrow::Schema] Schema of uploaded data.
|
63
|
+
# @param options [ArrowFlight::CallOptions, Hash, nil] (nil)
|
64
|
+
# The options to be used.
|
65
|
+
#
|
66
|
+
# @yieldparam writer [GArrowFlight::StreamWriter] The writer to upload
|
67
|
+
# data to the given descriptor.
|
68
|
+
#
|
69
|
+
# This is closed automatically after the given block is finished.
|
70
|
+
#
|
71
|
+
# @yieldparam reader [GArrowFlight::MetadataReader] The reader to read
|
72
|
+
# metadata from the server.
|
73
|
+
#
|
74
|
+
# @return [Array<GArrowFlight::MetadataReader, GArrowFlight::StreamWriter>, Object]
|
75
|
+
# The reader and the writer if block isn't given.
|
76
|
+
#
|
77
|
+
# The return value from block if block is given.
|
78
|
+
#
|
79
|
+
# @since 18.0.0
|
80
|
+
def do_put(descriptor, schema, options=nil)
|
81
|
+
result = do_put_raw(descriptor, schema, options)
|
82
|
+
reader = result.reader
|
83
|
+
writer = result.writer
|
84
|
+
if block_given?
|
85
|
+
begin
|
86
|
+
yield(reader, writer)
|
87
|
+
ensure
|
88
|
+
writer.close unless writer.closed?
|
89
|
+
end
|
90
|
+
else
|
91
|
+
return reader, writer
|
92
|
+
end
|
93
|
+
end
|
50
94
|
end
|
51
95
|
end
|
data/lib/arrow-flight/version.rb
CHANGED
data/test/helper/server.rb
CHANGED
@@ -21,6 +21,8 @@ module Helper
|
|
21
21
|
class Server < ArrowFlight::Server
|
22
22
|
type_register
|
23
23
|
|
24
|
+
attr_reader :uploaded_table
|
25
|
+
|
24
26
|
private
|
25
27
|
def virtual_do_list_flights(context, criteria)
|
26
28
|
generator = InfoGenerator.new
|
@@ -35,5 +37,14 @@ module Helper
|
|
35
37
|
table = generator.page_view_table
|
36
38
|
ArrowFlight::RecordBatchStream.new(table)
|
37
39
|
end
|
40
|
+
|
41
|
+
def virtual_do_do_put(context, reader, writer)
|
42
|
+
@uploaded_table = reader.read_all
|
43
|
+
writer.write(Arrow::Buffer.new("done"))
|
44
|
+
if @uploaded_table.n_rows.zero?
|
45
|
+
raise Arrow::Error::Invalid.new("empty table")
|
46
|
+
end
|
47
|
+
true
|
48
|
+
end
|
38
49
|
end
|
39
50
|
end
|
data/test/test-client.rb
CHANGED
@@ -43,4 +43,35 @@ class TestClient < Test::Unit::TestCase
|
|
43
43
|
assert_equal(generator.page_view_table,
|
44
44
|
reader.read_all)
|
45
45
|
end
|
46
|
+
|
47
|
+
def test_do_put_with_block
|
48
|
+
client = ArrowFlight::Client.new(@location)
|
49
|
+
generator = Helper::InfoGenerator.new
|
50
|
+
descriptor = generator.page_view_descriptor
|
51
|
+
table = generator.page_view_table
|
52
|
+
client.do_put(descriptor, table.schema) do |reader, writer|
|
53
|
+
writer.write_table(table)
|
54
|
+
writer.done_writing
|
55
|
+
metadata = reader.read
|
56
|
+
assert_equal(["done", table],
|
57
|
+
[metadata.data.to_s, @server.uploaded_table])
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
def test_do_put_without_block
|
62
|
+
client = ArrowFlight::Client.new(@location)
|
63
|
+
generator = Helper::InfoGenerator.new
|
64
|
+
descriptor = generator.page_view_descriptor
|
65
|
+
table = generator.page_view_table
|
66
|
+
reader, writer = client.do_put(descriptor, table.schema)
|
67
|
+
begin
|
68
|
+
writer.write_table(table)
|
69
|
+
writer.done_writing
|
70
|
+
metadata = reader.read
|
71
|
+
assert_equal(["done", table],
|
72
|
+
[metadata.data.to_s, @server.uploaded_table])
|
73
|
+
ensure
|
74
|
+
writer.close
|
75
|
+
end
|
76
|
+
end
|
46
77
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: red-arrow-flight
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 18.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Apache Arrow Developers
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-11-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: red-arrow
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 18.1.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - '='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 18.1.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: bundler
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -106,7 +106,7 @@ homepage: https://arrow.apache.org/
|
|
106
106
|
licenses:
|
107
107
|
- Apache-2.0
|
108
108
|
metadata: {}
|
109
|
-
post_install_message:
|
109
|
+
post_install_message:
|
110
110
|
rdoc_options: []
|
111
111
|
require_paths:
|
112
112
|
- lib
|
@@ -121,8 +121,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
121
121
|
- !ruby/object:Gem::Version
|
122
122
|
version: '0'
|
123
123
|
requirements: []
|
124
|
-
rubygems_version: 3.
|
125
|
-
signing_key:
|
124
|
+
rubygems_version: 3.5.23
|
125
|
+
signing_key:
|
126
126
|
specification_version: 4
|
127
127
|
summary: Red Arrow Flight is the Ruby bindings of Apache Arrow Flight
|
128
128
|
test_files:
|