red-arrow 6.0.1 → 7.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: 853f00543077ecc6ecbc5dcca0f535eda624ece16e2f74bb5ec966f435d60137
4
- data.tar.gz: 8e6ea3a343fb7977729a004f61789c5f579b0d2a3c0823faedc4c10425eaec56
3
+ metadata.gz: cee7217ce22a2c2d7a20bbe073ffe41efbab3d9628cfdc0e19e077acb4965557
4
+ data.tar.gz: da14c7fd57bf63294fbe46f74bb286b0d6e26dafaa80b977d11639c275dbd677
5
5
  SHA512:
6
- metadata.gz: cb6de71e011620648821b4b13081386f5ad5a7e77ca7be26554c956a2f1d97ac488ad7f14bf289656fa15504600243fd4e3ba16068d355d6e1559a02a8e1c56f
7
- data.tar.gz: 5e1ec7c8e1d306d5c72c282447a23c0b58674ee64f74c6d230834ba495265560a22953e489009bcecff9baa8c49816e5c8e431a1c1c5557cd2bac39a3696df02
6
+ metadata.gz: 52e22fdcc86f32f0443a6335099ce510840dfae9134bb4ffe6d51bfcbfdc2d66f87bbe29cd46a7af670077add2d12786474eaa3a716a27dc161fcd69b7c40974
7
+ data.tar.gz: 23b84e6766953cc89e8502043065dfdcf0c6a83ef1f29feae2a85e6ec3f7e01f0800f975eeb38076b255688a818984b9ae5eca2da483b96e42c5dd132089355a
data/Gemfile CHANGED
@@ -20,3 +20,13 @@
20
20
  source "https://rubygems.org/"
21
21
 
22
22
  gemspec
23
+
24
+ gem "benchmark-driver"
25
+ gem "bundler"
26
+ gem "faker"
27
+ gem "fiddle", ">= 1.0.9"
28
+ gem "rake"
29
+ gem "redcarpet"
30
+ gem "test-unit"
31
+ gem "webrick"
32
+ gem "yard"
data/ext/arrow/extconf.rb CHANGED
@@ -28,7 +28,7 @@ end
28
28
  checking_for(checking_message("Homebrew")) do
29
29
  platform = NativePackageInstaller::Platform.detect
30
30
  if platform.is_a?(NativePackageInstaller::Platform::Homebrew)
31
- openssl_prefix = `brew --prefix openssl@1.1`.chomp
31
+ openssl_prefix = `brew --prefix openssl`.chomp
32
32
  unless openssl_prefix.empty?
33
33
  PKGConfig.add_path("#{openssl_prefix}/lib/pkgconfig")
34
34
  end
data/lib/arrow/datum.rb CHANGED
@@ -27,6 +27,8 @@ module Arrow
27
27
  ArrayDatum.new(value)
28
28
  when ChunkedArray
29
29
  ChunkedArrayDatum.new(value)
30
+ when Column
31
+ ChunkedArrayDatum.new(value.data)
30
32
  when Scalar
31
33
  ScalarDatum.new(value)
32
34
  when ::Array
@@ -0,0 +1,52 @@
1
+ # Licensed to the Apache Software Foundation (ASF) under one
2
+ # or more contributor license agreements. See the NOTICE file
3
+ # distributed with this work for additional information
4
+ # regarding copyright ownership. The ASF licenses this file
5
+ # to you under the Apache License, Version 2.0 (the
6
+ # "License"); you may not use this file except in compliance
7
+ # with the License. You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing,
12
+ # software distributed under the License is distributed on an
13
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ # KIND, either express or implied. See the License for the
15
+ # specific language governing permissions and limitations
16
+ # under the License.
17
+
18
+ module Arrow
19
+ class Function
20
+ alias_method :execute_raw, :execute
21
+ def execute(args, options=nil, context=nil)
22
+ options = resolve_options(options)
23
+ execute_raw(args, options, context)
24
+ end
25
+ alias_method :call, :execute
26
+
27
+ private
28
+ def resolve_options(options)
29
+ return nil if options.nil?
30
+ return options if options.is_a?(FunctionOptions)
31
+
32
+ arrow_options_class = options_type&.to_class
33
+ if arrow_options_class
34
+ if arrow_options_class.respond_to?(:try_convert)
35
+ arrow_options = arrow_options_class.try_convert(options)
36
+ return arrow_options if arrow_options
37
+ end
38
+ arrow_options = (default_options || arrow_options_class.new)
39
+ else
40
+ arrow_options = default_options
41
+ end
42
+ return arrow_options if arrow_options.nil?
43
+
44
+ options.each do |key, value|
45
+ setter = :"#{key}="
46
+ next unless arrow_options.respond_to?(setter)
47
+ arrow_options.__send__(setter, value)
48
+ end
49
+ arrow_options
50
+ end
51
+ end
52
+ end
data/lib/arrow/loader.rb CHANGED
@@ -30,6 +30,7 @@ module Arrow
30
30
  require_libraries
31
31
  require_extension_library
32
32
  gc_guard
33
+ self.class.start_callback_dispatch_thread
33
34
  end
34
35
 
35
36
  def require_libraries
@@ -76,6 +77,7 @@ module Arrow
76
77
  require "arrow/file-system"
77
78
  require "arrow/fixed-size-binary-array"
78
79
  require "arrow/fixed-size-binary-array-builder"
80
+ require "arrow/function"
79
81
  require "arrow/group"
80
82
  require "arrow/list-array-builder"
81
83
  require "arrow/list-data-type"
@@ -93,6 +95,7 @@ module Arrow
93
95
  require "arrow/record-batch-reader"
94
96
  require "arrow/record-batch-stream-reader"
95
97
  require "arrow/rolling-window"
98
+ require "arrow/s3-global-options"
96
99
  require "arrow/scalar"
97
100
  require "arrow/schema"
98
101
  require "arrow/slicer"
@@ -212,5 +215,16 @@ module Arrow
212
215
  super
213
216
  end
214
217
  end
218
+
219
+ def prepare_function_info_lock_gvl(function_info, klass)
220
+ super
221
+ case klass.name
222
+ when "Arrow::RecordBatchFileReader"
223
+ case function_info.name
224
+ when "new"
225
+ function_info.lock_gvl_default = false
226
+ end
227
+ end
228
+ end
215
229
  end
216
230
  end
@@ -0,0 +1,38 @@
1
+ # Licensed to the Apache Software Foundation (ASF) under one
2
+ # or more contributor license agreements. See the NOTICE file
3
+ # distributed with this work for additional information
4
+ # regarding copyright ownership. The ASF licenses this file
5
+ # to you under the Apache License, Version 2.0 (the
6
+ # "License"); you may not use this file except in compliance
7
+ # with the License. You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing,
12
+ # software distributed under the License is distributed on an
13
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ # KIND, either express or implied. See the License for the
15
+ # specific language governing permissions and limitations
16
+ # under the License.
17
+
18
+ module Arrow
19
+ class S3GlobalOptions
20
+ class << self
21
+ # @api private
22
+ def try_convert(value)
23
+ case value
24
+ when Hash
25
+ options = new
26
+ value.each do |k, v|
27
+ setter = :"#{k}="
28
+ return unless options.respond_to?(setter)
29
+ options.__send__(setter, v)
30
+ end
31
+ options
32
+ else
33
+ nil
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
@@ -29,25 +29,26 @@ module Arrow
29
29
  #
30
30
  # @return [Arrow::SortKey] The given sort key itself.
31
31
  #
32
- # @overload resolve(name)
32
+ # @overload resolve(target)
33
33
  #
34
- # Creates a new suitable sort key from column name with
35
- # leading order mark. See {#initialize} for details about
34
+ # Creates a new suitable sort key from column name or dot path
35
+ # with leading order mark. See {#initialize} for details about
36
36
  # order mark.
37
37
  #
38
38
  # @return [Arrow::SortKey] A new suitable sort key.
39
39
  #
40
- # @overload resolve(name, order)
40
+ # @overload resolve(target, order)
41
41
  #
42
- # Creates a new suitable sort key from column name without
43
- # leading order mark and order. See {#initialize} for details.
42
+ # Creates a new suitable sort key from column name or dot path
43
+ # without leading order mark and order. See {#initialize} for
44
+ # details.
44
45
  #
45
46
  # @return [Arrow::SortKey] A new suitable sort key.
46
47
  #
47
48
  # @since 4.0.0
48
- def resolve(name, order=nil)
49
- return name if name.is_a?(self)
50
- new(name, order)
49
+ def resolve(target, order=nil)
50
+ return target if target.is_a?(self)
51
+ new(target, order)
51
52
  end
52
53
 
53
54
  # @api private
@@ -65,47 +66,49 @@ module Arrow
65
66
  private :initialize_raw
66
67
  # Creates a new {Arrow::SortKey}.
67
68
  #
68
- # @overload initialize(name)
69
+ # @overload initialize(target)
69
70
  #
70
- # @param name [Symbol, String] The name of the sort column.
71
+ # @param target [Symbol, String] The name or dot path of the
72
+ # sort column.
71
73
  #
72
- # If `name` is a String, the first character may be processed
73
- # as the "leading order mark". If the first character is `"+"`
74
- # or `"-"`, they are processed as a leading order mark. If the
75
- # first character is processed as a leading order mark, the
76
- # first character is removed from sort column name and
77
- # corresponding order is used. `"+"` uses ascending order and
78
- # `"-"` uses ascending order.
74
+ # If `target` is a String, the first character may be
75
+ # processed as the "leading order mark". If the first
76
+ # character is `"+"` or `"-"`, they are processed as a leading
77
+ # order mark. If the first character is processed as a leading
78
+ # order mark, the first character is removed from sort column
79
+ # target and corresponding order is used. `"+"` uses ascending
80
+ # order and `"-"` uses ascending order.
79
81
  #
80
- # If `name` is not a String nor `name` doesn't start with the
81
- # leading order mark, sort column name is `name` as-is and
82
+ # If `target` is not a String nor `target` doesn't start with the
83
+ # leading order mark, sort column target is `target` as-is and
82
84
  # ascending order is used.
83
85
  #
84
86
  # @example String without the leading order mark
85
87
  # key = Arrow::SortKey.new("count")
86
- # key.name # => "count"
87
- # key.order # => Arrow::SortOrder::ASCENDING
88
+ # key.target # => "count"
89
+ # key.order # => Arrow::SortOrder::ASCENDING
88
90
  #
89
91
  # @example String with the "+" leading order mark
90
92
  # key = Arrow::SortKey.new("+count")
91
- # key.name # => "count"
92
- # key.order # => Arrow::SortOrder::ASCENDING
93
+ # key.target # => "count"
94
+ # key.order # => Arrow::SortOrder::ASCENDING
93
95
  #
94
96
  # @example String with the "-" leading order mark
95
97
  # key = Arrow::SortKey.new("-count")
96
- # key.name # => "count"
97
- # key.order # => Arrow::SortOrder::DESCENDING
98
+ # key.target # => "count"
99
+ # key.order # => Arrow::SortOrder::DESCENDING
98
100
  #
99
101
  # @example Symbol that starts with "-"
100
102
  # key = Arrow::SortKey.new(:"-count")
101
- # key.name # => "-count"
102
- # key.order # => Arrow::SortOrder::ASCENDING
103
+ # key.target # => "-count"
104
+ # key.order # => Arrow::SortOrder::ASCENDING
103
105
  #
104
- # @overload initialize(name, order)
106
+ # @overload initialize(target, order)
105
107
  #
106
- # @param name [Symbol, String] The name of the sort column.
108
+ # @param target [Symbol, String] The name or dot path of the
109
+ # sort column.
107
110
  #
108
- # No leading order mark processing. The given `name` is used
111
+ # No leading order mark processing. The given `target` is used
109
112
  # as-is.
110
113
  #
111
114
  # @param order [Symbol, String, Arrow::SortOrder] How to order
@@ -117,29 +120,29 @@ module Arrow
117
120
  #
118
121
  # @example No leading order mark processing
119
122
  # key = Arrow::SortKey.new("-count", :ascending)
120
- # key.name # => "-count"
121
- # key.order # => Arrow::SortOrder::ASCENDING
123
+ # key.target # => "-count"
124
+ # key.order # => Arrow::SortOrder::ASCENDING
122
125
  #
123
- # @example Order by abbreviated name with Symbol
126
+ # @example Order by abbreviated target with Symbol
124
127
  # key = Arrow::SortKey.new("count", :desc)
125
- # key.name # => "count"
126
- # key.order # => Arrow::SortOrder::DESCENDING
128
+ # key.target # => "count"
129
+ # key.order # => Arrow::SortOrder::DESCENDING
127
130
  #
128
131
  # @example Order by String
129
132
  # key = Arrow::SortKey.new("count", "descending")
130
- # key.name # => "count"
131
- # key.order # => Arrow::SortOrder::DESCENDING
133
+ # key.target # => "count"
134
+ # key.order # => Arrow::SortOrder::DESCENDING
132
135
  #
133
136
  # @example Order by Arrow::SortOrder
134
137
  # key = Arrow::SortKey.new("count", Arrow::SortOrder::DESCENDING)
135
- # key.name # => "count"
136
- # key.order # => Arrow::SortOrder::DESCENDING
138
+ # key.target # => "count"
139
+ # key.order # => Arrow::SortOrder::DESCENDING
137
140
  #
138
141
  # @since 4.0.0
139
- def initialize(name, order=nil)
140
- name, order = normalize_name(name, order)
142
+ def initialize(target, order=nil)
143
+ target, order = normalize_target(target, order)
141
144
  order = normalize_order(order) || :ascending
142
- initialize_raw(name, order)
145
+ initialize_raw(target, order)
143
146
  end
144
147
 
145
148
  # @return [String] The string representation of this sort key. You
@@ -154,28 +157,31 @@ module Arrow
154
157
  # @since 4.0.0
155
158
  def to_s
156
159
  if order == SortOrder::ASCENDING
157
- "+#{name}"
160
+ "+#{target}"
158
161
  else
159
- "-#{name}"
162
+ "-#{target}"
160
163
  end
161
164
  end
162
165
 
166
+ # For backward compatibility
167
+ alias_method :name, :target
168
+
163
169
  private
164
- def normalize_name(name, order)
165
- case name
170
+ def normalize_target(target, order)
171
+ case target
166
172
  when Symbol
167
- return name.to_s, order
173
+ return target.to_s, order
168
174
  when String
169
- return name, order if order
170
- if name.start_with?("-")
171
- return name[1..-1], order || :descending
172
- elsif name.start_with?("+")
173
- return name[1..-1], order || :ascending
175
+ return target, order if order
176
+ if target.start_with?("-")
177
+ return target[1..-1], order || :descending
178
+ elsif target.start_with?("+")
179
+ return target[1..-1], order || :ascending
174
180
  else
175
- return name, order
181
+ return target, order
176
182
  end
177
183
  else
178
- return name, order
184
+ return target, order
179
185
  end
180
186
  end
181
187
 
@@ -78,20 +78,20 @@ module Arrow
78
78
  # options.add_sort_key(Arrow::SortKey.new(:price, :descending))
79
79
  # options.sort_keys.collect(&:to_s) # => ["-price"]
80
80
  #
81
- # @overload add_sort_key(name)
81
+ # @overload add_sort_key(target)
82
82
  #
83
- # @param name [Symbol, String] The sort key name to be
84
- # added. See also {Arrow::SortKey#initialize} for the leading
85
- # order mark for String name.
83
+ # @param target [Symbol, String] The sort key name or dot path
84
+ # to be added. See also {Arrow::SortKey#initialize} for the
85
+ # leading order mark for `String` target.
86
86
  #
87
87
  # @example Add a key to sort by "price" column in descending order
88
88
  # options = Arrow::SortOptions.new
89
89
  # options.add_sort_key("-price")
90
90
  # options.sort_keys.collect(&:to_s) # => ["-price"]
91
91
  #
92
- # @overload add_sort_key(name, order)
92
+ # @overload add_sort_key(target, order)
93
93
  #
94
- # @param name [Symbol, String] The sort key name.
94
+ # @param target [Symbol, String] The sort key name or dot path.
95
95
  #
96
96
  # @param order [Symbol, String, Arrow::SortOrder] The sort
97
97
  # order. See {Arrow::SortKey#initialize} for details.
@@ -102,8 +102,8 @@ module Arrow
102
102
  # options.sort_keys.collect(&:to_s) # => ["-price"]
103
103
  #
104
104
  # @since 4.0.0
105
- def add_sort_key(name, order=nil)
106
- add_sort_key_raw(SortKey.resolve(name, order))
105
+ def add_sort_key(target, order=nil)
106
+ add_sort_key_raw(SortKey.resolve(target, order))
107
107
  end
108
108
  end
109
109
  end
@@ -15,7 +15,7 @@
15
15
  # specific language governing permissions and limitations
16
16
  # under the License.
17
17
 
18
- require "uri"
18
+ require "open-uri"
19
19
 
20
20
  module Arrow
21
21
  class TableLoader
@@ -34,30 +34,47 @@ module Arrow
34
34
 
35
35
  def load
36
36
  if @input.is_a?(URI)
37
- custom_load_method = "load_from_uri"
37
+ custom_load_method_candidates = []
38
+ if @input.scheme
39
+ custom_load_method_candidates << "load_from_uri_#{@input.scheme}"
40
+ end
41
+ custom_load_method_candidates << "load_from_uri"
38
42
  elsif @input.is_a?(String) and ::File.directory?(@input)
39
- custom_load_method = "load_from_directory"
43
+ custom_load_method_candidates = ["load_from_directory"]
40
44
  else
41
- custom_load_method = "load_from_file"
45
+ custom_load_method_candidates = ["load_from_file"]
42
46
  end
43
- unless respond_to?(custom_load_method, true)
44
- available_schemes = []
45
- (methods(true) | private_methods(true)).each do |name|
46
- match_data = /\Aload_from_/.match(name.to_s)
47
- if match_data
48
- available_schemes << match_data.post_match
49
- end
47
+ custom_load_method_candidates.each do |custom_load_method|
48
+ next unless respond_to?(custom_load_method, true)
49
+ return __send__(custom_load_method)
50
+ end
51
+ available_schemes = []
52
+ (methods(true) | private_methods(true)).each do |name|
53
+ match_data = /\Aload_from_/.match(name.to_s)
54
+ if match_data
55
+ available_schemes << match_data.post_match
50
56
  end
51
- message = "Arrow::Table load source must be one of ["
52
- message << available_schemes.join(", ")
53
- message << "]: #{@input.inspect}"
54
- raise ArgumentError, message
55
57
  end
56
- __send__(custom_load_method)
58
+ message = "Arrow::Table load source must be one of ["
59
+ message << available_schemes.join(", ")
60
+ message << "]: #{@input.inspect}"
61
+ raise ArgumentError, message
57
62
  end
58
63
 
59
64
  private
65
+ def load_from_uri_http
66
+ load_by_reader
67
+ end
68
+
69
+ def load_from_uri_https
70
+ load_by_reader
71
+ end
72
+
60
73
  def load_from_file
74
+ load_by_reader
75
+ end
76
+
77
+ def load_by_reader
61
78
  format = @options[:format]
62
79
  custom_load_method = "load_as_#{format}"
63
80
  unless respond_to?(custom_load_method, true)
@@ -111,10 +128,29 @@ module Arrow
111
128
  end
112
129
 
113
130
  def open_input_stream
114
- if @input.is_a?(Buffer)
115
- BufferInputStream.new(@input)
131
+ case @input
132
+ when Buffer
133
+ yield(BufferInputStream.new(@input))
134
+ when URI
135
+ @input.open do |ruby_input|
136
+ case @options[:format]
137
+ when :stream, :arrow_streaming
138
+ Gio::RubyInputStream.open(ruby_input) do |gio_input|
139
+ GIOInputStream.open(gio_input) do |input|
140
+ yield(input)
141
+ end
142
+ end
143
+ else
144
+ # TODO: We need to consider Ruby's GVL carefully to use
145
+ # Ruby object directly for input with other formats. We
146
+ # read data and use it as Buffer for now.
147
+ data = GLib::Bytes.new(ruby_input.read.freeze)
148
+ buffer = Buffer.new(data)
149
+ yield(BufferInputStream.new(buffer))
150
+ end
151
+ end
116
152
  else
117
- MemoryMappedInputStream.new(@input)
153
+ yield(MemoryMappedInputStream.new(@input))
118
154
  end
119
155
  end
120
156
 
@@ -130,32 +166,19 @@ module Arrow
130
166
  end
131
167
 
132
168
  def load_as_arrow
133
- input = nil
134
- reader = nil
135
- error = nil
136
- reader_class_candidates = [
137
- RecordBatchFileReader,
138
- RecordBatchStreamReader,
139
- ]
140
- reader_class_candidates.each do |reader_class_candidate|
141
- input = open_input_stream
142
- begin
143
- reader = reader_class_candidate.new(input)
144
- rescue Arrow::Error
145
- error = $!
146
- else
147
- break
148
- end
169
+ begin
170
+ load_as_arrow_file
171
+ rescue
172
+ load_as_arrows
149
173
  end
150
- raise error if reader.nil?
151
- load_raw(input, reader)
152
174
  end
153
175
 
154
176
  # @since 1.0.0
155
177
  def load_as_arrow_file
156
- input = open_input_stream
157
- reader = RecordBatchFileReader.new(input)
158
- load_raw(input, reader)
178
+ open_input_stream do |input|
179
+ reader = RecordBatchFileReader.new(input)
180
+ load_raw(input, reader)
181
+ end
159
182
  end
160
183
 
161
184
  # @deprecated Use `format: :arrow_file` instead.
@@ -163,34 +186,46 @@ module Arrow
163
186
  load_as_arrow_file
164
187
  end
165
188
 
189
+ # @since 7.0.0
190
+ def load_as_arrows
191
+ open_input_stream do |input|
192
+ reader = RecordBatchStreamReader.new(input)
193
+ load_raw(input, reader)
194
+ end
195
+ end
196
+
166
197
  # @since 1.0.0
167
198
  def load_as_arrow_streaming
168
- input = open_input_stream
169
- reader = RecordBatchStreamReader.new(input)
170
- load_raw(input, reader)
199
+ load_as_arrows
171
200
  end
172
201
 
173
202
  # @deprecated Use `format: :arrow_streaming` instead.
174
203
  def load_as_stream
175
- load_as_arrow_streaming
204
+ load_as_arrows
176
205
  end
177
206
 
178
207
  if Arrow.const_defined?(:ORCFileReader)
179
208
  def load_as_orc
180
- input = open_input_stream
181
- reader = ORCFileReader.new(input)
182
- field_indexes = @options[:field_indexes]
183
- reader.set_field_indexes(field_indexes) if field_indexes
184
- table = reader.read_stripes
185
- table.instance_variable_set(:@input, input)
186
- table
209
+ open_input_stream do |input|
210
+ reader = ORCFileReader.new(input)
211
+ field_indexes = @options[:field_indexes]
212
+ reader.set_field_indexes(field_indexes) if field_indexes
213
+ table = reader.read_stripes
214
+ table.instance_variable_set(:@input, input)
215
+ table
216
+ end
187
217
  end
188
218
  end
189
219
 
190
220
  def csv_load(options)
191
221
  options.delete(:format)
192
- if @input.is_a?(Buffer)
222
+ case @input
223
+ when Buffer
193
224
  CSVLoader.load(@input.data.to_s, **options)
225
+ when URI
226
+ @input.open do |input|
227
+ CSVLoader.load(input.read, **options)
228
+ end
194
229
  else
195
230
  CSVLoader.load(Pathname.new(@input), **options)
196
231
  end
@@ -207,19 +242,21 @@ module Arrow
207
242
  end
208
243
 
209
244
  def load_as_feather
210
- input = open_input_stream
211
- reader = FeatherFileReader.new(input)
212
- table = reader.read
213
- table.instance_variable_set(:@input, input)
214
- table
245
+ open_input_stream do |input|
246
+ reader = FeatherFileReader.new(input)
247
+ table = reader.read
248
+ table.instance_variable_set(:@input, input)
249
+ table
250
+ end
215
251
  end
216
252
 
217
253
  def load_as_json
218
- input = open_input_stream
219
- reader = JSONReader.new(input)
220
- table = reader.read
221
- table.instance_variable_set(:@input, input)
222
- table
254
+ open_input_stream do |input|
255
+ reader = JSONReader.new(input)
256
+ table = reader.read
257
+ table.instance_variable_set(:@input, input)
258
+ table
259
+ end
223
260
  end
224
261
  end
225
262
  end
@@ -151,14 +151,19 @@ module Arrow
151
151
  save_as_arrow_file
152
152
  end
153
153
 
154
+ # @since 7.0.0
155
+ def save_as_arrows
156
+ save_raw(RecordBatchStreamWriter)
157
+ end
158
+
154
159
  # @since 1.0.0
155
160
  def save_as_arrow_streaming
156
- save_raw(RecordBatchStreamWriter)
161
+ save_as_arrows
157
162
  end
158
163
 
159
164
  # @deprecated Use `format: :arrow_streaming` instead.
160
165
  def save_as_stream
161
- save_as_arrow_streaming
166
+ save_as_arrows
162
167
  end
163
168
 
164
169
  def csv_save(**options)