red-arrow 0.17.0 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ext/arrow/converters.hpp +75 -32
- data/ext/arrow/extconf.rb +14 -3
- data/ext/arrow/raw-records.cpp +3 -1
- data/ext/arrow/values.cpp +3 -1
- data/lib/arrow/array-builder.rb +11 -6
- data/lib/arrow/bigdecimal-extension.rb +5 -1
- data/lib/arrow/buffer.rb +28 -0
- data/lib/arrow/decimal128-array-builder.rb +21 -25
- data/lib/arrow/decimal128-data-type.rb +2 -0
- data/lib/arrow/decimal128.rb +18 -0
- data/lib/arrow/decimal256-array-builder.rb +61 -0
- data/lib/arrow/decimal256-array.rb +25 -0
- data/lib/arrow/decimal256-data-type.rb +73 -0
- data/lib/arrow/decimal256.rb +60 -0
- data/lib/arrow/dictionary-array.rb +24 -0
- data/lib/arrow/fixed-size-binary-array-builder.rb +38 -0
- data/lib/arrow/fixed-size-binary-array.rb +26 -0
- data/lib/arrow/loader.rb +16 -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/red-arrow.gemspec +1 -0
- data/test/raw-records/test-basic-arrays.rb +17 -0
- data/test/raw-records/test-dense-union-array.rb +15 -34
- data/test/raw-records/test-list-array.rb +20 -0
- data/test/raw-records/test-sparse-union-array.rb +15 -33
- data/test/raw-records/test-struct-array.rb +15 -0
- data/test/test-array.rb +2 -2
- data/test/test-bigdecimal.rb +20 -3
- data/test/test-buffer.rb +11 -0
- data/test/test-decimal128-array-builder.rb +18 -1
- data/test/test-decimal128.rb +38 -0
- data/test/test-decimal256-array-builder.rb +112 -0
- data/test/test-decimal256-array.rb +38 -0
- data/test/test-decimal256-data-type.rb +31 -0
- data/test/test-decimal256.rb +102 -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-fixed-size-binary-array-builder.rb +92 -0
- data/test/test-fixed-size-binary-array.rb +36 -0
- 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 +16 -12
- data/test/test-struct-array.rb +2 -2
- data/test/values/test-basic-arrays.rb +11 -0
- data/test/values/test-dense-union-array.rb +15 -34
- data/test/values/test-list-array.rb +18 -0
- data/test/values/test-sparse-union-array.rb +15 -33
- data/test/values/test-struct-array.rb +15 -0
- metadata +96 -56
@@ -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,92 @@
|
|
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 FixedSizeBinaryArrayBuilderTest < Test::Unit::TestCase
|
19
|
+
def setup
|
20
|
+
@data_type = Arrow::FixedSizeBinaryDataType.new(4)
|
21
|
+
@builder = Arrow::FixedSizeBinaryArrayBuilder.new(@data_type)
|
22
|
+
end
|
23
|
+
|
24
|
+
sub_test_case("#append_value") do
|
25
|
+
test("nil") do
|
26
|
+
@builder.append_value(nil)
|
27
|
+
array = @builder.finish
|
28
|
+
assert_equal(nil, array[0])
|
29
|
+
end
|
30
|
+
|
31
|
+
test("String") do
|
32
|
+
@builder.append_value("0123")
|
33
|
+
array = @builder.finish
|
34
|
+
assert_equal("0123", array[0])
|
35
|
+
end
|
36
|
+
|
37
|
+
test("GLib::Bytes") do
|
38
|
+
@builder.append_value(GLib::Bytes.new("0123"))
|
39
|
+
array = @builder.finish
|
40
|
+
assert_equal("0123", array[0])
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
sub_test_case("#append_values") do
|
45
|
+
test("mixed") do
|
46
|
+
@builder.append_values([
|
47
|
+
"0123",
|
48
|
+
nil,
|
49
|
+
GLib::Bytes.new("abcd"),
|
50
|
+
])
|
51
|
+
array = @builder.finish
|
52
|
+
assert_equal([
|
53
|
+
"0123",
|
54
|
+
nil,
|
55
|
+
"abcd",
|
56
|
+
],
|
57
|
+
array.to_a)
|
58
|
+
end
|
59
|
+
|
60
|
+
test("is_valids") do
|
61
|
+
@builder.append_values([
|
62
|
+
"0123",
|
63
|
+
"0123",
|
64
|
+
"0123",
|
65
|
+
],
|
66
|
+
[
|
67
|
+
true,
|
68
|
+
false,
|
69
|
+
true,
|
70
|
+
])
|
71
|
+
array = @builder.finish
|
72
|
+
assert_equal([
|
73
|
+
"0123",
|
74
|
+
nil,
|
75
|
+
"0123",
|
76
|
+
],
|
77
|
+
array.to_a)
|
78
|
+
end
|
79
|
+
|
80
|
+
test("packed") do
|
81
|
+
@builder.append_values("0123" * 3,
|
82
|
+
[true, false, true])
|
83
|
+
array = @builder.finish
|
84
|
+
assert_equal([
|
85
|
+
"0123",
|
86
|
+
nil,
|
87
|
+
"0123",
|
88
|
+
],
|
89
|
+
array.to_a)
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
@@ -0,0 +1,36 @@
|
|
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 FixedSizeBinaryArrayTest < Test::Unit::TestCase
|
19
|
+
sub_test_case(".new") do
|
20
|
+
test("build") do
|
21
|
+
data_type = Arrow::FixedSizeBinaryDataType.new(4)
|
22
|
+
values = [
|
23
|
+
"0123",
|
24
|
+
nil,
|
25
|
+
GLib::Bytes.new("abcd"),
|
26
|
+
]
|
27
|
+
array = Arrow::FixedSizeBinaryArray.new(data_type, values)
|
28
|
+
assert_equal([
|
29
|
+
"0123",
|
30
|
+
nil,
|
31
|
+
"abcd",
|
32
|
+
],
|
33
|
+
array.to_a)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -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
|
@@ -27,8 +27,8 @@ class StructArrayBuilderTest < Test::Unit::TestCase
|
|
27
27
|
@builder.append_value(nil)
|
28
28
|
array = @builder.finish
|
29
29
|
assert_equal([
|
30
|
-
[
|
31
|
-
[
|
30
|
+
[false],
|
31
|
+
[0],
|
32
32
|
],
|
33
33
|
[
|
34
34
|
array.find_field(0).to_a,
|
@@ -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,
|
@@ -83,8 +87,8 @@ class StructArrayBuilderTest < Test::Unit::TestCase
|
|
83
87
|
@builder.append_values([nil])
|
84
88
|
array = @builder.finish
|
85
89
|
assert_equal([
|
86
|
-
[
|
87
|
-
[
|
90
|
+
[false],
|
91
|
+
[0],
|
88
92
|
],
|
89
93
|
[
|
90
94
|
array.find_field(0).to_a,
|
@@ -126,8 +130,8 @@ class StructArrayBuilderTest < Test::Unit::TestCase
|
|
126
130
|
])
|
127
131
|
array = @builder.finish
|
128
132
|
assert_equal([
|
129
|
-
[
|
130
|
-
[
|
133
|
+
[false, true, false],
|
134
|
+
[0, 1, 2],
|
131
135
|
],
|
132
136
|
[
|
133
137
|
array.find_field(0).to_a,
|
@@ -148,8 +152,8 @@ class StructArrayBuilderTest < Test::Unit::TestCase
|
|
148
152
|
])
|
149
153
|
array = @builder.finish
|
150
154
|
assert_equal([
|
151
|
-
[true,
|
152
|
-
[1,
|
155
|
+
[true, false, true],
|
156
|
+
[1, 0, 3],
|
153
157
|
],
|
154
158
|
[
|
155
159
|
array.find_field(0).to_a,
|
data/test/test-struct-array.rb
CHANGED
@@ -265,6 +265,17 @@ module ValuesBasicArraysTests
|
|
265
265
|
target = build(Arrow::Decimal128Array.new(data_type, values))
|
266
266
|
assert_equal(values, target.values)
|
267
267
|
end
|
268
|
+
|
269
|
+
def test_decimal256
|
270
|
+
values = [
|
271
|
+
BigDecimal("92.92"),
|
272
|
+
nil,
|
273
|
+
BigDecimal("29.29"),
|
274
|
+
]
|
275
|
+
data_type = Arrow::Decimal256DataType.new(38, 2)
|
276
|
+
target = build(Arrow::Decimal256Array.new(data_type, values))
|
277
|
+
assert_equal(values, target.values)
|
278
|
+
end
|
268
279
|
end
|
269
280
|
|
270
281
|
class ValuesArrayBasicArraysTest < Test::Unit::TestCase
|
@@ -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({
|
@@ -361,10 +333,23 @@ module ValuesDenseUnionArrayTests
|
|
361
333
|
assert_equal(values, target.values)
|
362
334
|
end
|
363
335
|
|
336
|
+
def test_decimal256
|
337
|
+
values = [
|
338
|
+
{"0" => BigDecimal("92.92")},
|
339
|
+
{"1" => nil},
|
340
|
+
]
|
341
|
+
target = build({
|
342
|
+
type: :decimal256,
|
343
|
+
precision: 38,
|
344
|
+
scale: 2,
|
345
|
+
},
|
346
|
+
values)
|
347
|
+
assert_equal(values, target.values)
|
348
|
+
end
|
349
|
+
|
364
350
|
def test_list
|
365
351
|
values = [
|
366
352
|
{"0" => [true, nil, false]},
|
367
|
-
nil,
|
368
353
|
{"1" => nil},
|
369
354
|
]
|
370
355
|
target = build({
|
@@ -381,7 +366,6 @@ module ValuesDenseUnionArrayTests
|
|
381
366
|
def test_struct
|
382
367
|
values = [
|
383
368
|
{"0" => {"sub_field" => true}},
|
384
|
-
nil,
|
385
369
|
{"1" => nil},
|
386
370
|
{"0" => {"sub_field" => nil}},
|
387
371
|
]
|
@@ -402,7 +386,6 @@ module ValuesDenseUnionArrayTests
|
|
402
386
|
omit("Need to add support for SparseUnionArrayBuilder")
|
403
387
|
values = [
|
404
388
|
{"0" => {"field1" => true}},
|
405
|
-
nil,
|
406
389
|
{"1" => nil},
|
407
390
|
{"0" => {"field2" => nil}},
|
408
391
|
]
|
@@ -428,7 +411,6 @@ module ValuesDenseUnionArrayTests
|
|
428
411
|
omit("Need to add support for DenseUnionArrayBuilder")
|
429
412
|
values = [
|
430
413
|
{"0" => {"field1" => true}},
|
431
|
-
nil,
|
432
414
|
{"1" => nil},
|
433
415
|
{"0" => {"field2" => nil}},
|
434
416
|
]
|
@@ -454,7 +436,6 @@ module ValuesDenseUnionArrayTests
|
|
454
436
|
omit("Need to add support for DictionaryArrayBuilder")
|
455
437
|
values = [
|
456
438
|
{"0" => "Ruby"},
|
457
|
-
nil,
|
458
439
|
{"1" => nil},
|
459
440
|
{"0" => "GLib"},
|
460
441
|
]
|