red-arrow 0.14.1 → 0.15.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.

Potentially problematic release.


This version of red-arrow might be problematic. Click here for more details.

Files changed (61) hide show
  1. checksums.yaml +4 -4
  2. data/ext/arrow/arrow.cpp +34 -0
  3. data/ext/arrow/converters.cpp +42 -0
  4. data/ext/arrow/converters.hpp +626 -0
  5. data/ext/arrow/raw-records.cpp +6 -625
  6. data/ext/arrow/red-arrow.hpp +37 -3
  7. data/ext/arrow/values.cpp +154 -0
  8. data/lib/arrow/array-builder.rb +24 -1
  9. data/lib/arrow/array.rb +9 -0
  10. data/lib/arrow/chunked-array.rb +5 -0
  11. data/lib/arrow/column-containable.rb +48 -0
  12. data/lib/arrow/column.rb +36 -10
  13. data/lib/arrow/csv-loader.rb +2 -2
  14. data/lib/arrow/data-type.rb +22 -5
  15. data/lib/arrow/date64-array-builder.rb +2 -2
  16. data/lib/arrow/date64-array.rb +1 -1
  17. data/lib/arrow/decimal128-array.rb +24 -0
  18. data/lib/arrow/field-containable.rb +3 -0
  19. data/lib/arrow/group.rb +10 -13
  20. data/lib/arrow/loader.rb +20 -1
  21. data/lib/arrow/record-batch.rb +6 -4
  22. data/lib/arrow/record-containable.rb +0 -35
  23. data/lib/arrow/record.rb +12 -9
  24. data/lib/arrow/slicer.rb +2 -2
  25. data/lib/arrow/struct-array-builder.rb +1 -7
  26. data/lib/arrow/struct-array.rb +13 -11
  27. data/lib/arrow/table-loader.rb +3 -9
  28. data/lib/arrow/table-table-formatter.rb +2 -2
  29. data/lib/arrow/table.rb +61 -24
  30. data/lib/arrow/time.rb +159 -0
  31. data/lib/arrow/time32-array-builder.rb +49 -0
  32. data/lib/arrow/time32-array.rb +28 -0
  33. data/lib/arrow/time64-array-builder.rb +49 -0
  34. data/lib/arrow/time64-array.rb +28 -0
  35. data/lib/arrow/timestamp-array-builder.rb +20 -1
  36. data/lib/arrow/timestamp-array.rb +10 -22
  37. data/lib/arrow/version.rb +1 -1
  38. data/red-arrow.gemspec +1 -1
  39. data/test/raw-records/test-basic-arrays.rb +16 -8
  40. data/test/raw-records/test-dense-union-array.rb +12 -5
  41. data/test/raw-records/test-list-array.rb +21 -9
  42. data/test/raw-records/test-sparse-union-array.rb +13 -5
  43. data/test/raw-records/test-struct-array.rb +11 -4
  44. data/test/test-column.rb +56 -31
  45. data/test/test-decimal128-array-builder.rb +11 -11
  46. data/test/test-decimal128-array.rb +4 -4
  47. data/test/test-slicer.rb +1 -3
  48. data/test/test-struct-array-builder.rb +4 -4
  49. data/test/test-struct-array.rb +4 -4
  50. data/test/test-table.rb +17 -8
  51. data/test/test-time.rb +288 -0
  52. data/test/test-time32-array.rb +81 -0
  53. data/test/test-time64-array.rb +81 -0
  54. data/test/values/test-basic-arrays.rb +284 -0
  55. data/test/values/test-dense-union-array.rb +487 -0
  56. data/test/values/test-list-array.rb +497 -0
  57. data/test/values/test-sparse-union-array.rb +477 -0
  58. data/test/values/test-struct-array.rb +452 -0
  59. metadata +78 -54
  60. data/lib/arrow/struct.rb +0 -79
  61. data/test/test-struct.rb +0 -81
@@ -1,79 +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 Arrow
19
- class Struct
20
- attr_accessor :index
21
- def initialize(array, index)
22
- @array = array
23
- @index = index
24
- end
25
-
26
- def [](field_name_or_field_index)
27
- field = @array.find_field(field_name_or_field_index)
28
- return nil if field.nil?
29
- field[@index]
30
- end
31
-
32
- def fields
33
- @array.value_data_type.fields
34
- end
35
-
36
- def values
37
- @array.fields.collect do |field|
38
- field[@index]
39
- end
40
- end
41
-
42
- def to_a
43
- values
44
- end
45
-
46
- def to_h
47
- attributes = {}
48
- field_arrays = @array.fields
49
- fields.each_with_index do |field, i|
50
- attributes[field.name] = field_arrays[i][@index]
51
- end
52
- attributes
53
- end
54
-
55
- def respond_to_missing?(name, include_private)
56
- return true if @array.find_field(name)
57
- super
58
- end
59
-
60
- def method_missing(name, *args, &block)
61
- if args.empty?
62
- field = @array.find_field(name)
63
- return field[@index] if field
64
- end
65
- super
66
- end
67
-
68
- def ==(other)
69
- other.is_a?(self.class) and
70
- @array == other.array and
71
- @index == other.index
72
- end
73
-
74
- protected
75
- def array
76
- @array
77
- end
78
- end
79
- end
@@ -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 StructTest < Test::Unit::TestCase
19
- def setup
20
- @data_type = Arrow::StructDataType.new(visible: {type: :boolean},
21
- count: {type: :uint64})
22
- @values = [
23
- [true, 1],
24
- [false, 2],
25
- ]
26
- @array = Arrow::StructArray.new(@data_type, @values)
27
- @struct = @array.get_value(0)
28
- end
29
-
30
- sub_test_case("#[]") do
31
- test("Integer") do
32
- assert_equal(true, @struct[0])
33
- end
34
-
35
- test("String") do
36
- assert_equal(true, @struct["visible"])
37
- end
38
-
39
- test("Symbol") do
40
- assert_equal(true, @struct[:visible])
41
- end
42
- end
43
-
44
- test("#fields") do
45
- assert_equal(@data_type.fields,
46
- @struct.fields)
47
- end
48
-
49
- test("#values") do
50
- assert_equal([true, 1],
51
- @struct.values)
52
- end
53
-
54
- test("#to_a") do
55
- assert_equal([true, 1],
56
- @struct.to_a)
57
- end
58
-
59
- test("#to_h") do
60
- assert_equal({
61
- "visible" => true,
62
- "count" => 1,
63
- },
64
- @struct.to_h)
65
- end
66
-
67
- test("#respond_to_missing?") do
68
- assert_equal([
69
- true,
70
- false,
71
- ],
72
- [
73
- @struct.respond_to?(:visible),
74
- @struct.respond_to?(:nonexistent),
75
- ])
76
- end
77
-
78
- test("#method_missing?") do
79
- assert_equal(1, @struct.count)
80
- end
81
- end