From 70abedb495b0edd218720a96bc14e93eb7bd4cfe Mon Sep 17 00:00:00 2001 From: Sutou Kouhei Date: Wed, 4 Dec 2024 14:53:14 +0900 Subject: [PATCH] GH-44918: [Ruby] Fix a bug that empty list is ignored in builder --- ruby/red-arrow/lib/arrow/list-array-builder.rb | 2 +- ruby/red-arrow/test/test-list-array-builder.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ruby/red-arrow/lib/arrow/list-array-builder.rb b/ruby/red-arrow/lib/arrow/list-array-builder.rb index 0b1d17f0a5491..d6975327b5130 100644 --- a/ruby/red-arrow/lib/arrow/list-array-builder.rb +++ b/ruby/red-arrow/lib/arrow/list-array-builder.rb @@ -54,8 +54,8 @@ def append_value(*args) when nil append_null when ::Array - return if value.empty? append_value_raw + return if value.empty? @value_builder ||= value_builder @value_builder.append(*value) else diff --git a/ruby/red-arrow/test/test-list-array-builder.rb b/ruby/red-arrow/test/test-list-array-builder.rb index 91105e92bf8d0..9fbd5e0976f5e 100644 --- a/ruby/red-arrow/test/test-list-array-builder.rb +++ b/ruby/red-arrow/test/test-list-array-builder.rb @@ -40,7 +40,7 @@ def setup builder = Arrow::ListArrayBuilder.new(data_type) builder.append_value([]) array = builder.finish - assert_equal([], array[0].to_a) + assert_equal([[]], array.to_a) end end