kou commented on code in PR #46774:
URL: https://github.com/apache/arrow/pull/46774#discussion_r2141718974


##########
c_glib/arrow-glib/composite-data-type.cpp:
##########
@@ -767,4 +767,55 @@ garrow_run_end_encoded_data_type_get_value_data_type(
   return garrow_data_type_new_raw(&arrow_value_data_type);
 }
 
+G_DEFINE_TYPE(GArrowFixedSizeListDataType,
+              garrow_fixed_size_list_data_type,
+              GARROW_TYPE_BASE_LIST_DATA_TYPE)
+
+static void
+garrow_fixed_size_list_data_type_init(GArrowFixedSizeListDataType *object)
+{
+}
+
+static void
+garrow_fixed_size_list_data_type_class_init(GArrowFixedSizeListDataTypeClass 
*klass)
+{
+}
+
+/**
+ * garrow_fixed_size_list_data_type_new_data_type:
+ * @data_type: The data type of elements.
+ * @list_size: The size of each list.
+ *
+ * Returns: A newly created fixed size list data type.
+ *
+ * Since: 21.0.0
+ */
+GArrowFixedSizeListDataType *
+garrow_fixed_size_list_data_type_new_data_type(GArrowDataType *value_type,
+                                               gint32 list_size)
+{
+  auto arrow_data_type = garrow_data_type_get_raw(value_type);

Review Comment:
   ```suggestion
     auto arrow_value_type = garrow_data_type_get_raw(value_type);
   ```



##########
c_glib/arrow-glib/composite-data-type.cpp:
##########
@@ -767,4 +767,55 @@ garrow_run_end_encoded_data_type_get_value_data_type(
   return garrow_data_type_new_raw(&arrow_value_data_type);
 }
 
+G_DEFINE_TYPE(GArrowFixedSizeListDataType,
+              garrow_fixed_size_list_data_type,
+              GARROW_TYPE_BASE_LIST_DATA_TYPE)
+
+static void
+garrow_fixed_size_list_data_type_init(GArrowFixedSizeListDataType *object)
+{
+}
+
+static void
+garrow_fixed_size_list_data_type_class_init(GArrowFixedSizeListDataTypeClass 
*klass)
+{
+}
+
+/**
+ * garrow_fixed_size_list_data_type_new_data_type:
+ * @data_type: The data type of elements.
+ * @list_size: The size of each list.
+ *
+ * Returns: A newly created fixed size list data type.
+ *
+ * Since: 21.0.0
+ */
+GArrowFixedSizeListDataType *
+garrow_fixed_size_list_data_type_new_data_type(GArrowDataType *value_type,
+                                               gint32 list_size)
+{
+  auto arrow_data_type = garrow_data_type_get_raw(value_type);
+  auto arrow_fixed_size_list_data_type =
+    arrow::fixed_size_list(arrow_data_type, list_size);
+  return GARROW_FIXED_SIZE_LIST_DATA_TYPE(
+    garrow_data_type_new_raw(&arrow_fixed_size_list_data_type));
+}
+
+/**
+ * garrow_fixed_size_list_data_type_new_field:
+ * @field: The field of elements.

Review Comment:
   ```suggestion
    * @field: The field for elements.
   ```



##########
c_glib/arrow-glib/composite-data-type.cpp:
##########
@@ -767,4 +767,55 @@ garrow_run_end_encoded_data_type_get_value_data_type(
   return garrow_data_type_new_raw(&arrow_value_data_type);
 }
 
+G_DEFINE_TYPE(GArrowFixedSizeListDataType,
+              garrow_fixed_size_list_data_type,
+              GARROW_TYPE_BASE_LIST_DATA_TYPE)
+
+static void
+garrow_fixed_size_list_data_type_init(GArrowFixedSizeListDataType *object)
+{
+}
+
+static void
+garrow_fixed_size_list_data_type_class_init(GArrowFixedSizeListDataTypeClass 
*klass)
+{
+}
+
+/**
+ * garrow_fixed_size_list_data_type_new_data_type:
+ * @data_type: The data type of elements.
+ * @list_size: The size of each list.
+ *
+ * Returns: A newly created fixed size list data type.
+ *
+ * Since: 21.0.0
+ */
+GArrowFixedSizeListDataType *
+garrow_fixed_size_list_data_type_new_data_type(GArrowDataType *value_type,
+                                               gint32 list_size)
+{
+  auto arrow_data_type = garrow_data_type_get_raw(value_type);
+  auto arrow_fixed_size_list_data_type =
+    arrow::fixed_size_list(arrow_data_type, list_size);
+  return GARROW_FIXED_SIZE_LIST_DATA_TYPE(
+    garrow_data_type_new_raw(&arrow_fixed_size_list_data_type));
+}
+
+/**
+ * garrow_fixed_size_list_data_type_new_field:
+ * @field: The field of elements.
+ * @list_size: The size of value.

Review Comment:
   We should update this too.



##########
c_glib/test/test-fixed-size-list-data-type.rb:
##########
@@ -0,0 +1,51 @@
+# 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 TestFixedSizeListDataType < Test::Unit::TestCase
+  sub_test_case(".new") do
+    def setup
+      @value_type = Arrow::BooleanDataType.new
+      @list_size = 5
+      @field_name = "bool_field"
+    end
+
+    def test_field
+      field = Arrow::Field.new(@field_name, @value_type)
+      data_type = Arrow::FixedSizeListDataType.new(field, @list_size);
+      assert_equal(Arrow::Type::FIXED_SIZE_LIST, data_type.id);

Review Comment:
   We should also check `data_type.field`.



##########
c_glib/arrow-glib/composite-data-type.cpp:
##########
@@ -767,4 +767,55 @@ garrow_run_end_encoded_data_type_get_value_data_type(
   return garrow_data_type_new_raw(&arrow_value_data_type);
 }
 
+G_DEFINE_TYPE(GArrowFixedSizeListDataType,
+              garrow_fixed_size_list_data_type,
+              GARROW_TYPE_BASE_LIST_DATA_TYPE)
+
+static void
+garrow_fixed_size_list_data_type_init(GArrowFixedSizeListDataType *object)
+{
+}
+
+static void
+garrow_fixed_size_list_data_type_class_init(GArrowFixedSizeListDataTypeClass 
*klass)
+{
+}
+
+/**
+ * garrow_fixed_size_list_data_type_new_data_type:
+ * @data_type: The data type of elements.

Review Comment:
   ```suggestion
    * @value_type: The data type of an element of each list.
   ```



##########
c_glib/arrow-glib/composite-data-type.h:
##########
@@ -256,4 +256,25 @@ GArrowDataType *
 garrow_run_end_encoded_data_type_get_value_data_type(
   GArrowRunEndEncodedDataType *data_type);
 
+#define GARROW_TYPE_FIXED_SIZE_LIST_DATA_TYPE                                  
          \
+  (garrow_fixed_size_list_data_type_get_type())
+GARROW_AVAILABLE_IN_21_0
+G_DECLARE_DERIVABLE_TYPE(GArrowFixedSizeListDataType,
+                         garrow_fixed_size_list_data_type,
+                         GARROW,
+                         FIXED_SIZE_LIST_DATA_TYPE,
+                         GArrowBaseListDataType)
+struct _GArrowFixedSizeListDataTypeClass
+{
+  GArrowBaseListDataTypeClass parent_class;
+};
+
+GARROW_AVAILABLE_IN_21_0
+GArrowFixedSizeListDataType *
+garrow_fixed_size_list_data_type_new_data_type(GArrowDataType *data_type,

Review Comment:
   ```suggestion
   garrow_fixed_size_list_data_type_new_data_type(GArrowDataType *value_type,
   ```



##########
c_glib/test/test-fixed-size-list-data-type.rb:
##########
@@ -0,0 +1,51 @@
+# 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 TestFixedSizeListDataType < Test::Unit::TestCase
+  sub_test_case(".new") do
+    def setup
+      @value_type = Arrow::BooleanDataType.new
+      @list_size = 5
+      @field_name = "bool_field"
+    end
+
+    def test_field
+      field = Arrow::Field.new(@field_name, @value_type)
+      data_type = Arrow::FixedSizeListDataType.new(field, @list_size);
+      assert_equal(Arrow::Type::FIXED_SIZE_LIST, data_type.id);
+    end
+
+    def test_data_type
+      data_type = Arrow::FixedSizeListDataType.new(@value_type, @list_size);
+      assert_equal(Arrow::Type::FIXED_SIZE_LIST, data_type.id);

Review Comment:
   We should also check `data_type.field.data_type` (or `data_type.field`).



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