red-arrow 18.1.0 → 19.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (133) hide show
  1. checksums.yaml +4 -4
  2. data/lib/arrow/array.rb +7 -4
  3. data/lib/arrow/column.rb +4 -4
  4. data/lib/arrow/jruby/array-builder.rb +114 -0
  5. data/lib/arrow/jruby/array.rb +109 -0
  6. data/{test/helper/fixture.rb → lib/arrow/jruby/chunked-array.rb} +14 -6
  7. data/lib/arrow/jruby/compression-type.rb +26 -0
  8. data/{test/test-boolean-scalar.rb → lib/arrow/jruby/csv-read-options.rb} +12 -6
  9. data/{test/test-map-data-type.rb → lib/arrow/jruby/data-type.rb} +24 -12
  10. data/lib/arrow/jruby/decimal128.rb +28 -0
  11. data/lib/arrow/jruby/decimal256.rb +28 -0
  12. data/{test/fixture/null-with-double-quote.csv → lib/arrow/jruby/error.rb} +7 -4
  13. data/lib/arrow/jruby/file-system.rb +24 -0
  14. data/{test/test-null-array.rb → lib/arrow/jruby/function.rb} +5 -4
  15. data/lib/arrow/jruby/record-batch-iterator.rb +24 -0
  16. data/{test/fixture/integer-float.csv → lib/arrow/jruby/record-batch.rb} +8 -4
  17. data/{test/fixture/float-integer.csv → lib/arrow/jruby/sort-key.rb} +8 -4
  18. data/lib/arrow/jruby/sort-options.rb +24 -0
  19. data/lib/arrow/jruby/stream-listener-raw.rb +25 -0
  20. data/{test/test-rolling-window.rb → lib/arrow/jruby/table.rb} +19 -19
  21. data/lib/arrow/jruby/writable.rb +24 -0
  22. data/lib/arrow/jruby.rb +52 -0
  23. data/lib/arrow/libraries.rb +126 -0
  24. data/lib/arrow/list-array-builder.rb +1 -0
  25. data/lib/arrow/loader.rb +3 -111
  26. data/{test/fixture/null-without-double-quote.csv → lib/arrow/ruby.rb} +6 -4
  27. data/lib/arrow/version.rb +1 -1
  28. data/lib/arrow.rb +2 -7
  29. data/red-arrow.gemspec +15 -6
  30. metadata +26 -229
  31. data/test/each-raw-record/test-basic-arrays.rb +0 -411
  32. data/test/each-raw-record/test-dense-union-array.rb +0 -566
  33. data/test/each-raw-record/test-dictionary-array.rb +0 -341
  34. data/test/each-raw-record/test-list-array.rb +0 -628
  35. data/test/each-raw-record/test-map-array.rb +0 -507
  36. data/test/each-raw-record/test-multiple-columns.rb +0 -72
  37. data/test/each-raw-record/test-sparse-union-array.rb +0 -528
  38. data/test/each-raw-record/test-struct-array.rb +0 -529
  39. data/test/each-raw-record/test-table.rb +0 -47
  40. data/test/fixture/TestOrcFile.test1.orc +0 -0
  41. data/test/fixture/with-header-float.csv +0 -20
  42. data/test/fixture/with-header.csv +0 -20
  43. data/test/fixture/without-header-float.csv +0 -19
  44. data/test/fixture/without-header.csv +0 -19
  45. data/test/helper/omittable.rb +0 -49
  46. data/test/helper.rb +0 -31
  47. data/test/raw-records/test-basic-arrays.rb +0 -405
  48. data/test/raw-records/test-dense-union-array.rb +0 -566
  49. data/test/raw-records/test-dictionary-array.rb +0 -341
  50. data/test/raw-records/test-list-array.rb +0 -628
  51. data/test/raw-records/test-map-array.rb +0 -507
  52. data/test/raw-records/test-multiple-columns.rb +0 -65
  53. data/test/raw-records/test-sparse-union-array.rb +0 -556
  54. data/test/raw-records/test-struct-array.rb +0 -529
  55. data/test/raw-records/test-table.rb +0 -47
  56. data/test/run-test.rb +0 -71
  57. data/test/test-array-builder.rb +0 -198
  58. data/test/test-array.rb +0 -332
  59. data/test/test-bigdecimal.rb +0 -40
  60. data/test/test-binary-dictionary-array-builder.rb +0 -103
  61. data/test/test-buffer.rb +0 -49
  62. data/test/test-chunked-array.rb +0 -198
  63. data/test/test-column.rb +0 -123
  64. data/test/test-csv-loader.rb +0 -297
  65. data/test/test-data-type.rb +0 -84
  66. data/test/test-date32-array.rb +0 -24
  67. data/test/test-date64-array.rb +0 -25
  68. data/test/test-decimal128-array-builder.rb +0 -126
  69. data/test/test-decimal128-array.rb +0 -47
  70. data/test/test-decimal128-data-type.rb +0 -31
  71. data/test/test-decimal128.rb +0 -126
  72. data/test/test-decimal256-array-builder.rb +0 -126
  73. data/test/test-decimal256-array.rb +0 -47
  74. data/test/test-decimal256-data-type.rb +0 -31
  75. data/test/test-decimal256.rb +0 -126
  76. data/test/test-dense-union-array.rb +0 -42
  77. data/test/test-dense-union-data-type.rb +0 -41
  78. data/test/test-dictionary-array.rb +0 -41
  79. data/test/test-dictionary-data-type.rb +0 -40
  80. data/test/test-expression.rb +0 -51
  81. data/test/test-feather.rb +0 -49
  82. data/test/test-field.rb +0 -117
  83. data/test/test-file-output-stream.rb +0 -54
  84. data/test/test-fixed-size-binary-array-builder.rb +0 -92
  85. data/test/test-fixed-size-binary-array.rb +0 -36
  86. data/test/test-float-scalar.rb +0 -46
  87. data/test/test-function.rb +0 -210
  88. data/test/test-group.rb +0 -193
  89. data/test/test-half-float-array.rb +0 -43
  90. data/test/test-half-float.rb +0 -130
  91. data/test/test-list-array-builder.rb +0 -79
  92. data/test/test-list-array.rb +0 -32
  93. data/test/test-list-data-type.rb +0 -69
  94. data/test/test-map-array-builder.rb +0 -110
  95. data/test/test-map-array.rb +0 -33
  96. data/test/test-memory-view.rb +0 -434
  97. data/test/test-orc.rb +0 -173
  98. data/test/test-ractor.rb +0 -34
  99. data/test/test-record-batch-builder.rb +0 -125
  100. data/test/test-record-batch-file-reader.rb +0 -136
  101. data/test/test-record-batch-iterator.rb +0 -37
  102. data/test/test-record-batch-reader.rb +0 -46
  103. data/test/test-record-batch-stream-reader.rb +0 -129
  104. data/test/test-record-batch.rb +0 -182
  105. data/test/test-scalar.rb +0 -65
  106. data/test/test-schema.rb +0 -134
  107. data/test/test-slicer.rb +0 -589
  108. data/test/test-sort-indices.rb +0 -40
  109. data/test/test-sort-key.rb +0 -81
  110. data/test/test-sort-options.rb +0 -58
  111. data/test/test-sparse-union-array.rb +0 -38
  112. data/test/test-sparse-union-data-type.rb +0 -41
  113. data/test/test-stream-listener.rb +0 -60
  114. data/test/test-string-dictionary-array-builder.rb +0 -103
  115. data/test/test-struct-array-builder.rb +0 -184
  116. data/test/test-struct-array.rb +0 -94
  117. data/test/test-struct-data-type.rb +0 -112
  118. data/test/test-table.rb +0 -1530
  119. data/test/test-tensor.rb +0 -297
  120. data/test/test-time.rb +0 -288
  121. data/test/test-time32-array.rb +0 -81
  122. data/test/test-time32-data-type.rb +0 -42
  123. data/test/test-time64-array.rb +0 -81
  124. data/test/test-time64-data-type.rb +0 -42
  125. data/test/test-timestamp-array.rb +0 -45
  126. data/test/test-timestamp-data-type.rb +0 -42
  127. data/test/values/test-basic-arrays.rb +0 -335
  128. data/test/values/test-dense-union-array.rb +0 -552
  129. data/test/values/test-dictionary-array.rb +0 -325
  130. data/test/values/test-list-array.rb +0 -587
  131. data/test/values/test-map-array.rb +0 -489
  132. data/test/values/test-sparse-union-array.rb +0 -543
  133. data/test/values/test-struct-array.rb +0 -524
@@ -1,81 +0,0 @@
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 Time64ArrayTest < Test::Unit::TestCase
19
- sub_test_case(".new") do
20
- sub_test_case("unit") do
21
- test("Arrow::TimeUnit") do
22
- values = [1000 * 10, nil]
23
- array = Arrow::Time64Array.new(Arrow::TimeUnit::NANO, values)
24
- assert_equal([
25
- "time64[ns]",
26
- [
27
- Arrow::Time.new(Arrow::TimeUnit::NANO,
28
- 1000 * 10),
29
- nil,
30
- ],
31
- ],
32
- [
33
- array.value_data_type.to_s,
34
- array.to_a,
35
- ])
36
- end
37
-
38
- test("Symbol") do
39
- values = [1000 * 10, nil]
40
- array = Arrow::Time64Array.new(:micro, values)
41
- assert_equal([
42
- "time64[us]",
43
- [
44
- Arrow::Time.new(Arrow::TimeUnit::MICRO,
45
- 1000 * 10),
46
- nil,
47
- ],
48
- ],
49
- [
50
- array.value_data_type.to_s,
51
- array.to_a,
52
- ])
53
- end
54
- end
55
-
56
- sub_test_case("values") do
57
- test("Arrow::Time") do
58
- data_type = Arrow::Time64DataType.new(:nano)
59
- values = [
60
- Arrow::Time.new(Arrow::TimeUnit::NANO,
61
- 1000 * 10),
62
- nil,
63
- ]
64
- array = Arrow::Time64Array.new(data_type, values)
65
- assert_equal(values, array.to_a)
66
- end
67
-
68
- test("Integer") do
69
- data_type = Arrow::Time64DataType.new(:nano)
70
- values = [1000 * 10, nil]
71
- array = Arrow::Time64Array.new(data_type, values)
72
- assert_equal([
73
- Arrow::Time.new(Arrow::TimeUnit::NANO,
74
- 1000 * 10),
75
- nil,
76
- ],
77
- array.to_a)
78
- end
79
- end
80
- end
81
- end
@@ -1,42 +0,0 @@
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 Time64DataTypeTest < Test::Unit::TestCase
19
- sub_test_case(".new") do
20
- test("Arrow::TimeUnit") do
21
- assert_equal("time64[ns]",
22
- Arrow::Time64DataType.new(Arrow::TimeUnit::NANO).to_s)
23
- end
24
-
25
- test("Symbol") do
26
- assert_equal("time64[ns]",
27
- Arrow::Time64DataType.new(:nano).to_s)
28
- end
29
-
30
- test("unit: Arrow::TimeUnit") do
31
- data_type = Arrow::Time64DataType.new(unit: Arrow::TimeUnit::NANO)
32
- assert_equal("time64[ns]",
33
- data_type.to_s)
34
- end
35
-
36
- test("unit: Symbol") do
37
- data_type = Arrow::Time64DataType.new(unit: :nano)
38
- assert_equal("time64[ns]",
39
- data_type.to_s)
40
- end
41
- end
42
- end
@@ -1,45 +0,0 @@
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 TimestampArrayTest < Test::Unit::TestCase
19
- test("#[]") do
20
- sec = 1513267750
21
- usec = 914509
22
- array = Arrow::TimestampArray.new(:micro, [sec * (10 ** 6) + usec])
23
- time = Time.at(sec, usec)
24
- assert_equal(time, array[0])
25
- end
26
-
27
- sub_test_case("#is_in") do
28
- def setup
29
- values = [
30
- Time.parse("2019-11-18T00:09:11"),
31
- Time.parse("2019-11-18T00:09:12"),
32
- Time.parse("2019-11-18T00:09:13"),
33
- ]
34
- @array = Arrow::TimestampArray.new(:micro, values)
35
- end
36
-
37
- test("Arrow: Array") do
38
- right = [
39
- Time.parse("2019-11-18T00:09:12"),
40
- ]
41
- assert_equal(Arrow::BooleanArray.new([false, true, false]),
42
- @array.is_in(right))
43
- end
44
- end
45
- end
@@ -1,42 +0,0 @@
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 TimestampDataTypeTest < Test::Unit::TestCase
19
- sub_test_case(".new") do
20
- test("Arrow::TimeUnit") do
21
- assert_equal("timestamp[ms]",
22
- Arrow::TimestampDataType.new(Arrow::TimeUnit::MILLI).to_s)
23
- end
24
-
25
- test("Symbol") do
26
- assert_equal("timestamp[ms]",
27
- Arrow::TimestampDataType.new(:milli).to_s)
28
- end
29
-
30
- test("unit: Arrow::TimeUnit") do
31
- data_type = Arrow::TimestampDataType.new(unit: Arrow::TimeUnit::MILLI)
32
- assert_equal("timestamp[ms]",
33
- data_type.to_s)
34
- end
35
-
36
- test("unit: Symbol") do
37
- data_type = Arrow::TimestampDataType.new(unit: :milli)
38
- assert_equal("timestamp[ms]",
39
- data_type.to_s)
40
- end
41
- end
42
- end
@@ -1,335 +0,0 @@
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 ValuesBasicArraysTests
19
- def test_null
20
- target = build(Arrow::NullArray.new(4))
21
- assert_equal([nil] * 4, target.values)
22
- end
23
-
24
- def test_boolean
25
- values = [true, nil, false]
26
- target = build(Arrow::BooleanArray.new(values))
27
- assert_equal(values, target.values)
28
- end
29
-
30
- def test_int8
31
- values = [
32
- -(2 ** 7),
33
- nil,
34
- (2 ** 7) - 1,
35
- ]
36
- target = build(Arrow::Int8Array.new(values))
37
- assert_equal(values, target.values)
38
- end
39
-
40
- def test_uint8
41
- values = [
42
- 0,
43
- nil,
44
- (2 ** 8) - 1,
45
- ]
46
- target = build(Arrow::UInt8Array.new(values))
47
- assert_equal(values, target.values)
48
- end
49
-
50
- def test_int16
51
- values = [
52
- -(2 ** 15),
53
- nil,
54
- (2 ** 15) - 1,
55
- ]
56
- target = build(Arrow::Int16Array.new(values))
57
- assert_equal(values, target.values)
58
- end
59
-
60
- def test_uint16
61
- values = [
62
- 0,
63
- nil,
64
- (2 ** 16) - 1,
65
- ]
66
- target = build(Arrow::UInt16Array.new(values))
67
- assert_equal(values, target.values)
68
- end
69
-
70
- def test_int32
71
- values = [
72
- -(2 ** 31),
73
- nil,
74
- (2 ** 31) - 1,
75
- ]
76
- target = build(Arrow::Int32Array.new(values))
77
- assert_equal(values, target.values)
78
- end
79
-
80
- def test_uint32
81
- values = [
82
- 0,
83
- nil,
84
- (2 ** 32) - 1,
85
- ]
86
- target = build(Arrow::UInt32Array.new(values))
87
- assert_equal(values, target.values)
88
- end
89
-
90
- def test_int64
91
- values = [
92
- -(2 ** 63),
93
- nil,
94
- (2 ** 63) - 1,
95
- ]
96
- target = build(Arrow::Int64Array.new(values))
97
- assert_equal(values, target.values)
98
- end
99
-
100
- def test_uint64
101
- values = [
102
- 0,
103
- nil,
104
- (2 ** 64) - 1,
105
- ]
106
- target = build(Arrow::UInt64Array.new(values))
107
- assert_equal(values, target.values)
108
- end
109
-
110
- def test_half_float
111
- values = [
112
- -1.5,
113
- nil,
114
- 1.5,
115
- ]
116
- target = build(Arrow::HalfFloatArray.new(values))
117
- assert_equal(values, target.values)
118
- end
119
-
120
- def test_float
121
- values = [
122
- -1.0,
123
- nil,
124
- 1.0,
125
- ]
126
- target = build(Arrow::FloatArray.new(values))
127
- assert_equal(values, target.values)
128
- end
129
-
130
- def test_double
131
- values = [
132
- -1.0,
133
- nil,
134
- 1.0,
135
- ]
136
- target = build(Arrow::DoubleArray.new(values))
137
- assert_equal(values, target.values)
138
- end
139
-
140
- def test_binary
141
- values = [
142
- "\x00".b,
143
- nil,
144
- "\xff".b,
145
- ]
146
- target = build(Arrow::BinaryArray.new(values))
147
- assert_equal(values, target.values)
148
- end
149
-
150
- def test_tring
151
- values = [
152
- "Ruby",
153
- nil,
154
- "\u3042", # U+3042 HIRAGANA LETTER A
155
- ]
156
- target = build(Arrow::StringArray.new(values))
157
- assert_equal(values, target.values)
158
- end
159
-
160
- def test_date32
161
- values = [
162
- Date.new(1960, 1, 1),
163
- nil,
164
- Date.new(2017, 8, 23),
165
- ]
166
- target = build(Arrow::Date32Array.new(values))
167
- assert_equal(values, target.values)
168
- end
169
-
170
- def test_date64
171
- values = [
172
- DateTime.new(1960, 1, 1, 2, 9, 30),
173
- nil,
174
- DateTime.new(2017, 8, 23, 14, 57, 2),
175
- ]
176
- target = build(Arrow::Date64Array.new(values))
177
- assert_equal(values, target.values)
178
- end
179
-
180
- def test_timestamp_second
181
- values = [
182
- Time.parse("1960-01-01T02:09:30Z"),
183
- nil,
184
- Time.parse("2017-08-23T14:57:02Z"),
185
- ]
186
- target = build(Arrow::TimestampArray.new(:second, values))
187
- assert_equal(values, target.values)
188
- end
189
-
190
- def test_timestamp_milli
191
- values = [
192
- Time.parse("1960-01-01T02:09:30.123Z"),
193
- nil,
194
- Time.parse("2017-08-23T14:57:02.987Z"),
195
- ]
196
- target = build(Arrow::TimestampArray.new(:milli, values))
197
- assert_equal(values, target.values)
198
- end
199
-
200
- def test_timestamp_micro
201
- values = [
202
- Time.parse("1960-01-01T02:09:30.123456Z"),
203
- nil,
204
- Time.parse("2017-08-23T14:57:02.987654Z"),
205
- ]
206
- target = build(Arrow::TimestampArray.new(:micro, values))
207
- assert_equal(values, target.values)
208
- end
209
-
210
- def test_timestamp_nano
211
- values = [
212
- Time.parse("1960-01-01T02:09:30.123456789Z"),
213
- nil,
214
- Time.parse("2017-08-23T14:57:02.987654321Z"),
215
- ]
216
- target = build(Arrow::TimestampArray.new(:nano, values))
217
- assert_equal(values, target.values)
218
- end
219
-
220
- def test_time32_second
221
- unit = Arrow::TimeUnit::SECOND
222
- values = [
223
- Arrow::Time.new(unit, 60 * 10), # 00:10:00
224
- nil,
225
- Arrow::Time.new(unit, 60 * 60 * 2 + 9), # 02:00:09
226
- ]
227
- target = build(Arrow::Time32Array.new(:second, values))
228
- assert_equal(values, target.values)
229
- end
230
-
231
- def test_time32_milli
232
- unit = Arrow::TimeUnit::MILLI
233
- values = [
234
- Arrow::Time.new(unit, (60 * 10) * 1000 + 123), # 00:10:00.123
235
- nil,
236
- Arrow::Time.new(unit, (60 * 60 * 2 + 9) * 1000 + 987), # 02:00:09.987
237
- ]
238
- target = build(Arrow::Time32Array.new(:milli, values))
239
- assert_equal(values, target.values)
240
- end
241
-
242
- def test_time64_micro
243
- unit = Arrow::TimeUnit::MICRO
244
- values = [
245
- # 00:10:00.123456
246
- Arrow::Time.new(unit, (60 * 10) * 1_000_000 + 123_456),
247
- nil,
248
- # 02:00:09.987654
249
- Arrow::Time.new(unit, (60 * 60 * 2 + 9) * 1_000_000 + 987_654),
250
- ]
251
- target = build(Arrow::Time64Array.new(:micro, values))
252
- assert_equal(values, target.values)
253
- end
254
-
255
- def test_time64_nano
256
- unit = Arrow::TimeUnit::NANO
257
- values = [
258
- # 00:10:00.123456789
259
- Arrow::Time.new(unit, (60 * 10) * 1_000_000_000 + 123_456_789),
260
- nil,
261
- # 02:00:09.987654321
262
- Arrow::Time.new(unit, (60 * 60 * 2 + 9) * 1_000_000_000 + 987_654_321),
263
- ]
264
- target = build(Arrow::Time64Array.new(:nano, values))
265
- assert_equal(values, target.values)
266
- end
267
-
268
- def test_decimal128
269
- values = [
270
- BigDecimal("92.92"),
271
- nil,
272
- BigDecimal("29.29"),
273
- ]
274
- data_type = Arrow::Decimal128DataType.new(8, 2)
275
- target = build(Arrow::Decimal128Array.new(data_type, values))
276
- assert_equal(values, target.values)
277
- end
278
-
279
- def test_decimal256
280
- values = [
281
- BigDecimal("92.92"),
282
- nil,
283
- BigDecimal("29.29"),
284
- ]
285
- data_type = Arrow::Decimal256DataType.new(38, 2)
286
- target = build(Arrow::Decimal256Array.new(data_type, values))
287
- assert_equal(values, target.values)
288
- end
289
-
290
- def test_month_interval
291
- values = [
292
- 1,
293
- nil,
294
- 12,
295
- ]
296
- target = build(Arrow::MonthIntervalArray.new(values))
297
- assert_equal(values, target.values)
298
- end
299
-
300
- def test_day_time_interval
301
- values = [
302
- {day: 1, millisecond: 100},
303
- nil,
304
- {day: 2, millisecond: 300},
305
- ]
306
- target = build(Arrow::DayTimeIntervalArray.new(values))
307
- assert_equal(values, target.values)
308
- end
309
-
310
- def test_month_day_nano_interval
311
- values = [
312
- {month: 1, day: 1, nanosecond: 100},
313
- nil,
314
- {month: 2, day: 3, nanosecond: 400},
315
- ]
316
- target = build(Arrow::MonthDayNanoIntervalArray.new(values))
317
- assert_equal(values, target.values)
318
- end
319
- end
320
-
321
- class ValuesArrayBasicArraysTest < Test::Unit::TestCase
322
- include ValuesBasicArraysTests
323
-
324
- def build(array)
325
- array
326
- end
327
- end
328
-
329
- class ValuesChunkedArrayBasicArraysTest < Test::Unit::TestCase
330
- include ValuesBasicArraysTests
331
-
332
- def build(array)
333
- Arrow::ChunkedArray.new([array])
334
- end
335
- end