diff --git a/ruby/red-arrow/lib/arrow/column.rb b/ruby/red-arrow/lib/arrow/column.rb index ba575381eefdc..a1de0d61282c2 100644 --- a/ruby/red-arrow/lib/arrow/column.rb +++ b/ruby/red-arrow/lib/arrow/column.rb @@ -58,11 +58,11 @@ def reverse_each(&block) @data.reverse_each(&block) end - def n_rows - @data.n_rows + def size + @data.size end - alias_method :size, :n_rows - alias_method :length, :n_rows + alias_method :length, :size + alias_method :n_rows, :size def n_nulls @data.n_nulls diff --git a/ruby/red-arrow/test/test-column.rb b/ruby/red-arrow/test/test-column.rb index f78377e363ba4..c3a6ee0f4d34f 100644 --- a/ruby/red-arrow/test/test-column.rb +++ b/ruby/red-arrow/test/test-column.rb @@ -49,6 +49,14 @@ def setup assert_equal([false, nil, true], @column.reverse_each.to_a) end + test("#size") do + assert_equal(3, @column.size) + end + + test("#length") do + assert_equal(3, @column.length) + end + test("#n_rows") do assert_equal(3, @column.n_rows) end diff --git a/ruby/red-arrow/test/test-record-batch.rb b/ruby/red-arrow/test/test-record-batch.rb index e94c26f2e329b..fec640343c60a 100644 --- a/ruby/red-arrow/test/test-record-batch.rb +++ b/ruby/red-arrow/test/test-record-batch.rb @@ -178,5 +178,11 @@ def setup @record_batch[[:c, "a", -1, 3..4]]) end end + + sub_test_case("#column") do + test("#size") do + assert_equal(@counts.size, @record_batch[:count].size) + end + end end end