red-arrow 23.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.
- checksums.yaml +4 -4
- data/ext/arrow/arrow.cpp +37 -1
- data/ext/arrow/converters.cpp +5 -0
- data/ext/arrow/converters.hpp +148 -6
- data/ext/arrow/raw-records.cpp +10 -0
- data/ext/arrow/values.cpp +4 -0
- data/lib/arrow/column.rb +4 -0
- data/lib/arrow/dense-union-array.rb +1 -1
- data/lib/arrow/fixed-size-list-data-type.rb +118 -0
- data/lib/arrow/libraries.rb +2 -0
- data/lib/arrow/sparse-union-array.rb +1 -1
- data/lib/arrow/table-formatter.rb +5 -1
- data/lib/arrow/table-saver.rb +3 -3
- data/lib/arrow/union-array.rb +26 -0
- data/lib/arrow/version.rb +1 -1
- data/red-arrow.gemspec +3 -1
- metadata +21 -18
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e8464767793fb8efd382689c8ca939af17fdb052f462885efb0461d07d905d18
|
|
4
|
+
data.tar.gz: e6d037e1400af61e90438eaa255c172eaf850b136ea7f8262b6acbd2b41c8126
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 0cfab03a5b046c67d892db13cf1cd8d988fd0da9e61e950983dc2c1662c9b25a11ad8fb2e27ca68c7cd34814f208a4a51eda0d689e6aa9c514b82c026797ac7e
|
|
7
|
+
data.tar.gz: 22370cbfb633c8efd7d3ef8e8131001ece304d1c2e79e29bbda7eae4095dea0486f79a9253fbf8d586c11389bd2f3c8b38841f90733cb1dfb4787c2a9327fa15
|
data/ext/arrow/arrow.cpp
CHANGED
|
@@ -59,10 +59,40 @@ namespace red_arrow {
|
|
|
59
59
|
{
|
|
60
60
|
auto plan = GARROW_EXECUTE_PLAN(object);
|
|
61
61
|
auto nodes = garrow_execute_plan_get_nodes(plan);
|
|
62
|
-
for (auto node = nodes;
|
|
62
|
+
for (auto node = nodes; node; node = g_list_next(node)) {
|
|
63
63
|
rbgobj_gc_mark_instance(node->data);
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
|
+
|
|
67
|
+
void
|
|
68
|
+
call_expression_mark(gpointer object)
|
|
69
|
+
{
|
|
70
|
+
auto expression = GARROW_CALL_EXPRESSION(object);
|
|
71
|
+
auto arguments = garrow_call_expression_get_arguments(expression);
|
|
72
|
+
for (auto argument = arguments; argument; argument = g_list_next(argument)) {
|
|
73
|
+
rbgobj_gc_mark_instance(argument->data);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
void
|
|
78
|
+
aggregate_node_options_mark(gpointer object)
|
|
79
|
+
{
|
|
80
|
+
auto options = GARROW_AGGREGATE_NODE_OPTIONS(object);
|
|
81
|
+
auto aggregations = garrow_aggregate_node_options_get_aggregations(options);
|
|
82
|
+
for (auto aggregation = aggregations; aggregation; aggregation = g_list_next(aggregation)) {
|
|
83
|
+
rbgobj_gc_mark_instance(aggregation->data);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
void
|
|
88
|
+
project_node_options_mark(gpointer object)
|
|
89
|
+
{
|
|
90
|
+
auto options = GARROW_PROJECT_NODE_OPTIONS(object);
|
|
91
|
+
auto expressions = garrow_project_node_options_get_expressions(options);
|
|
92
|
+
for (auto expression = expressions; expression; expression = g_list_next(expression)) {
|
|
93
|
+
rbgobj_gc_mark_instance(expression->data);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
66
96
|
}
|
|
67
97
|
|
|
68
98
|
extern "C" void Init_arrow() {
|
|
@@ -124,4 +154,10 @@ extern "C" void Init_arrow() {
|
|
|
124
154
|
red_arrow::record_batch_reader_mark);
|
|
125
155
|
rbgobj_register_mark_func(GARROW_TYPE_EXECUTE_PLAN,
|
|
126
156
|
red_arrow::execute_plan_mark);
|
|
157
|
+
rbgobj_register_mark_func(GARROW_TYPE_CALL_EXPRESSION,
|
|
158
|
+
red_arrow::call_expression_mark);
|
|
159
|
+
rbgobj_register_mark_func(GARROW_TYPE_AGGREGATE_NODE_OPTIONS,
|
|
160
|
+
red_arrow::aggregate_node_options_mark);
|
|
161
|
+
rbgobj_register_mark_func(GARROW_TYPE_PROJECT_NODE_OPTIONS,
|
|
162
|
+
red_arrow::project_node_options_mark);
|
|
127
163
|
}
|
data/ext/arrow/converters.cpp
CHANGED
|
@@ -30,6 +30,11 @@ namespace red_arrow {
|
|
|
30
30
|
return large_list_array_value_converter_->convert(array, i);
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
+
VALUE ArrayValueConverter::convert(const arrow::FixedSizeListArray& array,
|
|
34
|
+
const int64_t i) {
|
|
35
|
+
return fixed_size_list_array_value_converter_->convert(array, i);
|
|
36
|
+
}
|
|
37
|
+
|
|
33
38
|
VALUE ArrayValueConverter::convert(const arrow::StructArray& array,
|
|
34
39
|
const int64_t i) {
|
|
35
40
|
return struct_array_value_converter_->convert(array, i);
|
data/ext/arrow/converters.hpp
CHANGED
|
@@ -29,6 +29,7 @@
|
|
|
29
29
|
namespace red_arrow {
|
|
30
30
|
class ListArrayValueConverter;
|
|
31
31
|
class LargeListArrayValueConverter;
|
|
32
|
+
class FixedSizeListArrayValueConverter;
|
|
32
33
|
class StructArrayValueConverter;
|
|
33
34
|
class MapArrayValueConverter;
|
|
34
35
|
class UnionArrayValueConverter;
|
|
@@ -40,6 +41,7 @@ namespace red_arrow {
|
|
|
40
41
|
: decimal_buffer_(),
|
|
41
42
|
list_array_value_converter_(nullptr),
|
|
42
43
|
large_list_array_value_converter_(nullptr),
|
|
44
|
+
fixed_size_list_array_value_converter_(nullptr),
|
|
43
45
|
struct_array_value_converter_(nullptr),
|
|
44
46
|
map_array_value_converter_(nullptr),
|
|
45
47
|
union_array_value_converter_(nullptr),
|
|
@@ -48,12 +50,14 @@ namespace red_arrow {
|
|
|
48
50
|
|
|
49
51
|
inline void set_sub_value_converters(ListArrayValueConverter* list_array_value_converter,
|
|
50
52
|
LargeListArrayValueConverter* large_list_array_value_converter,
|
|
53
|
+
FixedSizeListArrayValueConverter* fixed_size_list_array_value_converter,
|
|
51
54
|
StructArrayValueConverter* struct_array_value_converter,
|
|
52
55
|
MapArrayValueConverter* map_array_value_converter,
|
|
53
56
|
UnionArrayValueConverter* union_array_value_converter,
|
|
54
57
|
DictionaryArrayValueConverter* dictionary_array_value_converter) {
|
|
55
58
|
list_array_value_converter_ = list_array_value_converter;
|
|
56
59
|
large_list_array_value_converter_ = large_list_array_value_converter;
|
|
60
|
+
fixed_size_list_array_value_converter_ = fixed_size_list_array_value_converter;
|
|
57
61
|
struct_array_value_converter_ = struct_array_value_converter;
|
|
58
62
|
map_array_value_converter_ = map_array_value_converter;
|
|
59
63
|
union_array_value_converter_ = union_array_value_converter;
|
|
@@ -153,7 +157,15 @@ namespace red_arrow {
|
|
|
153
157
|
const int64_t i) {
|
|
154
158
|
int32_t length;
|
|
155
159
|
const auto value = array.GetValue(i, &length);
|
|
156
|
-
|
|
160
|
+
return rb_enc_str_new(reinterpret_cast<const char*>(value),
|
|
161
|
+
length,
|
|
162
|
+
rb_ascii8bit_encoding());
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
inline VALUE convert(const arrow::LargeBinaryArray& array,
|
|
166
|
+
const int64_t i) {
|
|
167
|
+
int64_t length;
|
|
168
|
+
const auto value = array.GetValue(i, &length);
|
|
157
169
|
return rb_enc_str_new(reinterpret_cast<const char*>(value),
|
|
158
170
|
length,
|
|
159
171
|
rb_ascii8bit_encoding());
|
|
@@ -167,6 +179,14 @@ namespace red_arrow {
|
|
|
167
179
|
length);
|
|
168
180
|
}
|
|
169
181
|
|
|
182
|
+
inline VALUE convert(const arrow::LargeStringArray& array,
|
|
183
|
+
const int64_t i) {
|
|
184
|
+
int64_t length;
|
|
185
|
+
const auto value = array.GetValue(i, &length);
|
|
186
|
+
return rb_utf8_str_new(reinterpret_cast<const char*>(value),
|
|
187
|
+
length);
|
|
188
|
+
}
|
|
189
|
+
|
|
170
190
|
inline VALUE convert(const arrow::FixedSizeBinaryArray& array,
|
|
171
191
|
const int64_t i) {
|
|
172
192
|
return rb_enc_str_new(reinterpret_cast<const char*>(array.Value(i)),
|
|
@@ -225,11 +245,6 @@ namespace red_arrow {
|
|
|
225
245
|
return rb_time_num_new(sec, Qnil);
|
|
226
246
|
}
|
|
227
247
|
|
|
228
|
-
// TODO
|
|
229
|
-
// inline VALUE convert(const arrow::IntervalArray& array,
|
|
230
|
-
// const int64_t i) {
|
|
231
|
-
// };
|
|
232
|
-
|
|
233
248
|
inline VALUE convert(const arrow::MonthIntervalArray& array,
|
|
234
249
|
const int64_t i) {
|
|
235
250
|
return INT2NUM(array.Value(i));
|
|
@@ -264,12 +279,20 @@ namespace red_arrow {
|
|
|
264
279
|
return value;
|
|
265
280
|
}
|
|
266
281
|
|
|
282
|
+
inline VALUE convert(const arrow::DurationArray& array,
|
|
283
|
+
const int64_t i) {
|
|
284
|
+
return LL2NUM(array.Value(i));
|
|
285
|
+
}
|
|
286
|
+
|
|
267
287
|
VALUE convert(const arrow::ListArray& array,
|
|
268
288
|
const int64_t i);
|
|
269
289
|
|
|
270
290
|
VALUE convert(const arrow::LargeListArray& array,
|
|
271
291
|
const int64_t i);
|
|
272
292
|
|
|
293
|
+
VALUE convert(const arrow::FixedSizeListArray& array,
|
|
294
|
+
const int64_t i);
|
|
295
|
+
|
|
273
296
|
VALUE convert(const arrow::StructArray& array,
|
|
274
297
|
const int64_t i);
|
|
275
298
|
|
|
@@ -306,6 +329,7 @@ namespace red_arrow {
|
|
|
306
329
|
std::string decimal_buffer_;
|
|
307
330
|
ListArrayValueConverter* list_array_value_converter_;
|
|
308
331
|
LargeListArrayValueConverter* large_list_array_value_converter_;
|
|
332
|
+
FixedSizeListArrayValueConverter* fixed_size_list_array_value_converter_;
|
|
309
333
|
StructArrayValueConverter* struct_array_value_converter_;
|
|
310
334
|
MapArrayValueConverter* map_array_value_converter_;
|
|
311
335
|
UnionArrayValueConverter* union_array_value_converter_;
|
|
@@ -366,8 +390,10 @@ namespace red_arrow {
|
|
|
366
390
|
VISIT(MonthInterval)
|
|
367
391
|
VISIT(DayTimeInterval)
|
|
368
392
|
VISIT(MonthDayNanoInterval)
|
|
393
|
+
VISIT(Duration)
|
|
369
394
|
VISIT(List)
|
|
370
395
|
VISIT(LargeList)
|
|
396
|
+
VISIT(FixedSizeList)
|
|
371
397
|
VISIT(Struct)
|
|
372
398
|
VISIT(Map)
|
|
373
399
|
VISIT(SparseUnion)
|
|
@@ -465,8 +491,111 @@ namespace red_arrow {
|
|
|
465
491
|
VISIT(MonthInterval)
|
|
466
492
|
VISIT(DayTimeInterval)
|
|
467
493
|
VISIT(MonthDayNanoInterval)
|
|
494
|
+
VISIT(Duration)
|
|
495
|
+
VISIT(List)
|
|
496
|
+
VISIT(LargeList)
|
|
497
|
+
VISIT(FixedSizeList)
|
|
498
|
+
VISIT(Struct)
|
|
499
|
+
VISIT(Map)
|
|
500
|
+
VISIT(SparseUnion)
|
|
501
|
+
VISIT(DenseUnion)
|
|
502
|
+
VISIT(Dictionary)
|
|
503
|
+
VISIT(Decimal128)
|
|
504
|
+
VISIT(Decimal256)
|
|
505
|
+
// TODO
|
|
506
|
+
// VISIT(Extension)
|
|
507
|
+
|
|
508
|
+
#undef VISIT
|
|
509
|
+
|
|
510
|
+
private:
|
|
511
|
+
template <typename ArrayType>
|
|
512
|
+
inline VALUE convert_value(const ArrayType& array,
|
|
513
|
+
const int64_t i) {
|
|
514
|
+
return array_value_converter_->convert(array, i);
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
template <typename ArrayType>
|
|
518
|
+
arrow::Status visit_value(const ArrayType& array) {
|
|
519
|
+
if (array.null_count() > 0) {
|
|
520
|
+
for (int64_t i = 0; i < length_; ++i) {
|
|
521
|
+
auto value = Qnil;
|
|
522
|
+
if (!array.IsNull(i + offset_)) {
|
|
523
|
+
value = convert_value(array, i + offset_);
|
|
524
|
+
}
|
|
525
|
+
rb_ary_push(result_, value);
|
|
526
|
+
}
|
|
527
|
+
} else {
|
|
528
|
+
for (int64_t i = 0; i < length_; ++i) {
|
|
529
|
+
rb_ary_push(result_, convert_value(array, i + offset_));
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
return arrow::Status::OK();
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
ArrayValueConverter* array_value_converter_;
|
|
536
|
+
int32_t offset_;
|
|
537
|
+
int32_t length_;
|
|
538
|
+
VALUE result_;
|
|
539
|
+
};
|
|
540
|
+
|
|
541
|
+
class FixedSizeListArrayValueConverter : public arrow::ArrayVisitor {
|
|
542
|
+
public:
|
|
543
|
+
explicit FixedSizeListArrayValueConverter(ArrayValueConverter* converter)
|
|
544
|
+
: array_value_converter_(converter),
|
|
545
|
+
offset_(0),
|
|
546
|
+
length_(0),
|
|
547
|
+
result_(Qnil) {}
|
|
548
|
+
|
|
549
|
+
VALUE convert(const arrow::FixedSizeListArray& array, const int64_t index) {
|
|
550
|
+
auto values = array.values().get();
|
|
551
|
+
auto offset_keep = offset_;
|
|
552
|
+
auto length_keep = length_;
|
|
553
|
+
offset_ = array.value_offset(index);
|
|
554
|
+
length_ = array.value_length(index);
|
|
555
|
+
auto result_keep = result_;
|
|
556
|
+
result_ = rb_ary_new_capa(length_);
|
|
557
|
+
check_status(values->Accept(this),
|
|
558
|
+
"[raw-records][fixed-size-list-array]");
|
|
559
|
+
offset_ = offset_keep;
|
|
560
|
+
length_ = length_keep;
|
|
561
|
+
auto result_return = result_;
|
|
562
|
+
result_ = result_keep;
|
|
563
|
+
return result_return;
|
|
564
|
+
}
|
|
565
|
+
|
|
566
|
+
#define VISIT(TYPE) \
|
|
567
|
+
arrow::Status Visit(const arrow::TYPE ## Array& array) override { \
|
|
568
|
+
return visit_value(array); \
|
|
569
|
+
}
|
|
570
|
+
|
|
571
|
+
VISIT(Null)
|
|
572
|
+
VISIT(Boolean)
|
|
573
|
+
VISIT(Int8)
|
|
574
|
+
VISIT(Int16)
|
|
575
|
+
VISIT(Int32)
|
|
576
|
+
VISIT(Int64)
|
|
577
|
+
VISIT(UInt8)
|
|
578
|
+
VISIT(UInt16)
|
|
579
|
+
VISIT(UInt32)
|
|
580
|
+
VISIT(UInt64)
|
|
581
|
+
VISIT(HalfFloat)
|
|
582
|
+
VISIT(Float)
|
|
583
|
+
VISIT(Double)
|
|
584
|
+
VISIT(Binary)
|
|
585
|
+
VISIT(String)
|
|
586
|
+
VISIT(FixedSizeBinary)
|
|
587
|
+
VISIT(Date32)
|
|
588
|
+
VISIT(Date64)
|
|
589
|
+
VISIT(Time32)
|
|
590
|
+
VISIT(Time64)
|
|
591
|
+
VISIT(Timestamp)
|
|
592
|
+
VISIT(MonthInterval)
|
|
593
|
+
VISIT(DayTimeInterval)
|
|
594
|
+
VISIT(MonthDayNanoInterval)
|
|
595
|
+
VISIT(Duration)
|
|
468
596
|
VISIT(List)
|
|
469
597
|
VISIT(LargeList)
|
|
598
|
+
VISIT(FixedSizeList)
|
|
470
599
|
VISIT(Struct)
|
|
471
600
|
VISIT(Map)
|
|
472
601
|
VISIT(SparseUnion)
|
|
@@ -572,8 +701,10 @@ namespace red_arrow {
|
|
|
572
701
|
VISIT(MonthInterval)
|
|
573
702
|
VISIT(DayTimeInterval)
|
|
574
703
|
VISIT(MonthDayNanoInterval)
|
|
704
|
+
VISIT(Duration)
|
|
575
705
|
VISIT(List)
|
|
576
706
|
VISIT(LargeList)
|
|
707
|
+
VISIT(FixedSizeList)
|
|
577
708
|
VISIT(Struct)
|
|
578
709
|
VISIT(Map)
|
|
579
710
|
VISIT(SparseUnion)
|
|
@@ -675,8 +806,10 @@ namespace red_arrow {
|
|
|
675
806
|
VISIT(MonthInterval)
|
|
676
807
|
VISIT(DayTimeInterval)
|
|
677
808
|
VISIT(MonthDayNanoInterval)
|
|
809
|
+
VISIT(Duration)
|
|
678
810
|
VISIT(List)
|
|
679
811
|
VISIT(LargeList)
|
|
812
|
+
VISIT(FixedSizeList)
|
|
680
813
|
VISIT(Struct)
|
|
681
814
|
VISIT(Map)
|
|
682
815
|
VISIT(SparseUnion)
|
|
@@ -779,8 +912,10 @@ namespace red_arrow {
|
|
|
779
912
|
VISIT(MonthInterval)
|
|
780
913
|
VISIT(DayTimeInterval)
|
|
781
914
|
VISIT(MonthDayNanoInterval)
|
|
915
|
+
VISIT(Duration)
|
|
782
916
|
VISIT(List)
|
|
783
917
|
VISIT(LargeList)
|
|
918
|
+
VISIT(FixedSizeList)
|
|
784
919
|
VISIT(Struct)
|
|
785
920
|
VISIT(Map)
|
|
786
921
|
VISIT(SparseUnion)
|
|
@@ -881,7 +1016,9 @@ namespace red_arrow {
|
|
|
881
1016
|
VISIT(Float)
|
|
882
1017
|
VISIT(Double)
|
|
883
1018
|
VISIT(Binary)
|
|
1019
|
+
VISIT(LargeBinary)
|
|
884
1020
|
VISIT(String)
|
|
1021
|
+
VISIT(LargeString)
|
|
885
1022
|
VISIT(FixedSizeBinary)
|
|
886
1023
|
VISIT(Date32)
|
|
887
1024
|
VISIT(Date64)
|
|
@@ -891,8 +1028,10 @@ namespace red_arrow {
|
|
|
891
1028
|
VISIT(MonthInterval)
|
|
892
1029
|
VISIT(DayTimeInterval)
|
|
893
1030
|
VISIT(MonthDayNanoInterval)
|
|
1031
|
+
VISIT(Duration)
|
|
894
1032
|
VISIT(List)
|
|
895
1033
|
VISIT(LargeList)
|
|
1034
|
+
VISIT(FixedSizeList)
|
|
896
1035
|
VISIT(Struct)
|
|
897
1036
|
VISIT(Map)
|
|
898
1037
|
VISIT(SparseUnion)
|
|
@@ -923,6 +1062,7 @@ namespace red_arrow {
|
|
|
923
1062
|
: array_value_converter_(),
|
|
924
1063
|
list_array_value_converter_(&array_value_converter_),
|
|
925
1064
|
large_list_array_value_converter_(&array_value_converter_),
|
|
1065
|
+
fixed_size_list_array_value_converter_(&array_value_converter_),
|
|
926
1066
|
struct_array_value_converter_(&array_value_converter_),
|
|
927
1067
|
map_array_value_converter_(&array_value_converter_),
|
|
928
1068
|
union_array_value_converter_(&array_value_converter_),
|
|
@@ -930,6 +1070,7 @@ namespace red_arrow {
|
|
|
930
1070
|
array_value_converter_.
|
|
931
1071
|
set_sub_value_converters(&list_array_value_converter_,
|
|
932
1072
|
&large_list_array_value_converter_,
|
|
1073
|
+
&fixed_size_list_array_value_converter_,
|
|
933
1074
|
&struct_array_value_converter_,
|
|
934
1075
|
&map_array_value_converter_,
|
|
935
1076
|
&union_array_value_converter_,
|
|
@@ -945,6 +1086,7 @@ namespace red_arrow {
|
|
|
945
1086
|
ArrayValueConverter array_value_converter_;
|
|
946
1087
|
ListArrayValueConverter list_array_value_converter_;
|
|
947
1088
|
LargeListArrayValueConverter large_list_array_value_converter_;
|
|
1089
|
+
FixedSizeListArrayValueConverter fixed_size_list_array_value_converter_;
|
|
948
1090
|
StructArrayValueConverter struct_array_value_converter_;
|
|
949
1091
|
MapArrayValueConverter map_array_value_converter_;
|
|
950
1092
|
UnionArrayValueConverter union_array_value_converter_;
|
data/ext/arrow/raw-records.cpp
CHANGED
|
@@ -88,7 +88,9 @@ namespace red_arrow {
|
|
|
88
88
|
VISIT(Float)
|
|
89
89
|
VISIT(Double)
|
|
90
90
|
VISIT(Binary)
|
|
91
|
+
VISIT(LargeBinary)
|
|
91
92
|
VISIT(String)
|
|
93
|
+
VISIT(LargeString)
|
|
92
94
|
VISIT(FixedSizeBinary)
|
|
93
95
|
VISIT(Date32)
|
|
94
96
|
VISIT(Date64)
|
|
@@ -98,7 +100,10 @@ namespace red_arrow {
|
|
|
98
100
|
VISIT(MonthInterval)
|
|
99
101
|
VISIT(DayTimeInterval)
|
|
100
102
|
VISIT(MonthDayNanoInterval)
|
|
103
|
+
VISIT(Duration)
|
|
101
104
|
VISIT(List)
|
|
105
|
+
VISIT(LargeList)
|
|
106
|
+
VISIT(FixedSizeList)
|
|
102
107
|
VISIT(Struct)
|
|
103
108
|
VISIT(Map)
|
|
104
109
|
VISIT(SparseUnion)
|
|
@@ -224,7 +229,9 @@ namespace red_arrow {
|
|
|
224
229
|
VISIT(Float)
|
|
225
230
|
VISIT(Double)
|
|
226
231
|
VISIT(Binary)
|
|
232
|
+
VISIT(LargeBinary)
|
|
227
233
|
VISIT(String)
|
|
234
|
+
VISIT(LargeString)
|
|
228
235
|
VISIT(FixedSizeBinary)
|
|
229
236
|
VISIT(Date32)
|
|
230
237
|
VISIT(Date64)
|
|
@@ -234,7 +241,10 @@ namespace red_arrow {
|
|
|
234
241
|
VISIT(MonthInterval)
|
|
235
242
|
VISIT(DayTimeInterval)
|
|
236
243
|
VISIT(MonthDayNanoInterval)
|
|
244
|
+
VISIT(Duration)
|
|
237
245
|
VISIT(List)
|
|
246
|
+
VISIT(LargeList)
|
|
247
|
+
VISIT(FixedSizeList)
|
|
238
248
|
VISIT(Struct)
|
|
239
249
|
VISIT(Map)
|
|
240
250
|
VISIT(SparseUnion)
|
data/ext/arrow/values.cpp
CHANGED
|
@@ -69,7 +69,9 @@ namespace red_arrow {
|
|
|
69
69
|
VISIT(Float)
|
|
70
70
|
VISIT(Double)
|
|
71
71
|
VISIT(Binary)
|
|
72
|
+
VISIT(LargeBinary)
|
|
72
73
|
VISIT(String)
|
|
74
|
+
VISIT(LargeString)
|
|
73
75
|
VISIT(FixedSizeBinary)
|
|
74
76
|
VISIT(Date32)
|
|
75
77
|
VISIT(Date64)
|
|
@@ -79,8 +81,10 @@ namespace red_arrow {
|
|
|
79
81
|
VISIT(MonthInterval)
|
|
80
82
|
VISIT(DayTimeInterval)
|
|
81
83
|
VISIT(MonthDayNanoInterval)
|
|
84
|
+
VISIT(Duration)
|
|
82
85
|
VISIT(List)
|
|
83
86
|
VISIT(LargeList)
|
|
87
|
+
VISIT(FixedSizeList)
|
|
84
88
|
VISIT(Struct)
|
|
85
89
|
VISIT(Map)
|
|
86
90
|
VISIT(SparseUnion)
|
data/lib/arrow/column.rb
CHANGED
|
@@ -0,0 +1,118 @@
|
|
|
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 FixedSizeListDataType
|
|
20
|
+
include ListFieldResolvable
|
|
21
|
+
|
|
22
|
+
alias_method :initialize_raw, :initialize
|
|
23
|
+
private :initialize_raw
|
|
24
|
+
|
|
25
|
+
# Creates a new {Arrow::FixedSizeListDataType}.
|
|
26
|
+
#
|
|
27
|
+
# @overload initialize(field, size)
|
|
28
|
+
#
|
|
29
|
+
# @param field [Arrow::Field, Hash] The field of the fixed size
|
|
30
|
+
# list data type. You can also specify field description by
|
|
31
|
+
# `Hash`.
|
|
32
|
+
#
|
|
33
|
+
# See {Arrow::Field.new} how to specify field description.
|
|
34
|
+
#
|
|
35
|
+
# @param size [Integer] The number of values in each element.
|
|
36
|
+
#
|
|
37
|
+
# @example Create a fixed size list data type with {Arrow::Field}
|
|
38
|
+
# visible_field = Arrow::Field.new("visible", :boolean)
|
|
39
|
+
# size = 2
|
|
40
|
+
# Arrow::FixedSizeListDataType.new(visible_field, size)
|
|
41
|
+
#
|
|
42
|
+
# @example Create a list data type with field description
|
|
43
|
+
# description = {name: "visible", type: :boolean}
|
|
44
|
+
# size = 2
|
|
45
|
+
# Arrow::FixedSizeListDataType.new(description, size)
|
|
46
|
+
#
|
|
47
|
+
# @overload initialize(description)
|
|
48
|
+
#
|
|
49
|
+
# @param description [Hash] The description of the fixed size
|
|
50
|
+
# list data type. It must have `:field` value and `:size`
|
|
51
|
+
# value.
|
|
52
|
+
#
|
|
53
|
+
# @option description [Arrow::Field, Hash] :field The field of
|
|
54
|
+
# the list data type. You can also specify field description
|
|
55
|
+
# by `Hash`.
|
|
56
|
+
#
|
|
57
|
+
# See {Arrow::Field.new} how to specify field description.
|
|
58
|
+
#
|
|
59
|
+
# @option description [Integer] :size The number of values of
|
|
60
|
+
# each element of the fixed size list data type.
|
|
61
|
+
#
|
|
62
|
+
# @example Create a fixed size list data type with {Arrow::Field}
|
|
63
|
+
# visible_field = Arrow::Field.new("visible", :boolean)
|
|
64
|
+
# Arrow::FixedSizeListDataType.new(field: visible_field, size: 2)
|
|
65
|
+
#
|
|
66
|
+
# @example Create a fixed size list data type with field description
|
|
67
|
+
# Arrow::FixedSizeListDataType.new(field: {
|
|
68
|
+
# name: "visible",
|
|
69
|
+
# type: :boolean,
|
|
70
|
+
# },
|
|
71
|
+
# size: 2)
|
|
72
|
+
#
|
|
73
|
+
# @overload initialize(data_type, size)
|
|
74
|
+
#
|
|
75
|
+
# @param data_type [Arrow::DataType, String, Symbol,
|
|
76
|
+
# ::Array<String>, ::Array<Symbol>, Hash] The element data
|
|
77
|
+
# type of the fixed size list data type. A field is created
|
|
78
|
+
# with the default name `"item"` from the data type
|
|
79
|
+
# automatically.
|
|
80
|
+
#
|
|
81
|
+
# See {Arrow::DataType.resolve} how to specify data type.
|
|
82
|
+
#
|
|
83
|
+
# @param size [Integer] The number of values in each
|
|
84
|
+
# element.
|
|
85
|
+
#
|
|
86
|
+
# @example Create a fixed size list data type with {Arrow::DataType}
|
|
87
|
+
# size = 2
|
|
88
|
+
# Arrow::FixedSizeListDataType.new(Arrow::BooleanDataType.new,
|
|
89
|
+
# size)
|
|
90
|
+
#
|
|
91
|
+
# @example Create a fixed size list data type with data type name as String
|
|
92
|
+
# size = 2
|
|
93
|
+
# Arrow::FixedSizeListDataType.new("boolean", size)
|
|
94
|
+
#
|
|
95
|
+
# @example Create a fixed size list data type with data type name as Symbol
|
|
96
|
+
# size = 2
|
|
97
|
+
# Arrow::FixedSizeListDataType.new(:boolean, size)
|
|
98
|
+
#
|
|
99
|
+
# @example Create a fixed size list data type with data type as Array
|
|
100
|
+
# size = 2
|
|
101
|
+
# Arrow::FixedSizeListDataType.new([:time32, :milli], size)
|
|
102
|
+
def initialize(*args)
|
|
103
|
+
n_args = args.size
|
|
104
|
+
case n_args
|
|
105
|
+
when 1
|
|
106
|
+
description = args[0]
|
|
107
|
+
size = description.delete(:size)
|
|
108
|
+
initialize_raw(resolve_field(description), size)
|
|
109
|
+
when 2
|
|
110
|
+
field, size = args
|
|
111
|
+
initialize_raw(resolve_field(field), size)
|
|
112
|
+
else
|
|
113
|
+
message = "wrong number of arguments (given #{n_args}, expected 1..2)"
|
|
114
|
+
raise ArgumentError, message
|
|
115
|
+
end
|
|
116
|
+
end
|
|
117
|
+
end
|
|
118
|
+
end
|
data/lib/arrow/libraries.rb
CHANGED
|
@@ -71,6 +71,7 @@ require_relative "file-system"
|
|
|
71
71
|
require_relative "fixed-size-binary-array"
|
|
72
72
|
require_relative "fixed-size-binary-array-builder"
|
|
73
73
|
require_relative "fixed-size-list-array-builder"
|
|
74
|
+
require_relative "fixed-size-list-data-type"
|
|
74
75
|
require_relative "function"
|
|
75
76
|
require_relative "group"
|
|
76
77
|
require_relative "half-float"
|
|
@@ -134,5 +135,6 @@ require_relative "timestamp-array"
|
|
|
134
135
|
require_relative "timestamp-array-builder"
|
|
135
136
|
require_relative "timestamp-data-type"
|
|
136
137
|
require_relative "timestamp-parser"
|
|
138
|
+
require_relative "union-array"
|
|
137
139
|
require_relative "union-array-builder"
|
|
138
140
|
require_relative "writable"
|
|
@@ -80,7 +80,11 @@ module Arrow
|
|
|
80
80
|
when nil
|
|
81
81
|
"%*s" % [width, FORMATTED_NULL]
|
|
82
82
|
else
|
|
83
|
-
|
|
83
|
+
value = value.to_s
|
|
84
|
+
if value.encoding == Encoding::ASCII_8BIT
|
|
85
|
+
value = value.each_byte.collect {|byte| "%X" % byte}.join
|
|
86
|
+
end
|
|
87
|
+
"%-*s" % [width, value]
|
|
84
88
|
end
|
|
85
89
|
end
|
|
86
90
|
|
data/lib/arrow/table-saver.rb
CHANGED
|
@@ -130,9 +130,9 @@ module Arrow
|
|
|
130
130
|
end
|
|
131
131
|
end
|
|
132
132
|
|
|
133
|
-
def save_raw(writer_class)
|
|
133
|
+
def save_raw(writer_class, *args)
|
|
134
134
|
open_output_stream do |output|
|
|
135
|
-
writer_class.open(output, @table.schema) do |writer|
|
|
135
|
+
writer_class.open(output, @table.schema, *args) do |writer|
|
|
136
136
|
writer.write_table(@table)
|
|
137
137
|
end
|
|
138
138
|
end
|
|
@@ -144,7 +144,7 @@ module Arrow
|
|
|
144
144
|
|
|
145
145
|
# @since 1.0.0
|
|
146
146
|
def save_as_arrow_file
|
|
147
|
-
save_raw(RecordBatchFileWriter)
|
|
147
|
+
save_raw(RecordBatchFileWriter, nil, @options[:metadata])
|
|
148
148
|
end
|
|
149
149
|
|
|
150
150
|
# @deprecated Use `format: :arrow_batch` instead.
|
|
@@ -0,0 +1,26 @@
|
|
|
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 UnionArray
|
|
20
|
+
def fields
|
|
21
|
+
@fields ||= n_fields.times.collect do |i|
|
|
22
|
+
get_field(i)
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
data/lib/arrow/version.rb
CHANGED
data/red-arrow.gemspec
CHANGED
|
@@ -58,7 +58,7 @@ Gem::Specification.new do |spec|
|
|
|
58
58
|
spec.requirements << "jar org.apache.arrow, arrow-vector, #{spec.version}"
|
|
59
59
|
spec.requirements << "jar org.apache.arrow, arrow-memory-netty, #{spec.version}"
|
|
60
60
|
else
|
|
61
|
-
spec.add_runtime_dependency("extpp", ">= 0.1.
|
|
61
|
+
spec.add_runtime_dependency("extpp", ">= 0.1.2")
|
|
62
62
|
spec.add_runtime_dependency("gio2", ">= 4.2.3")
|
|
63
63
|
spec.add_runtime_dependency("pkg-config")
|
|
64
64
|
|
|
@@ -98,6 +98,8 @@ Gem::Specification.new do |spec|
|
|
|
98
98
|
|
|
99
99
|
["fedora", "libarrow-glib-devel"],
|
|
100
100
|
|
|
101
|
+
["homebrew", "apache-arrow-glib"],
|
|
102
|
+
|
|
101
103
|
# Try without additional repository
|
|
102
104
|
["rhel", "arrow-glib-devel"],
|
|
103
105
|
# Retry with additional repository
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: red-arrow
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 24.0.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- The Apache Software Foundation
|
|
@@ -43,14 +43,14 @@ dependencies:
|
|
|
43
43
|
requirements:
|
|
44
44
|
- - ">="
|
|
45
45
|
- !ruby/object:Gem::Version
|
|
46
|
-
version: 0.1.
|
|
46
|
+
version: 0.1.2
|
|
47
47
|
type: :runtime
|
|
48
48
|
prerelease: false
|
|
49
49
|
version_requirements: !ruby/object:Gem::Requirement
|
|
50
50
|
requirements:
|
|
51
51
|
- - ">="
|
|
52
52
|
- !ruby/object:Gem::Version
|
|
53
|
-
version: 0.1.
|
|
53
|
+
version: 0.1.2
|
|
54
54
|
- !ruby/object:Gem::Dependency
|
|
55
55
|
name: gio2
|
|
56
56
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -155,6 +155,7 @@ files:
|
|
|
155
155
|
- lib/arrow/fixed-size-binary-array-builder.rb
|
|
156
156
|
- lib/arrow/fixed-size-binary-array.rb
|
|
157
157
|
- lib/arrow/fixed-size-list-array-builder.rb
|
|
158
|
+
- lib/arrow/fixed-size-list-data-type.rb
|
|
158
159
|
- lib/arrow/function.rb
|
|
159
160
|
- lib/arrow/generic-filterable.rb
|
|
160
161
|
- lib/arrow/generic-takeable.rb
|
|
@@ -250,6 +251,7 @@ files:
|
|
|
250
251
|
- lib/arrow/timestamp-data-type.rb
|
|
251
252
|
- lib/arrow/timestamp-parser.rb
|
|
252
253
|
- lib/arrow/union-array-builder.rb
|
|
254
|
+
- lib/arrow/union-array.rb
|
|
253
255
|
- lib/arrow/version.rb
|
|
254
256
|
- lib/arrow/writable.rb
|
|
255
257
|
- red-arrow.gemspec
|
|
@@ -257,7 +259,7 @@ homepage: https://arrow.apache.org/
|
|
|
257
259
|
licenses:
|
|
258
260
|
- Apache-2.0
|
|
259
261
|
metadata:
|
|
260
|
-
msys2_mingw_dependencies: arrow>=
|
|
262
|
+
msys2_mingw_dependencies: arrow>=24.0.0
|
|
261
263
|
rdoc_options: []
|
|
262
264
|
require_paths:
|
|
263
265
|
- lib
|
|
@@ -272,20 +274,21 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
272
274
|
- !ruby/object:Gem::Version
|
|
273
275
|
version: '0'
|
|
274
276
|
requirements:
|
|
275
|
-
- 'system: arrow-glib>=
|
|
276
|
-
- 'system: arrow-glib>=
|
|
277
|
-
- 'system: arrow-glib>=
|
|
278
|
-
- 'system: arrow-glib>=
|
|
279
|
-
- 'system: arrow-glib>=
|
|
280
|
-
- 'system: arrow-glib>=
|
|
281
|
-
- 'system: arrow-glib>=
|
|
282
|
-
- 'system: arrow-glib>=
|
|
283
|
-
- 'system: arrow-glib>=
|
|
284
|
-
- 'system: arrow-glib>=
|
|
285
|
-
- 'system: arrow-glib>=
|
|
286
|
-
- 'system: arrow-glib>=
|
|
287
|
-
- 'system: arrow-glib>=
|
|
288
|
-
- 'system: arrow-glib>=
|
|
277
|
+
- 'system: arrow-glib>=24.0.0: amazon_linux: arrow-glib-devel'
|
|
278
|
+
- 'system: arrow-glib>=24.0.0: amazon_linux: https://packages.apache.org/artifactory/arrow/amazon-linux/%{version}/apache-arrow-release-latest.rpm'
|
|
279
|
+
- 'system: arrow-glib>=24.0.0: amazon_linux: arrow-glib-devel'
|
|
280
|
+
- 'system: arrow-glib>=24.0.0: centos: arrow-glib-devel'
|
|
281
|
+
- 'system: arrow-glib>=24.0.0: centos: https://packages.apache.org/artifactory/arrow/centos/%{major_version}-stream/apache-arrow-release-latest.rpm'
|
|
282
|
+
- 'system: arrow-glib>=24.0.0: centos: arrow-glib-devel'
|
|
283
|
+
- 'system: arrow-glib>=24.0.0: conda: arrow-c-glib'
|
|
284
|
+
- 'system: arrow-glib>=24.0.0: debian: libarrow-glib-dev'
|
|
285
|
+
- 'system: arrow-glib>=24.0.0: debian: https://packages.apache.org/artifactory/arrow/%{distribution}/apache-arrow-apt-source-latest-%{code_name}.deb'
|
|
286
|
+
- 'system: arrow-glib>=24.0.0: debian: libarrow-glib-dev'
|
|
287
|
+
- 'system: arrow-glib>=24.0.0: fedora: libarrow-glib-devel'
|
|
288
|
+
- 'system: arrow-glib>=24.0.0: homebrew: apache-arrow-glib'
|
|
289
|
+
- 'system: arrow-glib>=24.0.0: rhel: arrow-glib-devel'
|
|
290
|
+
- 'system: arrow-glib>=24.0.0: rhel: https://packages.apache.org/artifactory/arrow/almalinux/%{major_version}/apache-arrow-release-latest.rpm'
|
|
291
|
+
- 'system: arrow-glib>=24.0.0: rhel: arrow-glib-devel'
|
|
289
292
|
rubygems_version: 3.6.7
|
|
290
293
|
specification_version: 4
|
|
291
294
|
summary: Red Arrow is the Ruby bindings of Apache Arrow
|