red-arrow 8.0.0 → 24.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.
Files changed (178) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +15 -7
  3. data/ext/arrow/arrow.cpp +67 -0
  4. data/ext/arrow/converters.cpp +10 -0
  5. data/ext/arrow/converters.hpp +310 -46
  6. data/ext/arrow/extconf.rb +41 -22
  7. data/ext/arrow/raw-records.cpp +165 -2
  8. data/ext/arrow/red-arrow.hpp +2 -0
  9. data/ext/arrow/values.cpp +6 -2
  10. data/lib/arrow/array-builder.rb +89 -14
  11. data/{test/test-time32-data-type.rb → lib/arrow/array-computable.rb} +24 -16
  12. data/{test/test-buffer.rb → lib/arrow/array-statistics.rb} +19 -24
  13. data/lib/arrow/array.rb +40 -4
  14. data/lib/arrow/chunked-array.rb +56 -1
  15. data/lib/arrow/column-containable.rb +9 -0
  16. data/lib/arrow/column.rb +49 -4
  17. data/{test/test-tensor.rb → lib/arrow/csv-write-options.rb} +28 -31
  18. data/lib/arrow/data-type.rb +17 -3
  19. data/lib/arrow/decimal128-array-builder.rb +16 -6
  20. data/lib/arrow/decimal128.rb +14 -0
  21. data/lib/arrow/decimal256-array-builder.rb +16 -6
  22. data/lib/arrow/decimal256.rb +14 -0
  23. data/{test/test-float-scalar.rb → lib/arrow/dense-union-array-builder.rb} +27 -24
  24. data/{test/test-boolean-scalar.rb → lib/arrow/dense-union-array.rb} +7 -7
  25. data/lib/arrow/duration-array-builder.rb +27 -0
  26. data/lib/arrow/duration-array.rb +24 -0
  27. data/lib/arrow/duration-data-type.rb +32 -0
  28. data/lib/arrow/expression.rb +6 -2
  29. data/lib/arrow/field-containable.rb +1 -1
  30. data/lib/arrow/field.rb +44 -3
  31. data/lib/arrow/fixed-size-list-array-builder.rb +29 -0
  32. data/lib/arrow/fixed-size-list-data-type.rb +118 -0
  33. data/lib/arrow/function.rb +0 -1
  34. data/lib/arrow/half-float-array-builder.rb +32 -0
  35. data/lib/arrow/half-float-array.rb +24 -0
  36. data/lib/arrow/half-float.rb +118 -0
  37. data/{test/helper/fixture.rb → lib/arrow/input-referable.rb} +7 -6
  38. data/lib/arrow/jruby/array-builder.rb +114 -0
  39. data/lib/arrow/jruby/array.rb +109 -0
  40. data/lib/arrow/jruby/chunked-array.rb +36 -0
  41. data/lib/arrow/jruby/compression-type.rb +26 -0
  42. data/lib/arrow/jruby/csv-read-options.rb +32 -0
  43. data/{test/test-map-data-type.rb → lib/arrow/jruby/data-type.rb} +24 -12
  44. data/lib/arrow/jruby/decimal128.rb +28 -0
  45. data/lib/arrow/jruby/decimal256.rb +28 -0
  46. data/{test/fixture/float-integer.csv → lib/arrow/jruby/error.rb} +7 -4
  47. data/lib/arrow/jruby/file-system.rb +24 -0
  48. data/{test/test-null-array.rb → lib/arrow/jruby/function.rb} +5 -4
  49. data/lib/arrow/jruby/record-batch-iterator.rb +24 -0
  50. data/{test/fixture/null-with-double-quote.csv → lib/arrow/jruby/record-batch.rb} +8 -4
  51. data/{test/fixture/integer-float.csv → lib/arrow/jruby/sort-key.rb} +8 -4
  52. data/lib/arrow/jruby/sort-options.rb +24 -0
  53. data/lib/arrow/jruby/stream-listener-raw.rb +25 -0
  54. data/{test/test-rolling-window.rb → lib/arrow/jruby/table.rb} +19 -19
  55. data/lib/arrow/jruby/writable.rb +24 -0
  56. data/lib/arrow/jruby.rb +52 -0
  57. data/{test/test-date32-array.rb → lib/arrow/large-list-array-builder.rb} +10 -5
  58. data/lib/arrow/large-list-data-type.rb +83 -0
  59. data/lib/arrow/libraries.rb +140 -0
  60. data/lib/arrow/list-array-builder.rb +1 -68
  61. data/lib/arrow/list-data-type.rb +3 -38
  62. data/{test/test-dictionary-array.rb → lib/arrow/list-field-resolvable.rb} +26 -17
  63. data/lib/arrow/list-slice-options.rb +76 -0
  64. data/lib/arrow/list-values-appendable.rb +88 -0
  65. data/lib/arrow/loader.rb +15 -96
  66. data/{test/test-decimal128-array.rb → lib/arrow/make-struct-options.rb} +18 -18
  67. data/lib/arrow/raw-table-converter.rb +10 -3
  68. data/lib/arrow/raw-tensor-converter.rb +89 -0
  69. data/lib/arrow/record-batch-file-reader.rb +2 -0
  70. data/lib/arrow/record-batch-stream-reader.rb +2 -0
  71. data/lib/arrow/record-batch.rb +6 -2
  72. data/{test/fixture/null-without-double-quote.csv → lib/arrow/ruby.rb} +5 -4
  73. data/lib/arrow/scalar.rb +67 -0
  74. data/lib/arrow/slicer.rb +61 -0
  75. data/lib/arrow/sort-key.rb +3 -3
  76. data/lib/arrow/sparse-union-array-builder.rb +56 -0
  77. data/lib/arrow/sparse-union-array.rb +26 -0
  78. data/lib/arrow/stream-decoder.rb +29 -0
  79. data/{test/test-decimal256-data-type.rb → lib/arrow/stream-listener.rb} +25 -9
  80. data/lib/arrow/string-array-builder.rb +30 -0
  81. data/lib/arrow/struct-array-builder.rb +0 -5
  82. data/lib/arrow/table-formatter.rb +38 -8
  83. data/lib/arrow/table-list-formatter.rb +3 -3
  84. data/lib/arrow/table-loader.rb +11 -5
  85. data/lib/arrow/table-saver.rb +4 -3
  86. data/lib/arrow/table-table-formatter.rb +7 -0
  87. data/lib/arrow/table.rb +180 -33
  88. data/lib/arrow/tensor.rb +144 -0
  89. data/lib/arrow/time-unit.rb +31 -0
  90. data/lib/arrow/time32-array-builder.rb +2 -14
  91. data/lib/arrow/time32-data-type.rb +9 -38
  92. data/lib/arrow/time64-array-builder.rb +2 -14
  93. data/lib/arrow/time64-data-type.rb +9 -38
  94. data/lib/arrow/timestamp-array-builder.rb +3 -15
  95. data/lib/arrow/timestamp-data-type.rb +9 -34
  96. data/{test/test-date64-array.rb → lib/arrow/timestamp-parser.rb} +14 -6
  97. data/lib/arrow/union-array-builder.rb +59 -0
  98. data/lib/arrow/union-array.rb +26 -0
  99. data/lib/arrow/version.rb +1 -1
  100. data/lib/arrow.rb +2 -7
  101. data/red-arrow.gemspec +74 -11
  102. metadata +85 -210
  103. data/test/fixture/TestOrcFile.test1.orc +0 -0
  104. data/test/fixture/with-header-float.csv +0 -20
  105. data/test/fixture/with-header.csv +0 -20
  106. data/test/fixture/without-header-float.csv +0 -19
  107. data/test/fixture/without-header.csv +0 -19
  108. data/test/helper/omittable.rb +0 -36
  109. data/test/helper.rb +0 -30
  110. data/test/raw-records/test-basic-arrays.rb +0 -395
  111. data/test/raw-records/test-dense-union-array.rb +0 -521
  112. data/test/raw-records/test-list-array.rb +0 -610
  113. data/test/raw-records/test-map-array.rb +0 -478
  114. data/test/raw-records/test-multiple-columns.rb +0 -65
  115. data/test/raw-records/test-sparse-union-array.rb +0 -511
  116. data/test/raw-records/test-struct-array.rb +0 -515
  117. data/test/raw-records/test-table.rb +0 -47
  118. data/test/run-test.rb +0 -71
  119. data/test/test-array-builder.rb +0 -136
  120. data/test/test-array.rb +0 -325
  121. data/test/test-bigdecimal.rb +0 -40
  122. data/test/test-binary-dictionary-array-builder.rb +0 -103
  123. data/test/test-chunked-array.rb +0 -183
  124. data/test/test-column.rb +0 -92
  125. data/test/test-csv-loader.rb +0 -250
  126. data/test/test-data-type.rb +0 -83
  127. data/test/test-decimal128-array-builder.rb +0 -112
  128. data/test/test-decimal128-data-type.rb +0 -31
  129. data/test/test-decimal128.rb +0 -102
  130. data/test/test-decimal256-array-builder.rb +0 -112
  131. data/test/test-decimal256-array.rb +0 -38
  132. data/test/test-decimal256.rb +0 -102
  133. data/test/test-dense-union-data-type.rb +0 -41
  134. data/test/test-dictionary-data-type.rb +0 -40
  135. data/test/test-expression.rb +0 -40
  136. data/test/test-feather.rb +0 -49
  137. data/test/test-field.rb +0 -91
  138. data/test/test-file-output-stream.rb +0 -54
  139. data/test/test-fixed-size-binary-array-builder.rb +0 -92
  140. data/test/test-fixed-size-binary-array.rb +0 -36
  141. data/test/test-function.rb +0 -210
  142. data/test/test-group.rb +0 -180
  143. data/test/test-list-array-builder.rb +0 -79
  144. data/test/test-list-array.rb +0 -32
  145. data/test/test-list-data-type.rb +0 -69
  146. data/test/test-map-array-builder.rb +0 -110
  147. data/test/test-map-array.rb +0 -33
  148. data/test/test-memory-view.rb +0 -434
  149. data/test/test-orc.rb +0 -173
  150. data/test/test-record-batch-builder.rb +0 -125
  151. data/test/test-record-batch-file-reader.rb +0 -115
  152. data/test/test-record-batch-iterator.rb +0 -37
  153. data/test/test-record-batch-reader.rb +0 -46
  154. data/test/test-record-batch.rb +0 -182
  155. data/test/test-schema.rb +0 -134
  156. data/test/test-slicer.rb +0 -487
  157. data/test/test-sort-indices.rb +0 -40
  158. data/test/test-sort-key.rb +0 -81
  159. data/test/test-sort-options.rb +0 -58
  160. data/test/test-sparse-union-data-type.rb +0 -41
  161. data/test/test-string-dictionary-array-builder.rb +0 -103
  162. data/test/test-struct-array-builder.rb +0 -184
  163. data/test/test-struct-array.rb +0 -94
  164. data/test/test-struct-data-type.rb +0 -112
  165. data/test/test-table.rb +0 -1123
  166. data/test/test-time.rb +0 -288
  167. data/test/test-time32-array.rb +0 -81
  168. data/test/test-time64-array.rb +0 -81
  169. data/test/test-time64-data-type.rb +0 -42
  170. data/test/test-timestamp-array.rb +0 -45
  171. data/test/test-timestamp-data-type.rb +0 -42
  172. data/test/values/test-basic-arrays.rb +0 -325
  173. data/test/values/test-dense-union-array.rb +0 -509
  174. data/test/values/test-dictionary-array.rb +0 -295
  175. data/test/values/test-list-array.rb +0 -571
  176. data/test/values/test-map-array.rb +0 -466
  177. data/test/values/test-sparse-union-array.rb +0 -500
  178. data/test/values/test-struct-array.rb +0 -512
@@ -1,112 +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 Decimal128ArrayBuilderTest < Test::Unit::TestCase
19
- def setup
20
- @data_type = Arrow::Decimal128DataType.new(3, 1)
21
- @builder = Arrow::Decimal128ArrayBuilder.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("Arrow::Decimal128") do
32
- @builder.append_value(Arrow::Decimal128.new("10.1"))
33
- array = @builder.finish
34
- assert_equal(BigDecimal("10.1"),
35
- array[0])
36
- end
37
-
38
- test("String") do
39
- @builder.append_value("10.1")
40
- array = @builder.finish
41
- assert_equal(BigDecimal("10.1"),
42
- array[0])
43
- end
44
-
45
- test("Float") do
46
- @builder.append_value(10.1)
47
- array = @builder.finish
48
- assert_equal(BigDecimal("10.1"),
49
- array[0])
50
- end
51
-
52
- test("BigDecimal") do
53
- @builder.append_value(BigDecimal("10.1"))
54
- array = @builder.finish
55
- assert_equal(BigDecimal("10.1"),
56
- array[0])
57
- end
58
- end
59
-
60
- sub_test_case("#append_values") do
61
- test("mixed") do
62
- @builder.append_values([
63
- Arrow::Decimal128.new("10.1"),
64
- nil,
65
- "10.1",
66
- 10.1,
67
- BigDecimal("10.1"),
68
- ])
69
- array = @builder.finish
70
- assert_equal([
71
- BigDecimal("10.1"),
72
- nil,
73
- BigDecimal("10.1"),
74
- BigDecimal("10.1"),
75
- BigDecimal("10.1"),
76
- ],
77
- array.to_a)
78
- end
79
-
80
- test("is_valids") do
81
- @builder.append_values([
82
- Arrow::Decimal128.new("10.1"),
83
- Arrow::Decimal128.new("10.1"),
84
- Arrow::Decimal128.new("10.1"),
85
- ],
86
- [
87
- true,
88
- false,
89
- true,
90
- ])
91
- array = @builder.finish
92
- assert_equal([
93
- BigDecimal("10.1"),
94
- nil,
95
- BigDecimal("10.1"),
96
- ],
97
- array.to_a)
98
- end
99
-
100
- test("packed") do
101
- @builder.append_values(Arrow::Decimal128.new("10.1").to_bytes.to_s * 3,
102
- [true, false, true])
103
- array = @builder.finish
104
- assert_equal([
105
- BigDecimal("10.1"),
106
- nil,
107
- BigDecimal("10.1"),
108
- ],
109
- array.to_a)
110
- end
111
- end
112
- end
@@ -1,31 +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 Decimal128DataTypeTest < Test::Unit::TestCase
19
- sub_test_case(".new") do
20
- test("ordered arguments") do
21
- assert_equal("decimal128(8, 2)",
22
- Arrow::Decimal128DataType.new(8, 2).to_s)
23
- end
24
-
25
- test("description") do
26
- assert_equal("decimal128(8, 2)",
27
- Arrow::Decimal128DataType.new(precision: 8,
28
- scale: 2).to_s)
29
- end
30
- end
31
- end
@@ -1,102 +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 Decimal128Test < Test::Unit::TestCase
19
- sub_test_case("instance methods") do
20
- def setup
21
- @decimal128 = Arrow::Decimal128.new("10.1")
22
- end
23
-
24
- sub_test_case("#==") do
25
- test("Arrow::Decimal128") do
26
- assert do
27
- @decimal128 == @decimal128
28
- end
29
- end
30
-
31
- test("not Arrow::Decimal128") do
32
- assert do
33
- not (@decimal128 == 10.1)
34
- end
35
- end
36
- end
37
-
38
- sub_test_case("#!=") do
39
- test("Arrow::Decimal128") do
40
- assert do
41
- not (@decimal128 != @decimal128)
42
- end
43
- end
44
-
45
- test("not Arrow::Decimal128") do
46
- assert do
47
- @decimal128 != 10.1
48
- end
49
- end
50
- end
51
-
52
- sub_test_case("#to_s") do
53
- test("default") do
54
- assert_equal("101",
55
- @decimal128.to_s)
56
- end
57
-
58
- test("scale") do
59
- assert_equal("10.1",
60
- @decimal128.to_s(1))
61
- end
62
- end
63
-
64
- test("#abs") do
65
- decimal128 = Arrow::Decimal128.new("-10.1")
66
- assert_equal([
67
- Arrow::Decimal128.new("-10.1"),
68
- Arrow::Decimal128.new("10.1"),
69
- ],
70
- [
71
- decimal128,
72
- decimal128.abs,
73
- ])
74
- end
75
-
76
- test("#abs!") do
77
- decimal128 = Arrow::Decimal128.new("-10.1")
78
- decimal128.abs!
79
- assert_equal(Arrow::Decimal128.new("10.1"),
80
- decimal128)
81
- end
82
-
83
- test("#negate") do
84
- decimal128 = Arrow::Decimal128.new("-10.1")
85
- assert_equal([
86
- Arrow::Decimal128.new("-10.1"),
87
- Arrow::Decimal128.new("10.1"),
88
- ],
89
- [
90
- decimal128,
91
- decimal128.negate,
92
- ])
93
- end
94
-
95
- test("#negate!") do
96
- decimal128 = Arrow::Decimal128.new("-10.1")
97
- decimal128.negate!
98
- assert_equal(Arrow::Decimal128.new("10.1"),
99
- decimal128)
100
- end
101
- end
102
- end
@@ -1,112 +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 Decimal256ArrayBuilderTest < Test::Unit::TestCase
19
- def setup
20
- @data_type = Arrow::Decimal256DataType.new(3, 1)
21
- @builder = Arrow::Decimal256ArrayBuilder.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("Arrow::Decimal256") do
32
- @builder.append_value(Arrow::Decimal256.new("10.1"))
33
- array = @builder.finish
34
- assert_equal(BigDecimal("10.1"),
35
- array[0])
36
- end
37
-
38
- test("String") do
39
- @builder.append_value("10.1")
40
- array = @builder.finish
41
- assert_equal(BigDecimal("10.1"),
42
- array[0])
43
- end
44
-
45
- test("Float") do
46
- @builder.append_value(10.1)
47
- array = @builder.finish
48
- assert_equal(BigDecimal("10.1"),
49
- array[0])
50
- end
51
-
52
- test("BigDecimal") do
53
- @builder.append_value(BigDecimal("10.1"))
54
- array = @builder.finish
55
- assert_equal(BigDecimal("10.1"),
56
- array[0])
57
- end
58
- end
59
-
60
- sub_test_case("#append_values") do
61
- test("mixed") do
62
- @builder.append_values([
63
- Arrow::Decimal256.new("10.1"),
64
- nil,
65
- "10.1",
66
- 10.1,
67
- BigDecimal("10.1"),
68
- ])
69
- array = @builder.finish
70
- assert_equal([
71
- BigDecimal("10.1"),
72
- nil,
73
- BigDecimal("10.1"),
74
- BigDecimal("10.1"),
75
- BigDecimal("10.1"),
76
- ],
77
- array.to_a)
78
- end
79
-
80
- test("is_valids") do
81
- @builder.append_values([
82
- Arrow::Decimal256.new("10.1"),
83
- Arrow::Decimal256.new("10.1"),
84
- Arrow::Decimal256.new("10.1"),
85
- ],
86
- [
87
- true,
88
- false,
89
- true,
90
- ])
91
- array = @builder.finish
92
- assert_equal([
93
- BigDecimal("10.1"),
94
- nil,
95
- BigDecimal("10.1"),
96
- ],
97
- array.to_a)
98
- end
99
-
100
- test("packed") do
101
- @builder.append_values(Arrow::Decimal256.new("10.1").to_bytes.to_s * 3,
102
- [true, false, true])
103
- array = @builder.finish
104
- assert_equal([
105
- BigDecimal("10.1"),
106
- nil,
107
- BigDecimal("10.1"),
108
- ],
109
- array.to_a)
110
- end
111
- end
112
- end
@@ -1,38 +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 Decimal256ArrayTest < Test::Unit::TestCase
19
- sub_test_case(".new") do
20
- test("build") do
21
- data_type = Arrow::Decimal256DataType.new(3, 1)
22
- values = [
23
- 10.1,
24
- nil,
25
- "10.1",
26
- BigDecimal("10.1"),
27
- ]
28
- array = Arrow::Decimal256Array.new(data_type, values)
29
- assert_equal([
30
- BigDecimal("10.1"),
31
- nil,
32
- BigDecimal("10.1"),
33
- BigDecimal("10.1"),
34
- ],
35
- array.to_a)
36
- end
37
- end
38
- end
@@ -1,102 +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 Decimal256Test < Test::Unit::TestCase
19
- sub_test_case("instance methods") do
20
- def setup
21
- @decimal256 = Arrow::Decimal256.new("10.1")
22
- end
23
-
24
- sub_test_case("#==") do
25
- test("Arrow::Decimal256") do
26
- assert do
27
- @decimal256 == @decimal256
28
- end
29
- end
30
-
31
- test("not Arrow::Decimal256") do
32
- assert do
33
- not (@decimal256 == 10.1)
34
- end
35
- end
36
- end
37
-
38
- sub_test_case("#!=") do
39
- test("Arrow::Decimal256") do
40
- assert do
41
- not (@decimal256 != @decimal256)
42
- end
43
- end
44
-
45
- test("not Arrow::Decimal256") do
46
- assert do
47
- @decimal256 != 10.1
48
- end
49
- end
50
- end
51
-
52
- sub_test_case("#to_s") do
53
- test("default") do
54
- assert_equal("101",
55
- @decimal256.to_s)
56
- end
57
-
58
- test("scale") do
59
- assert_equal("10.1",
60
- @decimal256.to_s(1))
61
- end
62
- end
63
-
64
- test("#abs") do
65
- decimal256 = Arrow::Decimal256.new("-10.1")
66
- assert_equal([
67
- Arrow::Decimal256.new("-10.1"),
68
- Arrow::Decimal256.new("10.1"),
69
- ],
70
- [
71
- decimal256,
72
- decimal256.abs,
73
- ])
74
- end
75
-
76
- test("#abs!") do
77
- decimal256 = Arrow::Decimal256.new("-10.1")
78
- decimal256.abs!
79
- assert_equal(Arrow::Decimal256.new("10.1"),
80
- decimal256)
81
- end
82
-
83
- test("#negate") do
84
- decimal256 = Arrow::Decimal256.new("-10.1")
85
- assert_equal([
86
- Arrow::Decimal256.new("-10.1"),
87
- Arrow::Decimal256.new("10.1"),
88
- ],
89
- [
90
- decimal256,
91
- decimal256.negate,
92
- ])
93
- end
94
-
95
- test("#negate!") do
96
- decimal256 = Arrow::Decimal256.new("-10.1")
97
- decimal256.negate!
98
- assert_equal(Arrow::Decimal256.new("10.1"),
99
- decimal256)
100
- end
101
- end
102
- end
@@ -1,41 +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 DenseUnionDataTypeTest < Test::Unit::TestCase
19
- sub_test_case(".new") do
20
- def setup
21
- @fields = [
22
- Arrow::Field.new("visible", :boolean),
23
- {
24
- name: "count",
25
- type: :int32,
26
- },
27
- ]
28
- end
29
-
30
- test("ordered arguments") do
31
- assert_equal("dense_union<visible: bool=2, count: int32=9>",
32
- Arrow::DenseUnionDataType.new(@fields, [2, 9]).to_s)
33
- end
34
-
35
- test("description") do
36
- assert_equal("dense_union<visible: bool=2, count: int32=9>",
37
- Arrow::DenseUnionDataType.new(fields: @fields,
38
- type_codes: [2, 9]).to_s)
39
- end
40
- end
41
- end
@@ -1,40 +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 DictionaryDataTypeTest < Test::Unit::TestCase
19
- sub_test_case(".new") do
20
- def setup
21
- @index_data_type = :int8
22
- @value_data_type = :string
23
- @ordered = true
24
- end
25
-
26
- test("ordered arguments") do
27
- assert_equal("dictionary<values=string, indices=int8, ordered=1>",
28
- Arrow::DictionaryDataType.new(@index_data_type,
29
- @value_data_type,
30
- @ordered).to_s)
31
- end
32
-
33
- test("description") do
34
- assert_equal("dictionary<values=string, indices=int8, ordered=1>",
35
- Arrow::DictionaryDataType.new(index_data_type: @index_data_type,
36
- value_data_type: @value_data_type,
37
- ordered: @ordered).to_s)
38
- end
39
- end
40
- end
@@ -1,40 +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 TestExpression < Test::Unit::TestCase
19
- sub_test_case(".try_convert") do
20
- test("Symbol") do
21
- assert_equal(Arrow::FieldExpression.new("visible"),
22
- Arrow::Expression.try_convert(:visible))
23
- end
24
-
25
- test("[String]") do
26
- assert_equal(Arrow::CallExpression.new("func", []),
27
- Arrow::Expression.try_convert(["func"]))
28
- end
29
-
30
- test("[Symbol]") do
31
- assert_equal(Arrow::CallExpression.new("func", []),
32
- Arrow::Expression.try_convert([:func]))
33
- end
34
-
35
- test("[String, String]") do
36
- assert_equal(Arrow::CallExpression.new("func", ["argument1"]),
37
- Arrow::Expression.try_convert(["func", "argument1"]))
38
- end
39
- end
40
- end
data/test/test-feather.rb DELETED
@@ -1,49 +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 FeatherTest < Test::Unit::TestCase
19
- include Helper::Fixture
20
-
21
- def setup
22
- columns = {
23
- "message" => Arrow::StringArray.new(["Start", "Crash", "Shutdown"]),
24
- "is_critical" => Arrow::BooleanArray.new([false, true, false]),
25
- }
26
- @table = Arrow::Table.new(columns)
27
-
28
- @output = Tempfile.new(["red-arrow", ".feather"])
29
- begin
30
- yield(@output)
31
- ensure
32
- @output.close!
33
- end
34
- end
35
-
36
- def test_default
37
- @table.save(@output.path)
38
- @output.close
39
-
40
- assert_equal(@table, Arrow::Table.load(@output.path))
41
- end
42
-
43
- def test_compression
44
- @table.save(@output.path, compression: :zstd)
45
- @output.close
46
-
47
- assert_equal(@table, Arrow::Table.load(@output.path))
48
- end
49
- end