kou commented on a change in pull request #12593:
URL: https://github.com/apache/arrow/pull/12593#discussion_r824524199
##########
File path: ruby/red-arrow/ext/arrow/converters.hpp
##########
@@ -207,6 +207,21 @@ namespace red_arrow {
return INT2NUM(array.Value(i));
}
+ inline VALUE convert(const arrow::DayTimeIntervalArray& array,
+ const int64_t i) {
+
Review comment:
```suggestion
```
##########
File path: ruby/red-arrow/test/values/test-basic-arrays.rb
##########
@@ -286,6 +286,21 @@ def test_month_interval
target = build(Arrow::MonthIntervalArray.new(values))
assert_equal(values, target.values)
end
+
+ def test_day_time_interval
+ values = [
+ {day: 1, millisecond: 100},
+ nil,
+ {day: 2, millisecond: 300},
+ ]
+ inputs = [
+ Arrow::DayMillisecond.new(1, 100),
+ nil,
+ Arrow::DayMillisecond.new(2, 300),
+ ]
+ target = build(Arrow::DayTimeIntervalArray.new(inputs))
Review comment:
Ah, we should add support for `Arrow::DayTimeIntervalArray.new([{day: 1,
millisecond: 100}, nil, {...}])`.
Could you open an issue for this improvement?
##########
File path: ruby/red-arrow/ext/arrow/converters.hpp
##########
@@ -207,6 +207,21 @@ namespace red_arrow {
return INT2NUM(array.Value(i));
}
+ inline VALUE convert(const arrow::DayTimeIntervalArray& array,
+ const int64_t i) {
+
+ auto value = rb_hash_new();
+ auto arrow_value = array.Value(i);
+ rb_hash_aset(value,
+ red_arrow::symbols::day,
+ INT2NUM(arrow_value.days));
+ rb_hash_aset(value,
+ red_arrow::symbols::millisecond,
+ INT2NUM(arrow_value.milliseconds));
+
Review comment:
```suggestion
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]