This is an automated email from the ASF dual-hosted git repository. kou pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/arrow.git
The following commit(s) were added to refs/heads/main by this push: new 1e2e8e1885 GH-37561: [Ruby] Add empty chunked array tests for Arrow::Table#each_raw_records (#46862) 1e2e8e1885 is described below commit 1e2e8e1885f5303d9076cb8e865ca2d302f3cbbc Author: takuya kodama <a.s.takuya1...@gmail.com> AuthorDate: Fri Jun 20 06:23:43 2025 +0900 GH-37561: [Ruby] Add empty chunked array tests for Arrow::Table#each_raw_records (#46862) ### Rationale for this change Some test cases currently don't consider an empty chunked array. Therefore, we add empty chunk test patterns to all test cases about `Arrow::Table#each_raw_records`. ### What changes are included in this PR? This PR adds empty chunked array test patterns to 7 test files in the test/raw-records/ directory: - test-dense-union-array.rb - test-dictionary-array.rb - test-list-array.rb - test-map-array.rb - test-sparse-union-array.rb - test-struct-array.rb - test-table.rb Each EachRawRecordTable*Test class now creates a table with multiple chunks, including an empty chunk, following the pattern established in test-basic-arrays.rb. ### Are these changes tested? Yes. ### Are there any user-facing changes? No. * GitHub Issue: #37561 Authored-by: otegami <a.s.takuya1...@gmail.com> Signed-off-by: Sutou Kouhei <k...@clear-code.com> --- ruby/red-arrow/test/raw-records/test-dense-union-array.rb | 8 +++++++- ruby/red-arrow/test/raw-records/test-dictionary-array.rb | 9 ++++++++- ruby/red-arrow/test/raw-records/test-list-array.rb | 9 ++++++++- ruby/red-arrow/test/raw-records/test-map-array.rb | 9 ++++++++- ruby/red-arrow/test/raw-records/test-multiple-columns.rb | 3 ++- ruby/red-arrow/test/raw-records/test-sparse-union-array.rb | 8 +++++++- ruby/red-arrow/test/raw-records/test-struct-array.rb | 9 ++++++++- 7 files changed, 48 insertions(+), 7 deletions(-) diff --git a/ruby/red-arrow/test/raw-records/test-dense-union-array.rb b/ruby/red-arrow/test/raw-records/test-dense-union-array.rb index 42fd11342b..5ed6fb0a2e 100644 --- a/ruby/red-arrow/test/raw-records/test-dense-union-array.rb +++ b/ruby/red-arrow/test/raw-records/test-dense-union-array.rb @@ -529,7 +529,13 @@ class EachRawRecordTableDenseUnionArrayTest < Test::Unit::TestCase include RawRecordsDenseUnionArrayTests def build(type, records) - build_record_batch(type, records).to_table + record_batch = build_record_batch(type, records) + # Multiple chunks + record_batches = [ + record_batch, + record_batch.slice(record_batch.length, 0), # Empty chunk + ] + Arrow::Table.new(record_batch.schema, record_batches) end def actual_records(target) diff --git a/ruby/red-arrow/test/raw-records/test-dictionary-array.rb b/ruby/red-arrow/test/raw-records/test-dictionary-array.rb index abe946a8eb..09d472b215 100644 --- a/ruby/red-arrow/test/raw-records/test-dictionary-array.rb +++ b/ruby/red-arrow/test/raw-records/test-dictionary-array.rb @@ -340,7 +340,14 @@ class EachRawRecordTableDictionaryArraysTest < Test::Unit::TestCase include RawRecordsDictionaryArrayTests def build(array) - build_record_batch(array).to_table + record_batch = build_record_batch(array) + # Multiple chunks + record_batches = [ + record_batch.slice(0, 2), + record_batch.slice(2, 0), # Empty chunk + record_batch.slice(2, record_batch.length - 2), + ] + Arrow::Table.new(record_batch.schema, record_batches) end def actual_records(target) diff --git a/ruby/red-arrow/test/raw-records/test-list-array.rb b/ruby/red-arrow/test/raw-records/test-list-array.rb index 6ac0d45220..d19b707d0f 100644 --- a/ruby/red-arrow/test/raw-records/test-list-array.rb +++ b/ruby/red-arrow/test/raw-records/test-list-array.rb @@ -627,7 +627,14 @@ class EachRawRecordTableListArrayTest < Test::Unit::TestCase include RawRecordsListArrayTests def build(type, records) - Arrow::Table.new(build_schema(type), records) + record_batch = Arrow::RecordBatch.new(build_schema(type), records) + # Multiple chunks + record_batches = [ + record_batch.slice(0, 2), + record_batch.slice(2, 0), # Empty chunk + record_batch.slice(2, record_batch.length - 2), + ] + Arrow::Table.new(record_batch.schema, record_batches) end def actual_records(target) diff --git a/ruby/red-arrow/test/raw-records/test-map-array.rb b/ruby/red-arrow/test/raw-records/test-map-array.rb index 77dae820ae..cbebb11499 100644 --- a/ruby/red-arrow/test/raw-records/test-map-array.rb +++ b/ruby/red-arrow/test/raw-records/test-map-array.rb @@ -507,7 +507,14 @@ class EachRawRecordTableMapArrayTest < Test::Unit::TestCase include RawRecordsMapArrayTests def build(type, records) - Arrow::Table.new(build_schema(type), records) + record_batch = Arrow::RecordBatch.new(build_schema(type), records) + # Multiple chunks + record_batches = [ + record_batch.slice(0, 2), + record_batch.slice(2, 0), # Empty chunk + record_batch.slice(2, record_batch.length - 2), + ] + Arrow::Table.new(record_batch.schema, record_batches) end def actual_records(target) diff --git a/ruby/red-arrow/test/raw-records/test-multiple-columns.rb b/ruby/red-arrow/test/raw-records/test-multiple-columns.rb index 5e51b4a0c9..5dadfcac5a 100644 --- a/ruby/red-arrow/test/raw-records/test-multiple-columns.rb +++ b/ruby/red-arrow/test/raw-records/test-multiple-columns.rb @@ -65,9 +65,10 @@ class EachRawRecordTableMultipleColumnsTest < Test::Unit::TestCase def build(schema, records) record_batch = Arrow::RecordBatch.new(schema, records) + # Multiple chunks record_batches = [ record_batch.slice(0, 2), - record_batch.slice(2, 0), + record_batch.slice(2, 0), # Empty chunk record_batch.slice(2, record_batch.length - 2), ] diff --git a/ruby/red-arrow/test/raw-records/test-sparse-union-array.rb b/ruby/red-arrow/test/raw-records/test-sparse-union-array.rb index 237cbc271a..25a2f1d208 100644 --- a/ruby/red-arrow/test/raw-records/test-sparse-union-array.rb +++ b/ruby/red-arrow/test/raw-records/test-sparse-union-array.rb @@ -555,7 +555,13 @@ class EachRawRecordTableSparseUnionArrayTest < Test::Unit::TestCase include RawRecordsSparseUnionArrayTests def build(type, records) - build_record_batch(type, records).to_table + record_batch = build_record_batch(type, records) + # Multiple chunks + record_batches = [ + record_batch, + record_batch.slice(record_batch.length, 0), # Empty chunk + ] + Arrow::Table.new(record_batch.schema, record_batches) end def actual_records(target) diff --git a/ruby/red-arrow/test/raw-records/test-struct-array.rb b/ruby/red-arrow/test/raw-records/test-struct-array.rb index 989e578a92..c530da5c32 100644 --- a/ruby/red-arrow/test/raw-records/test-struct-array.rb +++ b/ruby/red-arrow/test/raw-records/test-struct-array.rb @@ -528,7 +528,14 @@ class EachRawRecordTableStructArrayTest < Test::Unit::TestCase include RawRecordsStructArrayTests def build(type, records) - Arrow::Table.new(build_schema(type), records) + record_batch = Arrow::RecordBatch.new(build_schema(type), records) + # Multiple chunks + record_batches = [ + record_batch.slice(0, 2), + record_batch.slice(2, 0), # Empty chunk + record_batch.slice(2, record_batch.length - 2), + ] + Arrow::Table.new(record_batch.schema, record_batches) end def actual_records(target)