red-arrow 6.0.1 → 9.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (69) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +10 -0
  3. data/ext/arrow/arrow.cpp +12 -0
  4. data/ext/arrow/converters.hpp +49 -10
  5. data/ext/arrow/extconf.rb +7 -5
  6. data/ext/arrow/raw-records.cpp +3 -2
  7. data/ext/arrow/red-arrow.hpp +7 -0
  8. data/ext/arrow/values.cpp +3 -2
  9. data/lib/arrow/array-builder.rb +40 -6
  10. data/lib/arrow/array-computable.rb +37 -0
  11. data/lib/arrow/array.rb +16 -0
  12. data/lib/arrow/chunked-array.rb +21 -0
  13. data/lib/arrow/column.rb +28 -0
  14. data/lib/arrow/data-type.rb +2 -1
  15. data/lib/arrow/datum.rb +2 -0
  16. data/lib/arrow/day-time-interval-array-builder.rb +29 -0
  17. data/lib/arrow/decimal128-array-builder.rb +16 -6
  18. data/lib/arrow/decimal128.rb +14 -0
  19. data/lib/arrow/decimal256-array-builder.rb +16 -6
  20. data/lib/arrow/decimal256.rb +14 -0
  21. data/lib/arrow/field.rb +44 -3
  22. data/lib/arrow/function.rb +52 -0
  23. data/lib/arrow/list-data-type.rb +1 -6
  24. data/lib/arrow/loader.rb +19 -0
  25. data/lib/arrow/month-day-nano-interval-array-builder.rb +29 -0
  26. data/lib/arrow/s3-global-options.rb +38 -0
  27. data/lib/arrow/sort-key.rb +61 -55
  28. data/lib/arrow/sort-options.rb +8 -8
  29. data/lib/arrow/string-array-builder.rb +30 -0
  30. data/lib/arrow/table-loader.rb +99 -62
  31. data/lib/arrow/table-saver.rb +7 -2
  32. data/lib/arrow/table.rb +78 -0
  33. data/lib/arrow/time-unit.rb +31 -0
  34. data/lib/arrow/time32-array-builder.rb +2 -14
  35. data/lib/arrow/time32-data-type.rb +9 -38
  36. data/lib/arrow/time64-array-builder.rb +2 -14
  37. data/lib/arrow/time64-data-type.rb +9 -38
  38. data/lib/arrow/timestamp-array-builder.rb +2 -14
  39. data/lib/arrow/timestamp-data-type.rb +9 -34
  40. data/lib/arrow/version.rb +1 -1
  41. data/red-arrow.gemspec +2 -11
  42. data/test/helper.rb +2 -0
  43. data/test/raw-records/test-basic-arrays.rb +30 -0
  44. data/test/raw-records/test-dense-union-array.rb +27 -0
  45. data/test/raw-records/test-dictionary-array.rb +341 -0
  46. data/test/raw-records/test-list-array.rb +39 -0
  47. data/test/raw-records/test-map-array.rb +37 -0
  48. data/test/raw-records/test-sparse-union-array.rb +27 -0
  49. data/test/raw-records/test-struct-array.rb +30 -0
  50. data/test/test-array-builder.rb +62 -0
  51. data/test/test-chunked-array.rb +6 -0
  52. data/test/test-column.rb +31 -0
  53. data/test/test-decimal128-array-builder.rb +14 -0
  54. data/test/test-decimal128-array.rb +5 -2
  55. data/test/test-decimal128.rb +26 -2
  56. data/test/test-decimal256-array-builder.rb +14 -0
  57. data/test/test-decimal256-array.rb +5 -2
  58. data/test/test-decimal256.rb +26 -2
  59. data/test/test-field.rb +26 -0
  60. data/test/test-function.rb +48 -14
  61. data/test/test-table.rb +204 -6
  62. data/test/values/test-basic-arrays.rb +30 -0
  63. data/test/values/test-dense-union-array.rb +27 -0
  64. data/test/values/test-dictionary-array.rb +325 -0
  65. data/test/values/test-list-array.rb +39 -0
  66. data/test/values/test-map-array.rb +33 -0
  67. data/test/values/test-sparse-union-array.rb +27 -0
  68. data/test/values/test-struct-array.rb +30 -0
  69. metadata +95 -196
data/lib/arrow/field.rb CHANGED
@@ -17,12 +17,28 @@
17
17
 
18
18
  module Arrow
19
19
  class Field
20
+ class << self
21
+ # @api private
22
+ def try_convert(value)
23
+ case value
24
+ when Hash
25
+ begin
26
+ new(value)
27
+ rescue ArgumentError
28
+ nil
29
+ end
30
+ else
31
+ nil
32
+ end
33
+ end
34
+ end
35
+
20
36
  alias_method :initialize_raw, :initialize
21
37
  private :initialize_raw
22
38
 
23
39
  # Creates a new {Arrow::Field}.
24
40
  #
25
- # @overload initialize(name, data_type)
41
+ # @overload initialize(name, data_type, nullable=false)
26
42
  #
27
43
  # @param name [String, Symbol] The name of the field.
28
44
  #
@@ -34,6 +50,11 @@ module Arrow
34
50
  # See {Arrow::DataType.resolve} how to specify data type
35
51
  # description.
36
52
  #
53
+ # @param nullable [Boolean, nil] (false) Whether the field may contain
54
+ # zero or more nulls.
55
+ #
56
+ # `nil` is processed as `true` (null may be contained).
57
+ #
37
58
  # @example Create a field with {Arrow::DataType}s
38
59
  # Arrow::Field.new("visible", Arrow::BooleanDataType.new)
39
60
  #
@@ -75,6 +96,11 @@ module Arrow
75
96
  # See {Arrow::DataType.resolve} how to specify data type
76
97
  # description.
77
98
  #
99
+ # @option description [Boolean, nil] :nullable Whether the field
100
+ # may contain zero or more nulls.
101
+ #
102
+ # `nil` is processed as `true` (null may be contained).
103
+ #
78
104
  # @example Create a field with {Arrow::DataType}s
79
105
  # Arrow::Field.new(name: "visible",
80
106
  # data_type: Arrow::BooleanDataType.new)
@@ -92,6 +118,7 @@ module Arrow
92
118
  name = nil
93
119
  data_type = nil
94
120
  data_type_description = {}
121
+ nullable = nil
95
122
  description.each do |key, value|
96
123
  key = key.to_sym
97
124
  case key
@@ -99,20 +126,34 @@ module Arrow
99
126
  name = value
100
127
  when :data_type
101
128
  data_type = DataType.resolve(value)
129
+ when :nullable
130
+ nullable = value
102
131
  else
103
132
  data_type_description[key] = value
104
133
  end
105
134
  end
106
135
  data_type ||= DataType.resolve(data_type_description)
107
136
  when 2
137
+ name = args[0]
138
+ data_type = args[1]
139
+ if data_type.is_a?(Hash)
140
+ data_type = data_type.dup
141
+ nullable = data_type.delete(:nullable)
142
+ else
143
+ nullable = nil
144
+ end
145
+ data_type = DataType.resolve(data_type)
146
+ when 3
108
147
  name = args[0]
109
148
  data_type = DataType.resolve(args[1])
149
+ nullable = args[2]
110
150
  else
111
- message = "wrong number of arguments (given #{n_args}, expected 1..2)"
151
+ message = "wrong number of arguments (given #{n_args}, expected 1..3)"
112
152
  raise ArgumentError, message
113
153
  end
154
+ nullable = true if nullable.nil?
114
155
 
115
- initialize_raw(name, data_type)
156
+ initialize_raw(name, data_type, nullable)
116
157
  end
117
158
  end
118
159
  end
@@ -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
@@ -107,12 +107,7 @@ module Arrow
107
107
  description = arg
108
108
  arg = description[:field]
109
109
  end
110
- if arg.is_a?(Hash)
111
- field_description = arg
112
- Field.new(field_description)
113
- else
114
- arg
115
- end
110
+ arg
116
111
  end
117
112
  end
118
113
  end
data/lib/arrow/loader.rb CHANGED
@@ -30,9 +30,11 @@ 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
37
+ require "arrow/array-computable"
36
38
  require "arrow/column-containable"
37
39
  require "arrow/field-containable"
38
40
  require "arrow/generic-filterable"
@@ -58,6 +60,7 @@ module Arrow
58
60
  require "arrow/date64-array"
59
61
  require "arrow/date64-array-builder"
60
62
  require "arrow/datum"
63
+ require "arrow/day-time-interval-array-builder"
61
64
  require "arrow/decimal128"
62
65
  require "arrow/decimal128-array"
63
66
  require "arrow/decimal128-array-builder"
@@ -76,12 +79,14 @@ module Arrow
76
79
  require "arrow/file-system"
77
80
  require "arrow/fixed-size-binary-array"
78
81
  require "arrow/fixed-size-binary-array-builder"
82
+ require "arrow/function"
79
83
  require "arrow/group"
80
84
  require "arrow/list-array-builder"
81
85
  require "arrow/list-data-type"
82
86
  require "arrow/map-array"
83
87
  require "arrow/map-array-builder"
84
88
  require "arrow/map-data-type"
89
+ require "arrow/month-day-nano-interval-array-builder"
85
90
  require "arrow/null-array"
86
91
  require "arrow/null-array-builder"
87
92
  require "arrow/path-extension"
@@ -93,6 +98,7 @@ module Arrow
93
98
  require "arrow/record-batch-reader"
94
99
  require "arrow/record-batch-stream-reader"
95
100
  require "arrow/rolling-window"
101
+ require "arrow/s3-global-options"
96
102
  require "arrow/scalar"
97
103
  require "arrow/schema"
98
104
  require "arrow/slicer"
@@ -101,6 +107,7 @@ module Arrow
101
107
  require "arrow/source-node-options"
102
108
  require "arrow/sparse-union-data-type"
103
109
  require "arrow/string-dictionary-array-builder"
110
+ require "arrow/string-array-builder"
104
111
  require "arrow/struct-array"
105
112
  require "arrow/struct-array-builder"
106
113
  require "arrow/struct-data-type"
@@ -113,6 +120,7 @@ module Arrow
113
120
  require "arrow/table-saver"
114
121
  require "arrow/tensor"
115
122
  require "arrow/time"
123
+ require "arrow/time-unit"
116
124
  require "arrow/time32-array"
117
125
  require "arrow/time32-array-builder"
118
126
  require "arrow/time32-data-type"
@@ -212,5 +220,16 @@ module Arrow
212
220
  super
213
221
  end
214
222
  end
223
+
224
+ def prepare_function_info_lock_gvl(function_info, klass)
225
+ super
226
+ case klass.name
227
+ when "Arrow::RecordBatchFileReader"
228
+ case function_info.name
229
+ when "new"
230
+ function_info.lock_gvl_default = false
231
+ end
232
+ end
233
+ end
215
234
  end
216
235
  end
@@ -0,0 +1,29 @@
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 MonthDayNanoIntervalArrayBuilder
20
+ private
21
+ def convert_to_arrow_value(value)
22
+ if value.is_a?(Hash)
23
+ Arrow::MonthDayNano.new(value[:month], value[:day], value[:nanosecond])
24
+ else
25
+ value
26
+ end
27
+ end
28
+ end
29
+ 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
@@ -0,0 +1,30 @@
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 StringArrayBuilder
20
+ private
21
+ def convert_to_arrow_value(value)
22
+ case value
23
+ when GLib::Bytes, String
24
+ value
25
+ else
26
+ value.to_s
27
+ end
28
+ end
29
+ end
30
+ end