red-arrow-flight 16.1.0 → 18.0.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: 9afcc53db63194b4d083cfb495de23387ca1147706196d4bed8b1bad5fa58e74
4
- data.tar.gz: ec0dc4f922cef09878c71f546771fba26d9e74fdb87ae7a80d590004879b9a49
3
+ metadata.gz: 658c5a7dad91b476c435276383713b91730dd3192e033532eaea8e88b4554349
4
+ data.tar.gz: ff25e6c1927a7d56b0c547933da0e9201998e56ac7df04b292385311acddebed
5
5
  SHA512:
6
- metadata.gz: 158620d95f5ebb76fab3604de3eabcada6b025e6ae9fa2e13aac4fd53dfd570065a32b1bd2714aa7059a15c8f8d81189eb7e7a7ce2e9b38cd755842cb0c0d4e4
7
- data.tar.gz: dba5936e3d99b8a148ceea71442c363ae38c841403366f6ed48feb5237fd06a51e3176deb14507c655943576c81c652fad7c9081799db3d22a1cb7edb51e266d
6
+ metadata.gz: 87247bf8ddcb3ca84f38b0e269a5d04989683439b1638a33c8b9e77d89547d22c621bd716037edeaa4ca4afc07fe8b1c2f22ee25d177a0108e8503dcf7f8048e
7
+ data.tar.gz: e911e98bf8b68eaa3d6ef809a1b77ebb20f9658805ccdab4446d27d2acca03bb2bb31301fc2d158ac7e1b09128ebabffe55062abb906b0a5f6a06121540e1397
@@ -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 = "16.1.0"
19
+ VERSION = "18.0.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: 16.1.0
4
+ version: 18.0.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-05-27 00:00:00.000000000 Z
11
+ date: 2024-10-31 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: 16.1.0
19
+ version: 18.0.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: 16.1.0
26
+ version: 18.0.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.4.20
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: