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 304913129b GH-48610: [Ruby] Add FixedSizeListArray glue (#48609)
304913129b is described below

commit 304913129bf2b69f560a38b281cb9e5f5fbb896b
Author: Sten Larsson <[email protected]>
AuthorDate: Sun Dec 21 02:03:55 2025 +0100

    GH-48610: [Ruby] Add FixedSizeListArray glue (#48609)
    
    ### Rationale for this change
    
    When testing ListSliceOptions I noticed that some glue were missing from 
the Ruby code.
    
    ### What changes are included in this PR?
    
    This adds the `FixedSizeListArrayBuilder.build` method in Ruby.
    
    ### Are these changes tested?
    
    Yes.
    
    ### Are there any user-facing changes?
    
    This makes it easier to create `FixedSizeListArray` objects in Ruby.
    * GitHub Issue: #48610
    
    Authored-by: Sten Larsson <[email protected]>
    Signed-off-by: Sutou Kouhei <[email protected]>
---
 .../lib/arrow/fixed-size-list-array-builder.rb     | 29 ++++++++++++++++++++
 ruby/red-arrow/lib/arrow/libraries.rb              |  1 +
 ruby/red-arrow/test/test-fixed-size-list-array.rb  | 31 ++++++++++++++++++++++
 3 files changed, 61 insertions(+)

diff --git a/ruby/red-arrow/lib/arrow/fixed-size-list-array-builder.rb 
b/ruby/red-arrow/lib/arrow/fixed-size-list-array-builder.rb
new file mode 100644
index 0000000000..84c6f13dca
--- /dev/null
+++ b/ruby/red-arrow/lib/arrow/fixed-size-list-array-builder.rb
@@ -0,0 +1,29 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+module Arrow
+  class FixedSizeListArrayBuilder
+    class << self
+      def build(data_type, values)
+        builder = new(data_type)
+        builder.build(values)
+      end
+    end
+
+    prepend ListValuesAppendable
+  end
+end
diff --git a/ruby/red-arrow/lib/arrow/libraries.rb 
b/ruby/red-arrow/lib/arrow/libraries.rb
index 8427cd83ca..3e1b4eb3f8 100644
--- a/ruby/red-arrow/lib/arrow/libraries.rb
+++ b/ruby/red-arrow/lib/arrow/libraries.rb
@@ -69,6 +69,7 @@ require_relative "file-output-stream"
 require_relative "file-system"
 require_relative "fixed-size-binary-array"
 require_relative "fixed-size-binary-array-builder"
+require_relative "fixed-size-list-array-builder"
 require_relative "function"
 require_relative "group"
 require_relative "half-float"
diff --git a/ruby/red-arrow/test/test-fixed-size-list-array.rb 
b/ruby/red-arrow/test/test-fixed-size-list-array.rb
new file mode 100644
index 0000000000..0436c56dcf
--- /dev/null
+++ b/ruby/red-arrow/test/test-fixed-size-list-array.rb
@@ -0,0 +1,31 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+class FixedSizeListArrayTest < Test::Unit::TestCase
+  sub_test_case(".new") do
+    test("build") do
+      data_type = [:fixed_size_list, :int8, 2]
+      values = [
+        [1, 2],
+        [3, 4],
+        nil,
+      ]
+      array = Arrow::FixedSizeListArray.new(data_type, values)
+      assert_equal(values, array.map { |v| v&.to_a })
+    end
+  end
+end

Reply via email to