otegami commented on code in PR #37137:
URL: https://github.com/apache/arrow/pull/37137#discussion_r1306755750
##########
ruby/red-arrow/ext/arrow/raw-records.cpp:
##########
@@ -144,6 +144,128 @@ namespace red_arrow {
// The number of columns.
const int n_columns_;
};
+
+ class RawRecordsProducer : private Converter, public arrow::ArrayVisitor {
+ public:
+ explicit RawRecordsProducer()
+ : Converter(),
+ record_(Qnil),
+ column_index_(0),
+ row_offset_(0) {
+ }
+
+ void produce(const arrow::RecordBatch& record_batch) {
+ rb::protect([&] {
+ auto n_columns = record_batch.num_columns();
Review Comment:
fix:
[97ff172](https://github.com/apache/arrow/pull/37137/commits/97ff172aa4b73e020b7f2c5690021c6ddff9f39c)
##########
ruby/red-arrow/ext/arrow/raw-records.cpp:
##########
@@ -144,6 +144,128 @@ namespace red_arrow {
// The number of columns.
const int n_columns_;
};
+
+ class RawRecordsProducer : private Converter, public arrow::ArrayVisitor {
+ public:
+ explicit RawRecordsProducer()
+ : Converter(),
+ record_(Qnil),
+ column_index_(0),
+ row_offset_(0) {
+ }
+
+ void produce(const arrow::RecordBatch& record_batch) {
+ rb::protect([&] {
+ auto n_columns = record_batch.num_columns();
+ const auto n_rows = record_batch.num_rows();
+ for (int64_t i = 0; i < n_rows; ++i) {
+ record_ = rb_ary_new_capa(n_columns);
+ row_offset_ = i;
+ for (int i = 0; i < n_columns; ++i) {
+ const auto array = record_batch.column(i).get();
+ column_index_ = i;
+ check_status(array->Accept(this),
+ "[record-batch][each-raw-record]");
+ }
+ rb_yield(record_);
+ }
+ return Qnil;
+ });
+ }
+
+ void produce(const arrow::Table& table) {
+ rb::protect([&] {
+ auto n_columns = table.num_columns();
+ auto n_rows = table.num_rows();
Review Comment:
fix:
[97ff172](https://github.com/apache/arrow/pull/37137/commits/97ff172aa4b73e020b7f2c5690021c6ddff9f39c)
--
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]