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
@@ -0,0 +1,28 @@
1
+ # Licensed to the Apache Software Foundation (ASF) under one
2
+ # or more contributor license agreements. See the NOTICE file
3
+ # distributed with this work for additional information
4
+ # regarding copyright ownership. The ASF licenses this file
5
+ # to you under the Apache License, Version 2.0 (the
6
+ # "License"); you may not use this file except in compliance
7
+ # with the License. You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing,
12
+ # software distributed under the License is distributed on an
13
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ # KIND, either express or implied. See the License for the
15
+ # specific language governing permissions and limitations
16
+ # under the License.
17
+
18
+ module Arrow
19
+ class Decimal128
20
+ def abs
21
+ raise NotImplementedError
22
+ end
23
+
24
+ def negate
25
+ raise NotImplementedError
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,28 @@
1
+ # Licensed to the Apache Software Foundation (ASF) under one
2
+ # or more contributor license agreements. See the NOTICE file
3
+ # distributed with this work for additional information
4
+ # regarding copyright ownership. The ASF licenses this file
5
+ # to you under the Apache License, Version 2.0 (the
6
+ # "License"); you may not use this file except in compliance
7
+ # with the License. You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing,
12
+ # software distributed under the License is distributed on an
13
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ # KIND, either express or implied. See the License for the
15
+ # specific language governing permissions and limitations
16
+ # under the License.
17
+
18
+ module Arrow
19
+ class Decimal256
20
+ def abs
21
+ raise NotImplementedError
22
+ end
23
+
24
+ def negate
25
+ raise NotImplementedError
26
+ end
27
+ end
28
+ end
@@ -14,7 +14,10 @@
14
14
  # KIND, either express or implied. See the License for the
15
15
  # specific language governing permissions and limitations
16
16
  # under the License.
17
- score
18
- 2.9
19
- 10
20
- -1.1
17
+
18
+ module Arrow
19
+ class Error < StandardError
20
+ class Invalid < Error
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,24 @@
1
+ # Licensed to the Apache Software Foundation (ASF) under one
2
+ # or more contributor license agreements. See the NOTICE file
3
+ # distributed with this work for additional information
4
+ # regarding copyright ownership. The ASF licenses this file
5
+ # to you under the Apache License, Version 2.0 (the
6
+ # "License"); you may not use this file except in compliance
7
+ # with the License. You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing,
12
+ # software distributed under the License is distributed on an
13
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ # KIND, either express or implied. See the License for the
15
+ # specific language governing permissions and limitations
16
+ # under the License.
17
+
18
+ module Arrow
19
+ class FileSystem
20
+ def open_output_stream(path)
21
+ raise NotImplementedError
22
+ end
23
+ end
24
+ end
@@ -15,9 +15,10 @@
15
15
  # specific language governing permissions and limitations
16
16
  # under the License.
17
17
 
18
- class NullArrayTest < Test::Unit::TestCase
19
- test("#[]") do
20
- array = Arrow::NullArray.new(1)
21
- assert_nil(array[0])
18
+ module Arrow
19
+ class Function
20
+ def execute(args, options=nil, context=nil)
21
+ raise NotImplementedError
22
+ end
22
23
  end
23
24
  end
@@ -0,0 +1,24 @@
1
+ # Licensed to the Apache Software Foundation (ASF) under one
2
+ # or more contributor license agreements. See the NOTICE file
3
+ # distributed with this work for additional information
4
+ # regarding copyright ownership. The ASF licenses this file
5
+ # to you under the Apache License, Version 2.0 (the
6
+ # "License"); you may not use this file except in compliance
7
+ # with the License. You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing,
12
+ # software distributed under the License is distributed on an
13
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ # KIND, either express or implied. See the License for the
15
+ # specific language governing permissions and limitations
16
+ # under the License.
17
+
18
+ module Arrow
19
+ class RecordBatchIterator
20
+ def to_list
21
+ raise NotImplementedError
22
+ end
23
+ end
24
+ end
@@ -14,7 +14,11 @@
14
14
  # KIND, either express or implied. See the License for the
15
15
  # specific language governing permissions and limitations
16
16
  # under the License.
17
- name,score
18
- alice,10
19
- bob,""
20
- chris,-1
17
+
18
+ module Arrow
19
+ class RecordBatch
20
+ def n_rows
21
+ raise NotImplementedError
22
+ end
23
+ end
24
+ end
@@ -14,7 +14,11 @@
14
14
  # KIND, either express or implied. See the License for the
15
15
  # specific language governing permissions and limitations
16
16
  # under the License.
17
- score
18
- 10
19
- 2.9
20
- -1.1
17
+
18
+ module Arrow
19
+ class SortKey
20
+ def target
21
+ raise NotImplementedError
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,24 @@
1
+ # Licensed to the Apache Software Foundation (ASF) under one
2
+ # or more contributor license agreements. See the NOTICE file
3
+ # distributed with this work for additional information
4
+ # regarding copyright ownership. The ASF licenses this file
5
+ # to you under the Apache License, Version 2.0 (the
6
+ # "License"); you may not use this file except in compliance
7
+ # with the License. You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing,
12
+ # software distributed under the License is distributed on an
13
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ # KIND, either express or implied. See the License for the
15
+ # specific language governing permissions and limitations
16
+ # under the License.
17
+
18
+ module Arrow
19
+ class SortOptions
20
+ def add_sort_key(target, order=nil)
21
+ raise NotImplementedError
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,25 @@
1
+ # Licensed to the Apache Software Foundation (ASF) under one
2
+ # or more contributor license agreements. See the NOTICE file
3
+ # distributed with this work for additional information
4
+ # regarding copyright ownership. The ASF licenses this file
5
+ # to you under the Apache License, Version 2.0 (the
6
+ # "License"); you may not use this file except in compliance
7
+ # with the License. You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing,
12
+ # software distributed under the License is distributed on an
13
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ # KIND, either express or implied. See the License for the
15
+ # specific language governing permissions and limitations
16
+ # under the License.
17
+
18
+ module Arrow
19
+ class StreamListenerRaw
20
+ class << self
21
+ def type_register
22
+ end
23
+ end
24
+ end
25
+ end
@@ -15,26 +15,26 @@
15
15
  # specific language governing permissions and limitations
16
16
  # under the License.
17
17
 
18
- class RollingWindowTest < Test::Unit::TestCase
19
- include Helper::Fixture
18
+ module Arrow
19
+ class Table
20
+ def filter(filter, options=nil)
21
+ raise NotImplementedError
22
+ end
20
23
 
21
- def setup
22
- raw_table = {
23
- :number => Arrow::Int32Array.new([1, -2, nil, 4, 6, 3]),
24
- }
25
- @table = Arrow::Table.new(raw_table)
26
- end
24
+ def take(indices)
25
+ raise NotImplementedError
26
+ end
27
+
28
+ def n_rows
29
+ raise NotImplementedError
30
+ end
31
+
32
+ def slice(from, length)
33
+ raise NotImplementedError
34
+ end
27
35
 
28
- test("#lag") do
29
- assert_equal(<<-ARRAY.chomp, @table.window.lag(:number).to_s)
30
- [
31
- null,
32
- -3,
33
- null,
34
- null,
35
- 2,
36
- -3
37
- ]
38
- ARRAY
36
+ def remove_column(index)
37
+ raise NotImplementedError
38
+ end
39
39
  end
40
40
  end
@@ -0,0 +1,24 @@
1
+ # Licensed to the Apache Software Foundation (ASF) under one
2
+ # or more contributor license agreements. See the NOTICE file
3
+ # distributed with this work for additional information
4
+ # regarding copyright ownership. The ASF licenses this file
5
+ # to you under the Apache License, Version 2.0 (the
6
+ # "License"); you may not use this file except in compliance
7
+ # with the License. You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing,
12
+ # software distributed under the License is distributed on an
13
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ # KIND, either express or implied. See the License for the
15
+ # specific language governing permissions and limitations
16
+ # under the License.
17
+
18
+ module Arrow
19
+ module Writable
20
+ def write(data)
21
+ raise NotImplementedError
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,52 @@
1
+ # Licensed to the Apache Software Foundation (ASF) under one
2
+ # or more contributor license agreements. See the NOTICE file
3
+ # distributed with this work for additional information
4
+ # regarding copyright ownership. The ASF licenses this file
5
+ # to you under the Apache License, Version 2.0 (the
6
+ # "License"); you may not use this file except in compliance
7
+ # with the License. You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing,
12
+ # software distributed under the License is distributed on an
13
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ # KIND, either express or implied. See the License for the
15
+ # specific language governing permissions and limitations
16
+ # under the License.
17
+
18
+ if File.exist?("../red-arrow_jars")
19
+ # installed gems
20
+ require_relative "../red-arrow_jars"
21
+ else
22
+ # local development
23
+ require "red-arrow_jars"
24
+ end
25
+
26
+ module Arrow
27
+ class << self
28
+ def allocator
29
+ @allocator ||= org.apache.arrow.memory.RootAllocator.new
30
+ end
31
+ end
32
+ end
33
+
34
+ require_relative "jruby/array"
35
+ require_relative "jruby/array-builder"
36
+ require_relative "jruby/chunked-array"
37
+ require_relative "jruby/compression-type"
38
+ require_relative "jruby/csv-read-options"
39
+ require_relative "jruby/decimal128"
40
+ require_relative "jruby/decimal256"
41
+ require_relative "jruby/error"
42
+ require_relative "jruby/file-system"
43
+ require_relative "jruby/function"
44
+ require_relative "jruby/record-batch"
45
+ require_relative "jruby/record-batch-iterator"
46
+ require_relative "jruby/sort-key"
47
+ require_relative "jruby/sort-options"
48
+ require_relative "jruby/stream-listener-raw"
49
+ require_relative "jruby/table"
50
+ require_relative "jruby/writable"
51
+
52
+ require_relative "libraries"
@@ -15,10 +15,15 @@
15
15
  # specific language governing permissions and limitations
16
16
  # under the License.
17
17
 
18
- class Date32ArrayTest < Test::Unit::TestCase
19
- test("#[]") do
20
- n_days_since_epoch = 17406 # 2017-08-28
21
- array = Arrow::Date32Array.new([n_days_since_epoch])
22
- assert_equal(Date.new(2017, 8, 28), array[0])
18
+ module Arrow
19
+ class LargeListArrayBuilder
20
+ class << self
21
+ def build(data_type, values)
22
+ builder = new(data_type)
23
+ builder.build(values)
24
+ end
25
+ end
26
+
27
+ prepend ListValuesAppendable
23
28
  end
24
29
  end
@@ -0,0 +1,83 @@
1
+ # Licensed to the Apache Software Foundation (ASF) under one
2
+ # or more contributor license agreements. See the NOTICE file
3
+ # distributed with this work for additional information
4
+ # regarding copyright ownership. The ASF licenses this file
5
+ # to you under the Apache License, Version 2.0 (the
6
+ # "License"); you may not use this file except in compliance
7
+ # with the License. You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing,
12
+ # software distributed under the License is distributed on an
13
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ # KIND, either express or implied. See the License for the
15
+ # specific language governing permissions and limitations
16
+ # under the License.
17
+
18
+ module Arrow
19
+ class LargeListDataType
20
+ include ListFieldResolvable
21
+
22
+ alias_method :initialize_raw, :initialize
23
+ private :initialize_raw
24
+
25
+ # Creates a new {Arrow::LargeListDataType}.
26
+ #
27
+ # @overload initialize(field)
28
+ #
29
+ # @param field [Arrow::Field, Hash] The field of the large list
30
+ # data type. You can also specify field description by `Hash`.
31
+ #
32
+ # See {Arrow::Field.new} how to specify field description.
33
+ #
34
+ # @example Create a large list data type with {Arrow::Field}
35
+ # visible_field = Arrow::Field.new("visible", :boolean)
36
+ # Arrow::LargeListDataType.new(visible_field)
37
+ #
38
+ # @example Create a large list data type with field description
39
+ # Arrow::LargeListDataType.new(name: "visible", type: :boolean)
40
+ #
41
+ # @overload initialize(description)
42
+ #
43
+ # @param description [Hash] The description of the large list data
44
+ # type. It must have `:field` value.
45
+ #
46
+ # @option description [Arrow::Field, Hash] :field The field of
47
+ # the large list data type. You can also specify field
48
+ # description by `Hash`.
49
+ #
50
+ # See {Arrow::Field.new} how to specify field description.
51
+ #
52
+ # @example Create a large list data type with {Arrow::Field}
53
+ # visible_field = Arrow::Field.new("visible", :boolean)
54
+ # Arrow::LargeListDataType.new(field: visible_field)
55
+ #
56
+ # @example Create a large list data type with field description
57
+ # Arrow::LargeListDataType.new(field: {name: "visible", type: :boolean})
58
+ #
59
+ # @overload initialize(data_type)
60
+ #
61
+ # @param data_type [Arrow::DataType, String, Symbol,
62
+ # ::Array<String>, ::Array<Symbol>, Hash] The element data
63
+ # type of the large list data type. A field is created with the
64
+ # default name `"item"` from the data type automatically.
65
+ #
66
+ # See {Arrow::DataType.resolve} how to specify data type.
67
+ #
68
+ # @example Create a large list data type with {Arrow::DataType}
69
+ # Arrow::LargeListDataType.new(Arrow::BooleanDataType.new)
70
+ #
71
+ # @example Create a large list data type with data type name as String
72
+ # Arrow::LargeListDataType.new("boolean")
73
+ #
74
+ # @example Create a large list data type with data type name as Symbol
75
+ # Arrow::LargeListDataType.new(:boolean)
76
+ #
77
+ # @example Create a large list data type with data type as Array
78
+ # Arrow::LargeListDataType.new([:time32, :milli])
79
+ def initialize(arg)
80
+ initialize_raw(resolve_field(arg))
81
+ end
82
+ end
83
+ end
@@ -0,0 +1,140 @@
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
+ require_relative "array-computable"
19
+ require_relative "column-containable"
20
+ require_relative "field-containable"
21
+ require_relative "generic-filterable"
22
+ require_relative "generic-takeable"
23
+ require_relative "input-referable"
24
+ require_relative "list-field-resolvable"
25
+ require_relative "list-values-appendable"
26
+ require_relative "record-containable"
27
+ require_relative "symbol-values-appendable"
28
+
29
+ require_relative "aggregate-node-options"
30
+ require_relative "aggregation"
31
+ require_relative "array"
32
+ require_relative "array-builder"
33
+ require_relative "array-statistics"
34
+ require_relative "bigdecimal-extension"
35
+ require_relative "binary-dictionary-array-builder"
36
+ require_relative "buffer"
37
+ require_relative "chunked-array"
38
+ require_relative "column"
39
+ require_relative "compression-type"
40
+ require_relative "csv-loader"
41
+ require_relative "csv-read-options"
42
+ require_relative "csv-write-options"
43
+ require_relative "data-type"
44
+ require_relative "date32-array"
45
+ require_relative "date32-array-builder"
46
+ require_relative "date64-array"
47
+ require_relative "date64-array-builder"
48
+ require_relative "datum"
49
+ require_relative "day-time-interval-array-builder"
50
+ require_relative "decimal128"
51
+ require_relative "decimal128-array"
52
+ require_relative "decimal128-array-builder"
53
+ require_relative "decimal128-data-type"
54
+ require_relative "decimal256"
55
+ require_relative "decimal256-array"
56
+ require_relative "decimal256-array-builder"
57
+ require_relative "decimal256-data-type"
58
+ require_relative "dense-union-array"
59
+ require_relative "dense-union-array-builder"
60
+ require_relative "dense-union-data-type"
61
+ require_relative "dictionary-array"
62
+ require_relative "dictionary-data-type"
63
+ require_relative "duration-array"
64
+ require_relative "duration-array-builder"
65
+ require_relative "duration-data-type"
66
+ require_relative "equal-options"
67
+ require_relative "expression"
68
+ require_relative "field"
69
+ require_relative "file-output-stream"
70
+ require_relative "file-system"
71
+ require_relative "fixed-size-binary-array"
72
+ require_relative "fixed-size-binary-array-builder"
73
+ require_relative "fixed-size-list-array-builder"
74
+ require_relative "fixed-size-list-data-type"
75
+ require_relative "function"
76
+ require_relative "group"
77
+ require_relative "half-float"
78
+ require_relative "half-float-array"
79
+ require_relative "half-float-array-builder"
80
+ require_relative "large-list-array-builder"
81
+ require_relative "large-list-data-type"
82
+ require_relative "list-array-builder"
83
+ require_relative "list-data-type"
84
+ require_relative "list-slice-options"
85
+ require_relative "make-struct-options"
86
+ require_relative "map-array"
87
+ require_relative "map-array-builder"
88
+ require_relative "map-data-type"
89
+ require_relative "month-day-nano-interval-array-builder"
90
+ require_relative "null-array"
91
+ require_relative "null-array-builder"
92
+ require_relative "path-extension"
93
+ require_relative "record"
94
+ require_relative "record-batch"
95
+ require_relative "record-batch-builder"
96
+ require_relative "record-batch-file-reader"
97
+ require_relative "record-batch-iterator"
98
+ require_relative "record-batch-reader"
99
+ require_relative "record-batch-stream-reader"
100
+ require_relative "rolling-window"
101
+ require_relative "s3-global-options"
102
+ require_relative "scalar"
103
+ require_relative "schema"
104
+ require_relative "slicer"
105
+ require_relative "sort-key"
106
+ require_relative "sort-options"
107
+ require_relative "source-node-options"
108
+ require_relative "sparse-union-array"
109
+ require_relative "sparse-union-array-builder"
110
+ require_relative "sparse-union-data-type"
111
+ require_relative "string-dictionary-array-builder"
112
+ require_relative "string-array-builder"
113
+ require_relative "stream-decoder"
114
+ require_relative "stream-listener"
115
+ require_relative "struct-array"
116
+ require_relative "struct-array-builder"
117
+ require_relative "struct-data-type"
118
+ require_relative "table"
119
+ require_relative "table-concatenate-options"
120
+ require_relative "table-formatter"
121
+ require_relative "table-list-formatter"
122
+ require_relative "table-table-formatter"
123
+ require_relative "table-loader"
124
+ require_relative "table-saver"
125
+ require_relative "tensor"
126
+ require_relative "time"
127
+ require_relative "time-unit"
128
+ require_relative "time32-array"
129
+ require_relative "time32-array-builder"
130
+ require_relative "time32-data-type"
131
+ require_relative "time64-array"
132
+ require_relative "time64-array-builder"
133
+ require_relative "time64-data-type"
134
+ require_relative "timestamp-array"
135
+ require_relative "timestamp-array-builder"
136
+ require_relative "timestamp-data-type"
137
+ require_relative "timestamp-parser"
138
+ require_relative "union-array"
139
+ require_relative "union-array-builder"
140
+ require_relative "writable"
@@ -24,73 +24,6 @@ module Arrow
24
24
  end
25
25
  end
26
26
 
27
- alias_method :append_value_raw, :append_value
28
-
29
- # @overload append_value
30
- #
31
- # Starts appending a list record. You also need to append list
32
- # value by {#value_builder}.
33
- #
34
- # @overload append_value(list)
35
- #
36
- # Appends a list record including list value.
37
- #
38
- # @param value [nil, ::Array] The list value of the record.
39
- #
40
- # If this is `nil`, the list record is null.
41
- #
42
- # If this is `Array`, it's the list value of the record.
43
- #
44
- # @since 0.12.0
45
- def append_value(*args)
46
- n_args = args.size
47
-
48
- case n_args
49
- when 0
50
- append_value_raw
51
- when 1
52
- value = args[0]
53
- case value
54
- when nil
55
- append_null
56
- when ::Array
57
- append_value_raw
58
- @value_builder ||= value_builder
59
- @value_builder.append(*value)
60
- else
61
- message = "list value must be nil or Array: #{value.inspect}"
62
- raise ArgumentError, message
63
- end
64
- else
65
- message = "wrong number of arguments (given #{n_args}, expected 0..1)"
66
- raise ArgumentError, message
67
- end
68
- end
69
-
70
- def append_values(lists, is_valids=nil)
71
- if is_valids
72
- is_valids.each_with_index do |is_valid, i|
73
- if is_valid
74
- append_value(lists[i])
75
- else
76
- append_null
77
- end
78
- end
79
- else
80
- lists.each do |list|
81
- append_value(list)
82
- end
83
- end
84
- end
85
-
86
- # @since 0.12.0
87
- def append(*values)
88
- if values.empty?
89
- # For backward compatibility
90
- append_value
91
- else
92
- super
93
- end
94
- end
27
+ prepend ListValuesAppendable
95
28
  end
96
29
  end