red-arrow 0.17.1 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/ext/arrow/converters.hpp +60 -30
- data/ext/arrow/raw-records.cpp +2 -1
- data/ext/arrow/values.cpp +2 -1
- data/lib/arrow/buffer.rb +28 -0
- data/lib/arrow/dictionary-array.rb +24 -0
- data/lib/arrow/loader.rb +3 -0
- data/lib/arrow/raw-table-converter.rb +47 -0
- data/lib/arrow/record-batch-iterator.rb +22 -0
- data/lib/arrow/record-batch.rb +9 -1
- data/lib/arrow/struct-array-builder.rb +13 -7
- data/lib/arrow/table-saver.rb +6 -6
- data/lib/arrow/table.rb +5 -24
- data/lib/arrow/version.rb +1 -1
- data/test/raw-records/test-dense-union-array.rb +1 -34
- data/test/raw-records/test-sparse-union-array.rb +1 -33
- data/test/test-buffer.rb +11 -0
- data/test/test-dense-union-data-type.rb +2 -2
- data/test/test-dictionary-array.rb +41 -0
- data/test/test-feather.rb +1 -1
- data/test/test-record-batch-iterator.rb +37 -0
- data/test/test-record-batch.rb +14 -0
- data/test/test-sparse-union-data-type.rb +2 -2
- data/test/test-struct-array-builder.rb +8 -4
- data/test/values/test-dense-union-array.rb +1 -34
- data/test/values/test-sparse-union-array.rb +1 -33
- metadata +14 -6
data/test/test-buffer.rb
CHANGED
@@ -16,6 +16,17 @@
|
|
16
16
|
# under the License.
|
17
17
|
|
18
18
|
class BufferTest < Test::Unit::TestCase
|
19
|
+
sub_test_case(".new") do
|
20
|
+
test("GC") do
|
21
|
+
data = "Hello"
|
22
|
+
data_id = data.object_id
|
23
|
+
_buffer = Arrow::Buffer.new(data)
|
24
|
+
data = nil
|
25
|
+
GC.start
|
26
|
+
assert_equal("Hello", ObjectSpace._id2ref(data_id))
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
19
30
|
sub_test_case("instance methods") do
|
20
31
|
def setup
|
21
32
|
@buffer = Arrow::Buffer.new("Hello")
|
@@ -28,12 +28,12 @@ class DenseUnionDataTypeTest < Test::Unit::TestCase
|
|
28
28
|
end
|
29
29
|
|
30
30
|
test("ordered arguments") do
|
31
|
-
assert_equal("
|
31
|
+
assert_equal("dense_union<visible: bool=2, count: int32=9>",
|
32
32
|
Arrow::DenseUnionDataType.new(@fields, [2, 9]).to_s)
|
33
33
|
end
|
34
34
|
|
35
35
|
test("description") do
|
36
|
-
assert_equal("
|
36
|
+
assert_equal("dense_union<visible: bool=2, count: int32=9>",
|
37
37
|
Arrow::DenseUnionDataType.new(fields: @fields,
|
38
38
|
type_codes: [2, 9]).to_s)
|
39
39
|
end
|
@@ -0,0 +1,41 @@
|
|
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
|
+
class DictionaryArrayTest < Test::Unit::TestCase
|
19
|
+
sub_test_case("instance methods") do
|
20
|
+
def setup
|
21
|
+
@values = ["a", "b", "c", "b", "a"]
|
22
|
+
@string_array = Arrow::StringArray.new(@values)
|
23
|
+
@array = @string_array.dictionary_encode
|
24
|
+
end
|
25
|
+
|
26
|
+
test("#[]") do
|
27
|
+
assert_equal(@values, @array.to_a)
|
28
|
+
end
|
29
|
+
|
30
|
+
test("#get_value") do
|
31
|
+
assert_equal([
|
32
|
+
@values[0],
|
33
|
+
@values[3],
|
34
|
+
],
|
35
|
+
[
|
36
|
+
@array.get_value(0),
|
37
|
+
@array.get_value(3),
|
38
|
+
])
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
data/test/test-feather.rb
CHANGED
@@ -0,0 +1,37 @@
|
|
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
|
+
class RecordBatchIteratorTest < Test::Unit::TestCase
|
19
|
+
def setup
|
20
|
+
@schema = Arrow::Schema.new(visible: :boolean,
|
21
|
+
count: :uint32)
|
22
|
+
@record_batches = [
|
23
|
+
Arrow::RecordBatch.new(@schema,
|
24
|
+
visible: [true],
|
25
|
+
count: [1]),
|
26
|
+
Arrow::RecordBatch.new(@schema,
|
27
|
+
visible: [false, nil],
|
28
|
+
count: [nil, 3]),
|
29
|
+
]
|
30
|
+
@iterator = Arrow::RecordBatchIterator.new(@record_batches)
|
31
|
+
end
|
32
|
+
|
33
|
+
def test_to_a
|
34
|
+
assert_equal(@record_batches,
|
35
|
+
@iterator.to_a)
|
36
|
+
end
|
37
|
+
end
|
data/test/test-record-batch.rb
CHANGED
@@ -22,6 +22,20 @@ class RecordBatchTest < Test::Unit::TestCase
|
|
22
22
|
count: :uint32)
|
23
23
|
end
|
24
24
|
|
25
|
+
test("[raw_table]") do
|
26
|
+
raw_table = {
|
27
|
+
visible: [true, nil, false],
|
28
|
+
count: [1, nil, 3],
|
29
|
+
}
|
30
|
+
record_batch = Arrow::RecordBatch.new(raw_table)
|
31
|
+
assert_equal([
|
32
|
+
{"visible" => true, "count" => 1},
|
33
|
+
{"visible" => nil, "count" => nil},
|
34
|
+
{"visible" => false, "count" => 3},
|
35
|
+
],
|
36
|
+
record_batch.each_record.collect(&:to_h))
|
37
|
+
end
|
38
|
+
|
25
39
|
test("[Schema, records]") do
|
26
40
|
records = [
|
27
41
|
{visible: true, count: 1},
|
@@ -28,12 +28,12 @@ class SparseUnionDataTypeTest < Test::Unit::TestCase
|
|
28
28
|
end
|
29
29
|
|
30
30
|
test("ordered arguments") do
|
31
|
-
assert_equal("
|
31
|
+
assert_equal("sparse_union<visible: bool=2, count: int32=9>",
|
32
32
|
Arrow::SparseUnionDataType.new(@fields, [2, 9]).to_s)
|
33
33
|
end
|
34
34
|
|
35
35
|
test("description") do
|
36
|
-
assert_equal("
|
36
|
+
assert_equal("sparse_union<visible: bool=2, count: int32=9>",
|
37
37
|
Arrow::SparseUnionDataType.new(fields: @fields,
|
38
38
|
type_codes: [2, 9]).to_s)
|
39
39
|
end
|
@@ -38,10 +38,12 @@ class StructArrayBuilderTest < Test::Unit::TestCase
|
|
38
38
|
|
39
39
|
test("Array") do
|
40
40
|
@builder.append_value([true, 1])
|
41
|
+
@builder.append_value([])
|
42
|
+
@builder.append_value([false])
|
41
43
|
array = @builder.finish
|
42
44
|
assert_equal([
|
43
|
-
[true],
|
44
|
-
[1],
|
45
|
+
[true, nil, false],
|
46
|
+
[1, nil, nil],
|
45
47
|
],
|
46
48
|
[
|
47
49
|
array.find_field(0).to_a,
|
@@ -66,10 +68,12 @@ class StructArrayBuilderTest < Test::Unit::TestCase
|
|
66
68
|
|
67
69
|
test("Hash") do
|
68
70
|
@builder.append_value(count: 1, visible: true)
|
71
|
+
@builder.append_value(visible: false)
|
72
|
+
@builder.append_value(count: 2)
|
69
73
|
array = @builder.finish
|
70
74
|
assert_equal([
|
71
|
-
[true],
|
72
|
-
[1],
|
75
|
+
[true, false, nil],
|
76
|
+
[1, nil, 2],
|
73
77
|
],
|
74
78
|
[
|
75
79
|
array.find_field(0).to_a,
|
@@ -48,10 +48,7 @@ module ValuesDenseUnionArrayTests
|
|
48
48
|
sub_record_batch.columns[0].data
|
49
49
|
end
|
50
50
|
values.each do |value|
|
51
|
-
if value.
|
52
|
-
type_ids << nil
|
53
|
-
offsets << 0
|
54
|
-
elsif value.key?("0")
|
51
|
+
if value.key?("0")
|
55
52
|
type_id = type_codes[0]
|
56
53
|
type_ids << type_id
|
57
54
|
offsets << (type_ids.count(type_id) - 1)
|
@@ -70,7 +67,6 @@ module ValuesDenseUnionArrayTests
|
|
70
67
|
def test_null
|
71
68
|
values = [
|
72
69
|
{"0" => nil},
|
73
|
-
nil,
|
74
70
|
]
|
75
71
|
target = build(:null, values)
|
76
72
|
assert_equal(values, target.values)
|
@@ -79,7 +75,6 @@ module ValuesDenseUnionArrayTests
|
|
79
75
|
def test_boolean
|
80
76
|
values = [
|
81
77
|
{"0" => true},
|
82
|
-
nil,
|
83
78
|
{"1" => nil},
|
84
79
|
]
|
85
80
|
target = build(:boolean, values)
|
@@ -89,7 +84,6 @@ module ValuesDenseUnionArrayTests
|
|
89
84
|
def test_int8
|
90
85
|
values = [
|
91
86
|
{"0" => -(2 ** 7)},
|
92
|
-
nil,
|
93
87
|
{"1" => nil},
|
94
88
|
]
|
95
89
|
target = build(:int8, values)
|
@@ -99,7 +93,6 @@ module ValuesDenseUnionArrayTests
|
|
99
93
|
def test_uint8
|
100
94
|
values = [
|
101
95
|
{"0" => (2 ** 8) - 1},
|
102
|
-
nil,
|
103
96
|
{"1" => nil},
|
104
97
|
]
|
105
98
|
target = build(:uint8, values)
|
@@ -109,7 +102,6 @@ module ValuesDenseUnionArrayTests
|
|
109
102
|
def test_int16
|
110
103
|
values = [
|
111
104
|
{"0" => -(2 ** 15)},
|
112
|
-
nil,
|
113
105
|
{"1" => nil},
|
114
106
|
]
|
115
107
|
target = build(:int16, values)
|
@@ -119,7 +111,6 @@ module ValuesDenseUnionArrayTests
|
|
119
111
|
def test_uint16
|
120
112
|
values = [
|
121
113
|
{"0" => (2 ** 16) - 1},
|
122
|
-
nil,
|
123
114
|
{"1" => nil},
|
124
115
|
]
|
125
116
|
target = build(:uint16, values)
|
@@ -129,7 +120,6 @@ module ValuesDenseUnionArrayTests
|
|
129
120
|
def test_int32
|
130
121
|
values = [
|
131
122
|
{"0" => -(2 ** 31)},
|
132
|
-
nil,
|
133
123
|
{"1" => nil},
|
134
124
|
]
|
135
125
|
target = build(:int32, values)
|
@@ -139,7 +129,6 @@ module ValuesDenseUnionArrayTests
|
|
139
129
|
def test_uint32
|
140
130
|
values = [
|
141
131
|
{"0" => (2 ** 32) - 1},
|
142
|
-
nil,
|
143
132
|
{"1" => nil},
|
144
133
|
]
|
145
134
|
target = build(:uint32, values)
|
@@ -149,7 +138,6 @@ module ValuesDenseUnionArrayTests
|
|
149
138
|
def test_int64
|
150
139
|
values = [
|
151
140
|
{"0" => -(2 ** 63)},
|
152
|
-
nil,
|
153
141
|
{"1" => nil},
|
154
142
|
]
|
155
143
|
target = build(:int64, values)
|
@@ -159,7 +147,6 @@ module ValuesDenseUnionArrayTests
|
|
159
147
|
def test_uint64
|
160
148
|
values = [
|
161
149
|
{"0" => (2 ** 64) - 1},
|
162
|
-
nil,
|
163
150
|
{"1" => nil},
|
164
151
|
]
|
165
152
|
target = build(:uint64, values)
|
@@ -169,7 +156,6 @@ module ValuesDenseUnionArrayTests
|
|
169
156
|
def test_float
|
170
157
|
values = [
|
171
158
|
{"0" => -1.0},
|
172
|
-
nil,
|
173
159
|
{"1" => nil},
|
174
160
|
]
|
175
161
|
target = build(:float, values)
|
@@ -179,7 +165,6 @@ module ValuesDenseUnionArrayTests
|
|
179
165
|
def test_double
|
180
166
|
values = [
|
181
167
|
{"0" => -1.0},
|
182
|
-
nil,
|
183
168
|
{"1" => nil},
|
184
169
|
]
|
185
170
|
target = build(:double, values)
|
@@ -189,7 +174,6 @@ module ValuesDenseUnionArrayTests
|
|
189
174
|
def test_binary
|
190
175
|
values = [
|
191
176
|
{"0" => "\xff".b},
|
192
|
-
nil,
|
193
177
|
{"1" => nil},
|
194
178
|
]
|
195
179
|
target = build(:binary, values)
|
@@ -199,7 +183,6 @@ module ValuesDenseUnionArrayTests
|
|
199
183
|
def test_string
|
200
184
|
values = [
|
201
185
|
{"0" => "Ruby"},
|
202
|
-
nil,
|
203
186
|
{"1" => nil},
|
204
187
|
]
|
205
188
|
target = build(:string, values)
|
@@ -209,7 +192,6 @@ module ValuesDenseUnionArrayTests
|
|
209
192
|
def test_date32
|
210
193
|
values = [
|
211
194
|
{"0" => Date.new(1960, 1, 1)},
|
212
|
-
nil,
|
213
195
|
{"1" => nil},
|
214
196
|
]
|
215
197
|
target = build(:date32, values)
|
@@ -219,7 +201,6 @@ module ValuesDenseUnionArrayTests
|
|
219
201
|
def test_date64
|
220
202
|
values = [
|
221
203
|
{"0" => DateTime.new(1960, 1, 1, 2, 9, 30)},
|
222
|
-
nil,
|
223
204
|
{"1" => nil},
|
224
205
|
]
|
225
206
|
target = build(:date64, values)
|
@@ -229,7 +210,6 @@ module ValuesDenseUnionArrayTests
|
|
229
210
|
def test_timestamp_second
|
230
211
|
values = [
|
231
212
|
{"0" => Time.parse("1960-01-01T02:09:30Z")},
|
232
|
-
nil,
|
233
213
|
{"1" => nil},
|
234
214
|
]
|
235
215
|
target = build({
|
@@ -243,7 +223,6 @@ module ValuesDenseUnionArrayTests
|
|
243
223
|
def test_timestamp_milli
|
244
224
|
values = [
|
245
225
|
{"0" => Time.parse("1960-01-01T02:09:30.123Z")},
|
246
|
-
nil,
|
247
226
|
{"1" => nil},
|
248
227
|
]
|
249
228
|
target = build({
|
@@ -257,7 +236,6 @@ module ValuesDenseUnionArrayTests
|
|
257
236
|
def test_timestamp_micro
|
258
237
|
values = [
|
259
238
|
{"0" => Time.parse("1960-01-01T02:09:30.123456Z")},
|
260
|
-
nil,
|
261
239
|
{"1" => nil},
|
262
240
|
]
|
263
241
|
target = build({
|
@@ -271,7 +249,6 @@ module ValuesDenseUnionArrayTests
|
|
271
249
|
def test_timestamp_nano
|
272
250
|
values = [
|
273
251
|
{"0" => Time.parse("1960-01-01T02:09:30.123456789Z")},
|
274
|
-
nil,
|
275
252
|
{"1" => nil},
|
276
253
|
]
|
277
254
|
target = build({
|
@@ -287,7 +264,6 @@ module ValuesDenseUnionArrayTests
|
|
287
264
|
values = [
|
288
265
|
# 00:10:00
|
289
266
|
{"0" => Arrow::Time.new(unit, 60 * 10)},
|
290
|
-
nil,
|
291
267
|
{"1" => nil},
|
292
268
|
]
|
293
269
|
target = build({
|
@@ -303,7 +279,6 @@ module ValuesDenseUnionArrayTests
|
|
303
279
|
values = [
|
304
280
|
# 00:10:00.123
|
305
281
|
{"0" => Arrow::Time.new(unit, (60 * 10) * 1000 + 123)},
|
306
|
-
nil,
|
307
282
|
{"1" => nil},
|
308
283
|
]
|
309
284
|
target = build({
|
@@ -319,7 +294,6 @@ module ValuesDenseUnionArrayTests
|
|
319
294
|
values = [
|
320
295
|
# 00:10:00.123456
|
321
296
|
{"0" => Arrow::Time.new(unit, (60 * 10) * 1_000_000 + 123_456)},
|
322
|
-
nil,
|
323
297
|
{"1" => nil},
|
324
298
|
]
|
325
299
|
target = build({
|
@@ -335,7 +309,6 @@ module ValuesDenseUnionArrayTests
|
|
335
309
|
values = [
|
336
310
|
# 00:10:00.123456789
|
337
311
|
{"0" => Arrow::Time.new(unit, (60 * 10) * 1_000_000_000 + 123_456_789)},
|
338
|
-
nil,
|
339
312
|
{"1" => nil},
|
340
313
|
]
|
341
314
|
target = build({
|
@@ -349,7 +322,6 @@ module ValuesDenseUnionArrayTests
|
|
349
322
|
def test_decimal128
|
350
323
|
values = [
|
351
324
|
{"0" => BigDecimal("92.92")},
|
352
|
-
nil,
|
353
325
|
{"1" => nil},
|
354
326
|
]
|
355
327
|
target = build({
|
@@ -364,7 +336,6 @@ module ValuesDenseUnionArrayTests
|
|
364
336
|
def test_list
|
365
337
|
values = [
|
366
338
|
{"0" => [true, nil, false]},
|
367
|
-
nil,
|
368
339
|
{"1" => nil},
|
369
340
|
]
|
370
341
|
target = build({
|
@@ -381,7 +352,6 @@ module ValuesDenseUnionArrayTests
|
|
381
352
|
def test_struct
|
382
353
|
values = [
|
383
354
|
{"0" => {"sub_field" => true}},
|
384
|
-
nil,
|
385
355
|
{"1" => nil},
|
386
356
|
{"0" => {"sub_field" => nil}},
|
387
357
|
]
|
@@ -402,7 +372,6 @@ module ValuesDenseUnionArrayTests
|
|
402
372
|
omit("Need to add support for SparseUnionArrayBuilder")
|
403
373
|
values = [
|
404
374
|
{"0" => {"field1" => true}},
|
405
|
-
nil,
|
406
375
|
{"1" => nil},
|
407
376
|
{"0" => {"field2" => nil}},
|
408
377
|
]
|
@@ -428,7 +397,6 @@ module ValuesDenseUnionArrayTests
|
|
428
397
|
omit("Need to add support for DenseUnionArrayBuilder")
|
429
398
|
values = [
|
430
399
|
{"0" => {"field1" => true}},
|
431
|
-
nil,
|
432
400
|
{"1" => nil},
|
433
401
|
{"0" => {"field2" => nil}},
|
434
402
|
]
|
@@ -454,7 +422,6 @@ module ValuesDenseUnionArrayTests
|
|
454
422
|
omit("Need to add support for DictionaryArrayBuilder")
|
455
423
|
values = [
|
456
424
|
{"0" => "Ruby"},
|
457
|
-
nil,
|
458
425
|
{"1" => nil},
|
459
426
|
{"0" => "GLib"},
|
460
427
|
]
|
@@ -44,9 +44,7 @@ module ValuesSparseUnionArrayTests
|
|
44
44
|
sub_record_batch.columns[0].data
|
45
45
|
end
|
46
46
|
values.each do |value|
|
47
|
-
if value.
|
48
|
-
type_ids << nil
|
49
|
-
elsif value.key?("0")
|
47
|
+
if value.key?("0")
|
50
48
|
type_ids << type_codes[0]
|
51
49
|
elsif value.key?("1")
|
52
50
|
type_ids << type_codes[1]
|
@@ -60,7 +58,6 @@ module ValuesSparseUnionArrayTests
|
|
60
58
|
def test_null
|
61
59
|
values = [
|
62
60
|
{"0" => nil},
|
63
|
-
nil,
|
64
61
|
]
|
65
62
|
target = build(:null, values)
|
66
63
|
assert_equal(values, target.values)
|
@@ -69,7 +66,6 @@ module ValuesSparseUnionArrayTests
|
|
69
66
|
def test_boolean
|
70
67
|
values = [
|
71
68
|
{"0" => true},
|
72
|
-
nil,
|
73
69
|
{"1" => nil},
|
74
70
|
]
|
75
71
|
target = build(:boolean, values)
|
@@ -79,7 +75,6 @@ module ValuesSparseUnionArrayTests
|
|
79
75
|
def test_int8
|
80
76
|
values = [
|
81
77
|
{"0" => -(2 ** 7)},
|
82
|
-
nil,
|
83
78
|
{"1" => nil},
|
84
79
|
]
|
85
80
|
target = build(:int8, values)
|
@@ -89,7 +84,6 @@ module ValuesSparseUnionArrayTests
|
|
89
84
|
def test_uint8
|
90
85
|
values = [
|
91
86
|
{"0" => (2 ** 8) - 1},
|
92
|
-
nil,
|
93
87
|
{"1" => nil},
|
94
88
|
]
|
95
89
|
target = build(:uint8, values)
|
@@ -99,7 +93,6 @@ module ValuesSparseUnionArrayTests
|
|
99
93
|
def test_int16
|
100
94
|
values = [
|
101
95
|
{"0" => -(2 ** 15)},
|
102
|
-
nil,
|
103
96
|
{"1" => nil},
|
104
97
|
]
|
105
98
|
target = build(:int16, values)
|
@@ -109,7 +102,6 @@ module ValuesSparseUnionArrayTests
|
|
109
102
|
def test_uint16
|
110
103
|
values = [
|
111
104
|
{"0" => (2 ** 16) - 1},
|
112
|
-
nil,
|
113
105
|
{"1" => nil},
|
114
106
|
]
|
115
107
|
target = build(:uint16, values)
|
@@ -119,7 +111,6 @@ module ValuesSparseUnionArrayTests
|
|
119
111
|
def test_int32
|
120
112
|
values = [
|
121
113
|
{"0" => -(2 ** 31)},
|
122
|
-
nil,
|
123
114
|
{"1" => nil},
|
124
115
|
]
|
125
116
|
target = build(:int32, values)
|
@@ -129,7 +120,6 @@ module ValuesSparseUnionArrayTests
|
|
129
120
|
def test_uint32
|
130
121
|
values = [
|
131
122
|
{"0" => (2 ** 32) - 1},
|
132
|
-
nil,
|
133
123
|
{"1" => nil},
|
134
124
|
]
|
135
125
|
target = build(:uint32, values)
|
@@ -139,7 +129,6 @@ module ValuesSparseUnionArrayTests
|
|
139
129
|
def test_int64
|
140
130
|
values = [
|
141
131
|
{"0" => -(2 ** 63)},
|
142
|
-
nil,
|
143
132
|
{"1" => nil},
|
144
133
|
]
|
145
134
|
target = build(:int64, values)
|
@@ -149,7 +138,6 @@ module ValuesSparseUnionArrayTests
|
|
149
138
|
def test_uint64
|
150
139
|
values = [
|
151
140
|
{"0" => (2 ** 64) - 1},
|
152
|
-
nil,
|
153
141
|
{"1" => nil},
|
154
142
|
]
|
155
143
|
target = build(:uint64, values)
|
@@ -159,7 +147,6 @@ module ValuesSparseUnionArrayTests
|
|
159
147
|
def test_float
|
160
148
|
values = [
|
161
149
|
{"0" => -1.0},
|
162
|
-
nil,
|
163
150
|
{"1" => nil},
|
164
151
|
]
|
165
152
|
target = build(:float, values)
|
@@ -169,7 +156,6 @@ module ValuesSparseUnionArrayTests
|
|
169
156
|
def test_double
|
170
157
|
values = [
|
171
158
|
{"0" => -1.0},
|
172
|
-
nil,
|
173
159
|
{"1" => nil},
|
174
160
|
]
|
175
161
|
target = build(:double, values)
|
@@ -179,7 +165,6 @@ module ValuesSparseUnionArrayTests
|
|
179
165
|
def test_binary
|
180
166
|
values = [
|
181
167
|
{"0" => "\xff".b},
|
182
|
-
nil,
|
183
168
|
{"1" => nil},
|
184
169
|
]
|
185
170
|
target = build(:binary, values)
|
@@ -189,7 +174,6 @@ module ValuesSparseUnionArrayTests
|
|
189
174
|
def test_string
|
190
175
|
values = [
|
191
176
|
{"0" => "Ruby"},
|
192
|
-
nil,
|
193
177
|
{"1" => nil},
|
194
178
|
]
|
195
179
|
target = build(:string, values)
|
@@ -199,7 +183,6 @@ module ValuesSparseUnionArrayTests
|
|
199
183
|
def test_date32
|
200
184
|
values = [
|
201
185
|
{"0" => Date.new(1960, 1, 1)},
|
202
|
-
nil,
|
203
186
|
{"1" => nil},
|
204
187
|
]
|
205
188
|
target = build(:date32, values)
|
@@ -209,7 +192,6 @@ module ValuesSparseUnionArrayTests
|
|
209
192
|
def test_date64
|
210
193
|
values = [
|
211
194
|
{"0" => DateTime.new(1960, 1, 1, 2, 9, 30)},
|
212
|
-
nil,
|
213
195
|
{"1" => nil},
|
214
196
|
]
|
215
197
|
target = build(:date64, values)
|
@@ -219,7 +201,6 @@ module ValuesSparseUnionArrayTests
|
|
219
201
|
def test_timestamp_second
|
220
202
|
values = [
|
221
203
|
{"0" => Time.parse("1960-01-01T02:09:30Z")},
|
222
|
-
nil,
|
223
204
|
{"1" => nil},
|
224
205
|
]
|
225
206
|
target = build({
|
@@ -233,7 +214,6 @@ module ValuesSparseUnionArrayTests
|
|
233
214
|
def test_timestamp_milli
|
234
215
|
values = [
|
235
216
|
{"0" => Time.parse("1960-01-01T02:09:30.123Z")},
|
236
|
-
nil,
|
237
217
|
{"1" => nil},
|
238
218
|
]
|
239
219
|
target = build({
|
@@ -247,7 +227,6 @@ module ValuesSparseUnionArrayTests
|
|
247
227
|
def test_timestamp_micro
|
248
228
|
values = [
|
249
229
|
{"0" => Time.parse("1960-01-01T02:09:30.123456Z")},
|
250
|
-
nil,
|
251
230
|
{"1" => nil},
|
252
231
|
]
|
253
232
|
target = build({
|
@@ -261,7 +240,6 @@ module ValuesSparseUnionArrayTests
|
|
261
240
|
def test_timestamp_nano
|
262
241
|
values = [
|
263
242
|
{"0" => Time.parse("1960-01-01T02:09:30.123456789Z")},
|
264
|
-
nil,
|
265
243
|
{"1" => nil},
|
266
244
|
]
|
267
245
|
target = build({
|
@@ -277,7 +255,6 @@ module ValuesSparseUnionArrayTests
|
|
277
255
|
values = [
|
278
256
|
# 00:10:00
|
279
257
|
{"0" => Arrow::Time.new(unit, 60 * 10)},
|
280
|
-
nil,
|
281
258
|
{"1" => nil},
|
282
259
|
]
|
283
260
|
target = build({
|
@@ -293,7 +270,6 @@ module ValuesSparseUnionArrayTests
|
|
293
270
|
values = [
|
294
271
|
# 00:10:00.123
|
295
272
|
{"0" => Arrow::Time.new(unit, (60 * 10) * 1000 + 123)},
|
296
|
-
nil,
|
297
273
|
{"1" => nil},
|
298
274
|
]
|
299
275
|
target = build({
|
@@ -309,7 +285,6 @@ module ValuesSparseUnionArrayTests
|
|
309
285
|
values = [
|
310
286
|
# 00:10:00.123456
|
311
287
|
{"0" => Arrow::Time.new(unit, (60 * 10) * 1_000_000 + 123_456)},
|
312
|
-
nil,
|
313
288
|
{"1" => nil},
|
314
289
|
]
|
315
290
|
target = build({
|
@@ -325,7 +300,6 @@ module ValuesSparseUnionArrayTests
|
|
325
300
|
values = [
|
326
301
|
# 00:10:00.123456789
|
327
302
|
{"0" => Arrow::Time.new(unit, (60 * 10) * 1_000_000_000 + 123_456_789)},
|
328
|
-
nil,
|
329
303
|
{"1" => nil},
|
330
304
|
]
|
331
305
|
target = build({
|
@@ -339,7 +313,6 @@ module ValuesSparseUnionArrayTests
|
|
339
313
|
def test_decimal128
|
340
314
|
values = [
|
341
315
|
{"0" => BigDecimal("92.92")},
|
342
|
-
nil,
|
343
316
|
{"1" => nil},
|
344
317
|
]
|
345
318
|
target = build({
|
@@ -354,7 +327,6 @@ module ValuesSparseUnionArrayTests
|
|
354
327
|
def test_list
|
355
328
|
values = [
|
356
329
|
{"0" => [true, nil, false]},
|
357
|
-
nil,
|
358
330
|
{"1" => nil},
|
359
331
|
]
|
360
332
|
target = build({
|
@@ -371,7 +343,6 @@ module ValuesSparseUnionArrayTests
|
|
371
343
|
def test_struct
|
372
344
|
values = [
|
373
345
|
{"0" => {"sub_field" => true}},
|
374
|
-
nil,
|
375
346
|
{"1" => nil},
|
376
347
|
{"0" => {"sub_field" => nil}},
|
377
348
|
]
|
@@ -392,7 +363,6 @@ module ValuesSparseUnionArrayTests
|
|
392
363
|
omit("Need to add support for SparseUnionArrayBuilder")
|
393
364
|
values = [
|
394
365
|
{"0" => {"field1" => true}},
|
395
|
-
nil,
|
396
366
|
{"1" => nil},
|
397
367
|
{"0" => {"field2" => nil}},
|
398
368
|
]
|
@@ -418,7 +388,6 @@ module ValuesSparseUnionArrayTests
|
|
418
388
|
omit("Need to add support for DenseUnionArrayBuilder")
|
419
389
|
values = [
|
420
390
|
{"0" => {"field1" => true}},
|
421
|
-
nil,
|
422
391
|
{"1" => nil},
|
423
392
|
{"0" => {"field2" => nil}},
|
424
393
|
]
|
@@ -444,7 +413,6 @@ module ValuesSparseUnionArrayTests
|
|
444
413
|
omit("Need to add support for DictionaryArrayBuilder")
|
445
414
|
values = [
|
446
415
|
{"0" => "Ruby"},
|
447
|
-
nil,
|
448
416
|
{"1" => nil},
|
449
417
|
{"0" => "GLib"},
|
450
418
|
]
|