kou commented on code in PR #50226:
URL: https://github.com/apache/arrow/pull/50226#discussion_r3447695008
##########
ruby/red-arrow/lib/arrow/record-batch.rb:
##########
@@ -135,6 +78,20 @@ def method_missing(name, *args, &block)
private
+ def merge_target_class
+ RecordBatch
+ end
+
+ def create_merged_container(fields, arrays)
+ record_batch = self.class.new(
+ Schema.new(fields),
+ n_rows,
+ arrays,
+ )
Review Comment:
Does this work?
```diff
diff --git a/ruby/red-arrow/lib/arrow/record-batch.rb
b/ruby/red-arrow/lib/arrow/record-batch.rb
index 7a9ea296ea..0a4f09c864 100644
--- a/ruby/red-arrow/lib/arrow/record-batch.rb
+++ b/ruby/red-arrow/lib/arrow/record-batch.rb
@@ -37,7 +37,12 @@ module Arrow
super(schema, n_rows, values)
when 2
schema, data = args
- RecordBatchBuilder.build(schema, data)
+ schema = Schema.new(schema) unless schema.is_a?(Schema)
+ if data.all? {|array| array.is_a?(Array)}
+ super(schema, data[0].size, data)
+ else
+ RecordBatchBuilder.build(schema, data)
+ end
when 3
super
else
```
--
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]