otegami commented on code in PR #37600:
URL: https://github.com/apache/arrow/pull/37600#discussion_r1317927717


##########
ruby/red-arrow/test/test-record-batch.rb:
##########
@@ -178,5 +178,29 @@ def setup
                      @record_batch[[:c, "a", -1, 3..4]])
       end
     end
+
+    sub_test_case("#each_raw_record") do

Review Comment:
   I was uncertain about the appropriate location to add the following test 
cases. 
   I added it here because `each_raw_record` is one of the methods for 
Arrow::Table or Arrow::RecordBatch.
   - ruby/red-arrow/test/each-raw-record/*
   - ruby/red-arrow/test/test-record-batch.rb



##########
ruby/red-arrow/test/each-raw-record/test-struct-array.rb:
##########


Review Comment:
   In the following PR #37137, I missed the following warnings happened. So I 
fixed it in this PR.
   ```console
   red-arrow % bundle exec env 
DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:/tmp/local/lib $(rbenv which ruby) 
test/run-test.rb
   
/Users/otegami/dev/project/arrow/ruby/red-arrow/test/raw-records/test-struct-array.rb:518:
 warning: method redefined; discarding old build
   
/Users/otegami/dev/project/arrow/ruby/red-arrow/test/each-raw-record/test-struct-array.rb:658:
 warning: previous definition of build was here
   
/Users/otegami/dev/project/arrow/ruby/red-arrow/test/raw-records/test-struct-array.rb:526:
 warning: method redefined; discarding old build
   
/Users/otegami/dev/project/arrow/ruby/red-arrow/test/each-raw-record/test-struct-array.rb:666:
 warning: previous definition of build was here
   ```



##########
ruby/red-arrow/ext/arrow/raw-records.cpp:
##########
@@ -306,6 +306,10 @@ namespace red_arrow {
 
   VALUE
   record_batch_each_raw_record(VALUE rb_record_batch){
+    if (!rb_block_given_p()) {
+      return rb_funcall(rb_record_batch, rb_intern("to_enum"), 1, 
ID2SYM(rb_intern("each_raw_record")));

Review Comment:
   If there is a good way to return a Enumerator object, could you teach me?🙏



##########
ruby/red-arrow/ext/arrow/raw-records.cpp:
##########
@@ -306,6 +306,10 @@ namespace red_arrow {
 
   VALUE
   record_batch_each_raw_record(VALUE rb_record_batch){
+    if (!rb_block_given_p()) {
+      return rb_funcall(rb_record_batch, rb_intern("to_enum"), 1, 
ID2SYM(rb_intern("each_raw_record")));

Review Comment:
   If there is a good way to return a Enumerator object, could you teach me?🙏



-- 
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]

Reply via email to