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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0c6ba19a04e0d2c5ce8e9c6487c9b7643a31cc0c446a7f911d8abbadfbebab42
4
- data.tar.gz: a9d8e3118e8d32df67314d3c40db3750637dff7533e48c711814293e9e5af97a
3
+ metadata.gz: 22f7a942d6a30d57ffa672a887f43146efa76b933c445c1258396fb4eec5a02a
4
+ data.tar.gz: fff8010cdf6d698d8e792e606138cb2880ce9b451372a25832ed61d05e2b3bbc
5
5
  SHA512:
6
- metadata.gz: 2d1d2030396997310d1f805cc9497caf9167e7aa8ec77f943b0ab195c1079dd6bcfd222767017f61c7892ffab4b57c8a14ca4e08517bff099124798aba453458
7
- data.tar.gz: 6da65143c0c0c0d8ee93debf8e7ed42ade4a3ed3055a03dab39461b50c8e45fe07ad6418b5303390af87fd992a0a9758bc8d0cfc9d14632d70235be3d1800548
6
+ metadata.gz: d75c578fbecbe923dbfbd1e74a929d3e68a3efe86a68278689b6322244c6e311678608188bf1f6c70dee0b3f00d982cf8feec37c0fcf278dc7f66b563cfccb6d
7
+ data.tar.gz: 555bf926bc7fcdb761f6cb13f570f36d1af9c9578a7173131c1fc4411ec622d9fc2dd772dfd42fe0ae254307da1aa65bcee4e1f3c62f81485c8f407bcc123d5a
@@ -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
@@ -16,7 +16,7 @@
16
16
  # under the License.
17
17
 
18
18
  module ArrowFlight
19
- VERSION = "17.0.0"
19
+ VERSION = "18.1.0"
20
20
 
21
21
  module Version
22
22
  numbers, TAG = VERSION.split("-")
@@ -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: 17.0.0
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-07-19 00:00:00.000000000 Z
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: 17.0.0
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: 17.0.0
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.3.5
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: