arrow-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From w...@apache.org
Subject arrow git commit: ARROW-1505: [GLib] Simplify arguments check
Date Sat, 09 Sep 2017 17:48:51 GMT
Repository: arrow
Updated Branches:
  refs/heads/master 875be96da -> 1706aabab


ARROW-1505: [GLib] Simplify arguments check

Author: Kouhei Sutou <kou@clear-code.com>

Closes #1069 from kou/glib-simplify-arguments-check and squashes the following commits:

46c07f1f [Kouhei Sutou] [GLib] Simplify arguments check


Project: http://git-wip-us.apache.org/repos/asf/arrow/repo
Commit: http://git-wip-us.apache.org/repos/asf/arrow/commit/1706aaba
Tree: http://git-wip-us.apache.org/repos/asf/arrow/tree/1706aaba
Diff: http://git-wip-us.apache.org/repos/asf/arrow/diff/1706aaba

Branch: refs/heads/master
Commit: 1706aabab54b1c0ed1f4a259842f82f4f5edce9e
Parents: 875be96
Author: Kouhei Sutou <kou@clear-code.com>
Authored: Sat Sep 9 13:48:46 2017 -0400
Committer: Wes McKinney <wes.mckinney@twosigma.com>
Committed: Sat Sep 9 13:48:46 2017 -0400

----------------------------------------------------------------------
 c_glib/arrow-glib/array-builder.cpp | 38 ++++----------------
 c_glib/arrow-glib/array-builder.h   |  6 ++--
 c_glib/arrow-glib/array.cpp         | 62 +++++++++++---------------------
 c_glib/arrow-glib/array.h           | 10 +++---
 4 files changed, 32 insertions(+), 84 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/arrow/blob/1706aaba/c_glib/arrow-glib/array-builder.cpp
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/array-builder.cpp b/c_glib/arrow-glib/array-builder.cpp
index f550eb5..126986d 100644
--- a/c_glib/arrow-glib/array-builder.cpp
+++ b/c_glib/arrow-glib/array-builder.cpp
@@ -1408,28 +1408,15 @@ garrow_time32_array_builder_class_init(GArrowTime32ArrayBuilderClass
*klass)
 /**
  * garrow_time32_array_builder_new:
  * @data_type: A #GArrowTime32DataType.
- * @error: (nullable): Return location for a #GError or %NULL.
  *
- * Returns: (nullable):
- *   A newly created #GArrowTime32ArrayBuilder on success, %NULL on error.
+ * Returns: A newly created #GArrowTime32ArrayBuilder.
  *
  * Since: 0.7.0
  */
 GArrowTime32ArrayBuilder *
-garrow_time32_array_builder_new(GArrowDataType *data_type,
-                                GError **error)
+garrow_time32_array_builder_new(GArrowTime32DataType *data_type)
 {
-  if (!GARROW_IS_TIME32_DATA_TYPE(data_type)) {
-    g_set_error(error,
-                GARROW_ERROR,
-                GARROW_ERROR_INVALID,
-                "[time32-array-builder][new] "
-                "data type must be time32 data type: <%s>",
-                G_OBJECT_TYPE_NAME(data_type));
-    return NULL;
-  }
-
-  auto arrow_data_type = garrow_data_type_get_raw(data_type);
+  auto arrow_data_type = garrow_data_type_get_raw(GARROW_DATA_TYPE(data_type));
   auto builder = garrow_array_builder_new(arrow_data_type,
                                           NULL,
                                           "[time32-array-builder][new]");
@@ -1495,28 +1482,15 @@ garrow_time64_array_builder_class_init(GArrowTime64ArrayBuilderClass
*klass)
 /**
  * garrow_time64_array_builder_new:
  * @data_type: A #GArrowTime64DataType.
- * @error: (nullable): Return location for a #GError or %NULL.
  *
- * Returns: (nullable):
- *   A newly created #GArrowTime64ArrayBuilder on success, %NULL on error.
+ * Returns: A newly created #GArrowTime64ArrayBuilder.
  *
  * Since: 0.7.0
  */
 GArrowTime64ArrayBuilder *
-garrow_time64_array_builder_new(GArrowDataType *data_type,
-                                GError **error)
+garrow_time64_array_builder_new(GArrowTime64DataType *data_type)
 {
-  if (!GARROW_IS_TIME64_DATA_TYPE(data_type)) {
-    g_set_error(error,
-                GARROW_ERROR,
-                GARROW_ERROR_INVALID,
-                "[time64-array-builder][new] "
-                "data type must be time64 data type: <%s>",
-                G_OBJECT_TYPE_NAME(data_type));
-    return NULL;
-  }
-
-  auto arrow_data_type = garrow_data_type_get_raw(data_type);
+  auto arrow_data_type = garrow_data_type_get_raw(GARROW_DATA_TYPE(data_type));
   auto builder = garrow_array_builder_new(arrow_data_type,
                                           NULL,
                                           "[time64-array-builder][new]");

http://git-wip-us.apache.org/repos/asf/arrow/blob/1706aaba/c_glib/arrow-glib/array-builder.h
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/array-builder.h b/c_glib/arrow-glib/array-builder.h
index 4a19925..f28959f 100644
--- a/c_glib/arrow-glib/array-builder.h
+++ b/c_glib/arrow-glib/array-builder.h
@@ -978,8 +978,7 @@ struct _GArrowTime32ArrayBuilderClass
 
 GType garrow_time32_array_builder_get_type(void) G_GNUC_CONST;
 
-GArrowTime32ArrayBuilder *garrow_time32_array_builder_new(GArrowDataType *data_type,
-                                                          GError **error);
+GArrowTime32ArrayBuilder *garrow_time32_array_builder_new(GArrowTime32DataType *data_type);
 
 gboolean garrow_time32_array_builder_append(GArrowTime32ArrayBuilder *builder,
                                             gint32 value,
@@ -1030,8 +1029,7 @@ struct _GArrowTime64ArrayBuilderClass
 
 GType garrow_time64_array_builder_get_type(void) G_GNUC_CONST;
 
-GArrowTime64ArrayBuilder *garrow_time64_array_builder_new(GArrowDataType *data_type,
-                                                          GError **error);
+GArrowTime64ArrayBuilder *garrow_time64_array_builder_new(GArrowTime64DataType *data_type);
 
 gboolean garrow_time64_array_builder_append(GArrowTime64ArrayBuilder *builder,
                                             gint64 value,

http://git-wip-us.apache.org/repos/asf/arrow/blob/1706aaba/c_glib/arrow-glib/array.cpp
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/array.cpp b/c_glib/arrow-glib/array.cpp
index a52ea05..007f233 100644
--- a/c_glib/arrow-glib/array.cpp
+++ b/c_glib/arrow-glib/array.cpp
@@ -1818,35 +1818,24 @@ garrow_time32_array_class_init(GArrowTime32ArrayClass *klass)
  *   @n_nulls is 0.
  * @n_nulls: The number of null elements. If -1 is specified, the
  *   number of nulls are computed from @null_bitmap.
- * @error: (nullable): Return location for a #GError or %NULL.
  *
- * Returns: (nullable):
- *   A newly created #GArrowTime32Array on success, %NULL on error.
+ * Returns: A newly created #GArrowTime32Array.
  *
  * Since: 0.7.0
  */
 GArrowTime32Array *
-garrow_time32_array_new(GArrowDataType *data_type,
+garrow_time32_array_new(GArrowTime32DataType *data_type,
                         gint64 length,
                         GArrowBuffer *data,
                         GArrowBuffer *null_bitmap,
-                        gint64 n_nulls,
-                        GError **error)
-{
-  if (!GARROW_IS_TIME32_DATA_TYPE(data_type)) {
-    g_set_error(error,
-                GARROW_ERROR,
-                GARROW_ERROR_INVALID,
-                "[time32-array][new] data type must be time32 data type: <%s>",
-                G_OBJECT_TYPE_NAME(data_type));
-    return NULL;
-  }
-
-  auto array = garrow_primitive_array_new<arrow::Time32Type>(data_type,
-                                                             length,
-                                                             data,
-                                                             null_bitmap,
-                                                             n_nulls);
+                        gint64 n_nulls)
+{
+  auto array =
+    garrow_primitive_array_new<arrow::Time32Type>(GARROW_DATA_TYPE(data_type),
+                                                  length,
+                                                  data,
+                                                  null_bitmap,
+                                                  n_nulls);
   return GARROW_TIME32_ARRAY(array);
 }
 
@@ -1910,35 +1899,24 @@ garrow_time64_array_class_init(GArrowTime64ArrayClass *klass)
  *   @n_nulls is 0.
  * @n_nulls: The number of null elements. If -1 is specified, the
  *   number of nulls are computed from @null_bitmap.
- * @error: (nullable): Return location for a #GError or %NULL.
  *
- * Returns: (nullable):
- *   A newly created #GArrowTime64Array on success, %NULL on error.
+ * Returns: A newly created #GArrowTime64Array.
  *
  * Since: 0.7.0
  */
 GArrowTime64Array *
-garrow_time64_array_new(GArrowDataType *data_type,
+garrow_time64_array_new(GArrowTime64DataType *data_type,
                         gint64 length,
                         GArrowBuffer *data,
                         GArrowBuffer *null_bitmap,
-                        gint64 n_nulls,
-                        GError **error)
-{
-  if (!GARROW_IS_TIME64_DATA_TYPE(data_type)) {
-    g_set_error(error,
-                GARROW_ERROR,
-                GARROW_ERROR_INVALID,
-                "[time64-array][new] data type must be time64 data type: <%s>",
-                G_OBJECT_TYPE_NAME(data_type));
-    return NULL;
-  }
-
-  auto array = garrow_primitive_array_new<arrow::Time64Type>(data_type,
-                                                             length,
-                                                             data,
-                                                             null_bitmap,
-                                                             n_nulls);
+                        gint64 n_nulls)
+{
+  auto array =
+    garrow_primitive_array_new<arrow::Time64Type>(GARROW_DATA_TYPE(data_type),
+                                                  length,
+                                                  data,
+                                                  null_bitmap,
+                                                  n_nulls);
   return GARROW_TIME64_ARRAY(array);
 }
 

http://git-wip-us.apache.org/repos/asf/arrow/blob/1706aaba/c_glib/arrow-glib/array.h
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/array.h b/c_glib/arrow-glib/array.h
index da69207..ebfcf43 100644
--- a/c_glib/arrow-glib/array.h
+++ b/c_glib/arrow-glib/array.h
@@ -1062,12 +1062,11 @@ struct _GArrowTime32ArrayClass
 
 GType garrow_time32_array_get_type(void) G_GNUC_CONST;
 
-GArrowTime32Array *garrow_time32_array_new(GArrowDataType *data_type,
+GArrowTime32Array *garrow_time32_array_new(GArrowTime32DataType *data_type,
                                            gint64 length,
                                            GArrowBuffer *data,
                                            GArrowBuffer *null_bitmap,
-                                           gint64 n_nulls,
-                                           GError **error);
+                                           gint64 n_nulls);
 
 gint32 garrow_time32_array_get_value(GArrowTime32Array *array,
                                      gint64 i);
@@ -1117,12 +1116,11 @@ struct _GArrowTime64ArrayClass
 
 GType garrow_time64_array_get_type(void) G_GNUC_CONST;
 
-GArrowTime64Array *garrow_time64_array_new(GArrowDataType *data_type,
+GArrowTime64Array *garrow_time64_array_new(GArrowTime64DataType *data_type,
                                            gint64 length,
                                            GArrowBuffer *data,
                                            GArrowBuffer *null_bitmap,
-                                           gint64 n_nulls,
-                                           GError **error);
+                                           gint64 n_nulls);
 
 gint64 garrow_time64_array_get_value(GArrowTime64Array *array,
                                      gint64 i);


Mime
View raw message