ARROW-864: [GLib] Unify Array files Author: Kouhei Sutou <[email protected]>
Closes #573 from kou/glib-unify-array-file and squashes the following commits: 4c47afb [Kouhei Sutou] [GLib] Unify Array files Project: http://git-wip-us.apache.org/repos/asf/arrow/repo Commit: http://git-wip-us.apache.org/repos/asf/arrow/commit/7c1fef51 Tree: http://git-wip-us.apache.org/repos/asf/arrow/tree/7c1fef51 Diff: http://git-wip-us.apache.org/repos/asf/arrow/diff/7c1fef51 Branch: refs/heads/master Commit: 7c1fef51ca1add0af53dcdb43590f367974607c2 Parents: 3f9b26c Author: Kouhei Sutou <[email protected]> Authored: Thu Apr 20 10:08:56 2017 -0400 Committer: Wes McKinney <[email protected]> Committed: Thu Apr 20 10:08:56 2017 -0400 ---------------------------------------------------------------------- c_glib/arrow-glib/Makefile.am | 32 -- c_glib/arrow-glib/array.cpp | 624 ++++++++++++++++++++- c_glib/arrow-glib/array.h | 735 +++++++++++++++++++++++++ c_glib/arrow-glib/arrow-glib.h | 16 - c_glib/arrow-glib/binary-array.cpp | 73 --- c_glib/arrow-glib/binary-array.h | 72 --- c_glib/arrow-glib/boolean-array.cpp | 69 --- c_glib/arrow-glib/boolean-array.h | 70 --- c_glib/arrow-glib/double-array.cpp | 69 --- c_glib/arrow-glib/double-array.h | 71 --- c_glib/arrow-glib/float-array.cpp | 69 --- c_glib/arrow-glib/float-array.h | 71 --- c_glib/arrow-glib/int16-array.cpp | 69 --- c_glib/arrow-glib/int16-array.h | 71 --- c_glib/arrow-glib/int32-array.cpp | 69 --- c_glib/arrow-glib/int32-array.h | 71 --- c_glib/arrow-glib/int64-array.cpp | 69 --- c_glib/arrow-glib/int64-array.h | 71 --- c_glib/arrow-glib/int8-array.cpp | 69 --- c_glib/arrow-glib/int8-array.h | 71 --- c_glib/arrow-glib/list-array.cpp | 92 ---- c_glib/arrow-glib/list-array.h | 73 --- c_glib/arrow-glib/null-array.cpp | 69 --- c_glib/arrow-glib/null-array.h | 70 --- c_glib/arrow-glib/string-array.cpp | 74 --- c_glib/arrow-glib/string-array.h | 71 --- c_glib/arrow-glib/struct-array.cpp | 97 ---- c_glib/arrow-glib/struct-array.h | 73 --- c_glib/arrow-glib/uint16-array.cpp | 69 --- c_glib/arrow-glib/uint16-array.h | 71 --- c_glib/arrow-glib/uint32-array.cpp | 69 --- c_glib/arrow-glib/uint32-array.h | 71 --- c_glib/arrow-glib/uint64-array.cpp | 69 --- c_glib/arrow-glib/uint64-array.h | 71 --- c_glib/arrow-glib/uint8-array.cpp | 69 --- c_glib/arrow-glib/uint8-array.h | 71 --- c_glib/doc/reference/arrow-glib-docs.sgml | 16 - 37 files changed, 1340 insertions(+), 2386 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/arrow/blob/7c1fef51/c_glib/arrow-glib/Makefile.am ---------------------------------------------------------------------- diff --git a/c_glib/arrow-glib/Makefile.am b/c_glib/arrow-glib/Makefile.am index 11b6508..570a033 100644 --- a/c_glib/arrow-glib/Makefile.am +++ b/c_glib/arrow-glib/Makefile.am @@ -44,62 +44,46 @@ libarrow_glib_la_headers = \ array.h \ array-builder.h \ arrow-glib.h \ - binary-array.h \ binary-array-builder.h \ binary-data-type.h \ - boolean-array.h \ boolean-array-builder.h \ boolean-data-type.h \ buffer.h \ chunked-array.h \ column.h \ data-type.h \ - double-array.h \ double-array-builder.h \ double-data-type.h \ error.h \ field.h \ - float-array.h \ float-array-builder.h \ float-data-type.h \ - int8-array.h \ int8-array-builder.h \ int8-data-type.h \ - int16-array.h \ int16-array-builder.h \ int16-data-type.h \ - int32-array.h \ int32-array-builder.h \ int32-data-type.h \ - int64-array.h \ int64-array-builder.h \ int64-data-type.h \ - list-array.h \ list-array-builder.h \ list-data-type.h \ - null-array.h \ null-data-type.h \ record-batch.h \ schema.h \ - string-array.h \ string-array-builder.h \ string-data-type.h \ - struct-array.h \ struct-array-builder.h \ struct-data-type.h \ table.h \ tensor.h \ type.h \ - uint8-array.h \ uint8-array-builder.h \ uint8-data-type.h \ - uint16-array.h \ uint16-array-builder.h \ uint16-data-type.h \ - uint32-array.h \ uint32-array-builder.h \ uint32-data-type.h \ - uint64-array.h \ uint64-array-builder.h \ uint64-data-type.h @@ -132,62 +116,46 @@ libarrow_glib_la_generated_sources = \ libarrow_glib_la_sources = \ array.cpp \ array-builder.cpp \ - binary-array.cpp \ binary-array-builder.cpp \ binary-data-type.cpp \ - boolean-array.cpp \ boolean-array-builder.cpp \ boolean-data-type.cpp \ buffer.cpp \ chunked-array.cpp \ column.cpp \ data-type.cpp \ - double-array.cpp \ double-array-builder.cpp \ double-data-type.cpp \ error.cpp \ field.cpp \ - float-array.cpp \ float-array-builder.cpp \ float-data-type.cpp \ - int8-array.cpp \ int8-array-builder.cpp \ int8-data-type.cpp \ - int16-array.cpp \ int16-array-builder.cpp \ int16-data-type.cpp \ - int32-array.cpp \ int32-array-builder.cpp \ int32-data-type.cpp \ - int64-array.cpp \ int64-array-builder.cpp \ int64-data-type.cpp \ - list-array.cpp \ list-array-builder.cpp \ list-data-type.cpp \ - null-array.cpp \ null-data-type.cpp \ record-batch.cpp \ schema.cpp \ - string-array.cpp \ string-array-builder.cpp \ string-data-type.cpp \ - struct-array.cpp \ struct-array-builder.cpp \ struct-data-type.cpp \ table.cpp \ tensor.cpp \ type.cpp \ - uint8-array.cpp \ uint8-array-builder.cpp \ uint8-data-type.cpp \ - uint16-array.cpp \ uint16-array-builder.cpp \ uint16-data-type.cpp \ - uint32-array.cpp \ uint32-array-builder.cpp \ uint32-data-type.cpp \ - uint64-array.cpp \ uint64-array-builder.cpp \ uint64-data-type.cpp \ $(libarrow_glib_la_headers) \ http://git-wip-us.apache.org/repos/asf/arrow/blob/7c1fef51/c_glib/arrow-glib/array.cpp ---------------------------------------------------------------------- diff --git a/c_glib/arrow-glib/array.cpp b/c_glib/arrow-glib/array.cpp index 3bd7b40..c86bff9 100644 --- a/c_glib/arrow-glib/array.cpp +++ b/c_glib/arrow-glib/array.cpp @@ -22,24 +22,8 @@ #endif #include <arrow-glib/array.hpp> -#include <arrow-glib/binary-array.h> -#include <arrow-glib/boolean-array.h> #include <arrow-glib/data-type.hpp> -#include <arrow-glib/double-array.h> -#include <arrow-glib/float-array.h> -#include <arrow-glib/int8-array.h> -#include <arrow-glib/int16-array.h> -#include <arrow-glib/int32-array.h> -#include <arrow-glib/int64-array.h> -#include <arrow-glib/list-array.h> -#include <arrow-glib/null-array.h> -#include <arrow-glib/string-array.h> -#include <arrow-glib/struct-array.h> #include <arrow-glib/type.hpp> -#include <arrow-glib/uint8-array.h> -#include <arrow-glib/uint16-array.h> -#include <arrow-glib/uint32-array.h> -#include <arrow-glib/uint64-array.h> #include <iostream> @@ -47,13 +31,80 @@ G_BEGIN_DECLS /** * SECTION: array - * @short_description: Base class for all array classes + * @section_id: array-classes + * @title: Array classes + * @include: arrow-glib/arrow-glib.h * * #GArrowArray is a base class for all array classes such as * #GArrowBooleanArray. * - * Array is immutable. You need to use array builder class such as - * #GArrowBooleanArrayBuilder to create a new array. + * All array classes are immutable. You need to use array builder + * class such as #GArrowBooleanArrayBuilder to create a new array + * except #GArrowNullArray. + * + * #GArrowNullArray is a class for null array. It can store zero or + * more null values. You need to specify an array length to create a + * new array. + * + * #GArrowBooleanArray is a class for binary array. It can store zero + * or more boolean data. You need to use #GArrowBooleanArrayBuilder to + * create a new array. + * + * #GArrowInt8Array is a class for 8-bit integer array. It can store + * zero or more 8-bit integer data. You need to use + * #GArrowInt8ArrayBuilder to create a new array. + * + * #GArrowUInt8Array is a class for 8-bit unsigned integer array. It + * can store zero or more 8-bit unsigned integer data. You need to use + * #GArrowUInt8ArrayBuilder to create a new array. + * + * #GArrowInt16Array is a class for 16-bit integer array. It can store + * zero or more 16-bit integer data. You need to use + * #GArrowInt16ArrayBuilder to create a new array. + * + * #GArrowUInt16Array is a class for 16-bit unsigned integer array. It + * can store zero or more 16-bit unsigned integer data. You need to use + * #GArrowUInt16ArrayBuilder to create a new array. + * + * #GArrowInt32Array is a class for 32-bit integer array. It can store + * zero or more 32-bit integer data. You need to use + * #GArrowInt32ArrayBuilder to create a new array. + * + * #GArrowUInt32Array is a class for 32-bit unsigned integer array. It + * can store zero or more 32-bit unsigned integer data. You need to use + * #GArrowUInt32ArrayBuilder to create a new array. + * + * #GArrowInt64Array is a class for 64-bit integer array. It can store + * zero or more 64-bit integer data. You need to use + * #GArrowInt64ArrayBuilder to create a new array. + * + * #GArrowUInt64Array is a class for 64-bit unsigned integer array. It + * can store zero or more 64-bit unsigned integer data. You need to + * use #GArrowUInt64ArrayBuilder to create a new array. + * + * #GArrowFloatArray is a class for 32-bit floating point array. It + * can store zero or more 32-bit floating data. You need to use + * #GArrowFloatArrayBuilder to create a new array. + * + * #GArrowDoubleArray is a class for 64-bit floating point array. It + * can store zero or more 64-bit floating data. You need to use + * #GArrowDoubleArrayBuilder to create a new array. + * + * #GArrowBinaryArray is a class for binary array. It can store zero + * or more binary data. You need to use #GArrowBinaryArrayBuilder to + * create a new array. + * + * #GArrowStringArray is a class for UTF-8 encoded string array. It + * can store zero or more UTF-8 encoded string data. You need to use + * #GArrowStringArrayBuilder to create a new array. + * + * #GArrowListArray is a class for list array. It can store zero or + * more list data. You need to use #GArrowListArrayBuilder to create a + * new array. + * + * #GArrowStructArray is a class for struct array. It can store zero + * or more structs. One struct has zero or more fields. You need to + * use #GArrowStructArrayBuilder to create a new array. */ typedef struct GArrowArrayPrivate_ { @@ -243,6 +294,541 @@ garrow_array_slice(GArrowArray *array, return garrow_array_new_raw(&arrow_sub_array); } + +G_DEFINE_TYPE(GArrowNullArray, \ + garrow_null_array, \ + GARROW_TYPE_ARRAY) + +static void +garrow_null_array_init(GArrowNullArray *object) +{ +} + +static void +garrow_null_array_class_init(GArrowNullArrayClass *klass) +{ +} + +/** + * garrow_null_array_new: + * @length: An array length. + * + * Returns: A newly created #GArrowNullArray. + */ +GArrowNullArray * +garrow_null_array_new(gint64 length) +{ + auto arrow_null_array = std::make_shared<arrow::NullArray>(length); + std::shared_ptr<arrow::Array> arrow_array = arrow_null_array; + auto array = garrow_array_new_raw(&arrow_array); + return GARROW_NULL_ARRAY(array); +} + + +G_DEFINE_TYPE(GArrowBooleanArray, \ + garrow_boolean_array, \ + GARROW_TYPE_ARRAY) + +static void +garrow_boolean_array_init(GArrowBooleanArray *object) +{ +} + +static void +garrow_boolean_array_class_init(GArrowBooleanArrayClass *klass) +{ +} + +/** + * garrow_boolean_array_get_value: + * @array: A #GArrowBooleanArray. + * @i: The index of the target value. + * + * Returns: The i-th value. + */ +gboolean +garrow_boolean_array_get_value(GArrowBooleanArray *array, + gint64 i) +{ + auto arrow_array = garrow_array_get_raw(GARROW_ARRAY(array)); + return static_cast<arrow::BooleanArray *>(arrow_array.get())->Value(i); +} + + +G_DEFINE_TYPE(GArrowInt8Array, \ + garrow_int8_array, \ + GARROW_TYPE_ARRAY) + +static void +garrow_int8_array_init(GArrowInt8Array *object) +{ +} + +static void +garrow_int8_array_class_init(GArrowInt8ArrayClass *klass) +{ +} + +/** + * garrow_int8_array_get_value: + * @array: A #GArrowInt8Array. + * @i: The index of the target value. + * + * Returns: The i-th value. + */ +gint8 +garrow_int8_array_get_value(GArrowInt8Array *array, + gint64 i) +{ + auto arrow_array = garrow_array_get_raw(GARROW_ARRAY(array)); + return static_cast<arrow::Int8Array *>(arrow_array.get())->Value(i); +} + + +G_DEFINE_TYPE(GArrowUInt8Array, \ + garrow_uint8_array, \ + GARROW_TYPE_ARRAY) + +static void +garrow_uint8_array_init(GArrowUInt8Array *object) +{ +} + +static void +garrow_uint8_array_class_init(GArrowUInt8ArrayClass *klass) +{ +} + +/** + * garrow_uint8_array_get_value: + * @array: A #GArrowUInt8Array. + * @i: The index of the target value. + * + * Returns: The i-th value. + */ +guint8 +garrow_uint8_array_get_value(GArrowUInt8Array *array, + gint64 i) +{ + auto arrow_array = garrow_array_get_raw(GARROW_ARRAY(array)); + return static_cast<arrow::UInt8Array *>(arrow_array.get())->Value(i); +} + + +G_DEFINE_TYPE(GArrowInt16Array, \ + garrow_int16_array, \ + GARROW_TYPE_ARRAY) + +static void +garrow_int16_array_init(GArrowInt16Array *object) +{ +} + +static void +garrow_int16_array_class_init(GArrowInt16ArrayClass *klass) +{ +} + +/** + * garrow_int16_array_get_value: + * @array: A #GArrowInt16Array. + * @i: The index of the target value. + * + * Returns: The i-th value. + */ +gint16 +garrow_int16_array_get_value(GArrowInt16Array *array, + gint64 i) +{ + auto arrow_array = garrow_array_get_raw(GARROW_ARRAY(array)); + return static_cast<arrow::Int16Array *>(arrow_array.get())->Value(i); +} + + +G_DEFINE_TYPE(GArrowUInt16Array, \ + garrow_uint16_array, \ + GARROW_TYPE_ARRAY) + +static void +garrow_uint16_array_init(GArrowUInt16Array *object) +{ +} + +static void +garrow_uint16_array_class_init(GArrowUInt16ArrayClass *klass) +{ +} + +/** + * garrow_uint16_array_get_value: + * @array: A #GArrowUInt16Array. + * @i: The index of the target value. + * + * Returns: The i-th value. + */ +guint16 +garrow_uint16_array_get_value(GArrowUInt16Array *array, + gint64 i) +{ + auto arrow_array = garrow_array_get_raw(GARROW_ARRAY(array)); + return static_cast<arrow::UInt16Array *>(arrow_array.get())->Value(i); +} + + +G_DEFINE_TYPE(GArrowInt32Array, \ + garrow_int32_array, \ + GARROW_TYPE_ARRAY) + +static void +garrow_int32_array_init(GArrowInt32Array *object) +{ +} + +static void +garrow_int32_array_class_init(GArrowInt32ArrayClass *klass) +{ +} + +/** + * garrow_int32_array_get_value: + * @array: A #GArrowInt32Array. + * @i: The index of the target value. + * + * Returns: The i-th value. + */ +gint32 +garrow_int32_array_get_value(GArrowInt32Array *array, + gint64 i) +{ + auto arrow_array = garrow_array_get_raw(GARROW_ARRAY(array)); + return static_cast<arrow::Int32Array *>(arrow_array.get())->Value(i); +} + + +G_DEFINE_TYPE(GArrowUInt32Array, \ + garrow_uint32_array, \ + GARROW_TYPE_ARRAY) + +static void +garrow_uint32_array_init(GArrowUInt32Array *object) +{ +} + +static void +garrow_uint32_array_class_init(GArrowUInt32ArrayClass *klass) +{ +} + +/** + * garrow_uint32_array_get_value: + * @array: A #GArrowUInt32Array. + * @i: The index of the target value. + * + * Returns: The i-th value. + */ +guint32 +garrow_uint32_array_get_value(GArrowUInt32Array *array, + gint64 i) +{ + auto arrow_array = garrow_array_get_raw(GARROW_ARRAY(array)); + return static_cast<arrow::UInt32Array *>(arrow_array.get())->Value(i); +} + + +G_DEFINE_TYPE(GArrowInt64Array, \ + garrow_int64_array, \ + GARROW_TYPE_ARRAY) + +static void +garrow_int64_array_init(GArrowInt64Array *object) +{ +} + +static void +garrow_int64_array_class_init(GArrowInt64ArrayClass *klass) +{ +} + +/** + * garrow_int64_array_get_value: + * @array: A #GArrowInt64Array. + * @i: The index of the target value. + * + * Returns: The i-th value. + */ +gint64 +garrow_int64_array_get_value(GArrowInt64Array *array, + gint64 i) +{ + auto arrow_array = garrow_array_get_raw(GARROW_ARRAY(array)); + return static_cast<arrow::Int64Array *>(arrow_array.get())->Value(i); +} + + +G_DEFINE_TYPE(GArrowUInt64Array, \ + garrow_uint64_array, \ + GARROW_TYPE_ARRAY) + +static void +garrow_uint64_array_init(GArrowUInt64Array *object) +{ +} + +static void +garrow_uint64_array_class_init(GArrowUInt64ArrayClass *klass) +{ +} + +/** + * garrow_uint64_array_get_value: + * @array: A #GArrowUInt64Array. + * @i: The index of the target value. + * + * Returns: The i-th value. + */ +guint64 +garrow_uint64_array_get_value(GArrowUInt64Array *array, + gint64 i) +{ + auto arrow_array = garrow_array_get_raw(GARROW_ARRAY(array)); + return static_cast<arrow::UInt64Array *>(arrow_array.get())->Value(i); +} + +G_DEFINE_TYPE(GArrowFloatArray, \ + garrow_float_array, \ + GARROW_TYPE_ARRAY) + +static void +garrow_float_array_init(GArrowFloatArray *object) +{ +} + +static void +garrow_float_array_class_init(GArrowFloatArrayClass *klass) +{ +} + +/** + * garrow_float_array_get_value: + * @array: A #GArrowFloatArray. + * @i: The index of the target value. + * + * Returns: The i-th value. + */ +gfloat +garrow_float_array_get_value(GArrowFloatArray *array, + gint64 i) +{ + auto arrow_array = garrow_array_get_raw(GARROW_ARRAY(array)); + return static_cast<arrow::FloatArray *>(arrow_array.get())->Value(i); +} + + +G_DEFINE_TYPE(GArrowDoubleArray, \ + garrow_double_array, \ + GARROW_TYPE_ARRAY) + +static void +garrow_double_array_init(GArrowDoubleArray *object) +{ +} + +static void +garrow_double_array_class_init(GArrowDoubleArrayClass *klass) +{ +} + +/** + * garrow_double_array_get_value: + * @array: A #GArrowDoubleArray. + * @i: The index of the target value. + * + * Returns: The i-th value. + */ +gdouble +garrow_double_array_get_value(GArrowDoubleArray *array, + gint64 i) +{ + auto arrow_array = garrow_array_get_raw(GARROW_ARRAY(array)); + return static_cast<arrow::DoubleArray *>(arrow_array.get())->Value(i); +} + + +G_DEFINE_TYPE(GArrowBinaryArray, \ + garrow_binary_array, \ + GARROW_TYPE_ARRAY) + +static void +garrow_binary_array_init(GArrowBinaryArray *object) +{ +} + +static void +garrow_binary_array_class_init(GArrowBinaryArrayClass *klass) +{ +} + +/** + * garrow_binary_array_get_value: + * @array: A #GArrowBinaryArray. + * @i: The index of the target value. + * @length: (out): The length of the value. + * + * Returns: (array length=length): The i-th value. + */ +const guint8 * +garrow_binary_array_get_value(GArrowBinaryArray *array, + gint64 i, + gint32 *length) +{ + auto arrow_array = garrow_array_get_raw(GARROW_ARRAY(array)); + auto arrow_binary_array = + static_cast<arrow::BinaryArray *>(arrow_array.get()); + return arrow_binary_array->GetValue(i, length); +} + + +G_DEFINE_TYPE(GArrowStringArray, \ + garrow_string_array, \ + GARROW_TYPE_BINARY_ARRAY) + +static void +garrow_string_array_init(GArrowStringArray *object) +{ +} + +static void +garrow_string_array_class_init(GArrowStringArrayClass *klass) +{ +} + +/** + * garrow_string_array_get_string: + * @array: A #GArrowStringArray. + * @i: The index of the target value. + * + * Returns: The i-th UTF-8 encoded string. + */ +gchar * +garrow_string_array_get_string(GArrowStringArray *array, + gint64 i) +{ + auto arrow_array = garrow_array_get_raw(GARROW_ARRAY(array)); + auto arrow_string_array = + static_cast<arrow::StringArray *>(arrow_array.get()); + gint32 length; + auto value = + reinterpret_cast<const gchar *>(arrow_string_array->GetValue(i, &length)); + return g_strndup(value, length); +} + + +G_DEFINE_TYPE(GArrowListArray, \ + garrow_list_array, \ + GARROW_TYPE_ARRAY) + +static void +garrow_list_array_init(GArrowListArray *object) +{ +} + +static void +garrow_list_array_class_init(GArrowListArrayClass *klass) +{ +} + +/** + * garrow_list_array_get_value_type: + * @array: A #GArrowListArray. + * + * Returns: (transfer full): The data type of value in each list. + */ +GArrowDataType * +garrow_list_array_get_value_type(GArrowListArray *array) +{ + auto arrow_array = garrow_array_get_raw(GARROW_ARRAY(array)); + auto arrow_list_array = + static_cast<arrow::ListArray *>(arrow_array.get()); + auto arrow_value_type = arrow_list_array->value_type(); + return garrow_data_type_new_raw(&arrow_value_type); +} + +/** + * garrow_list_array_get_value: + * @array: A #GArrowListArray. + * @i: The index of the target value. + * + * Returns: (transfer full): The i-th list. + */ +GArrowArray * +garrow_list_array_get_value(GArrowListArray *array, + gint64 i) +{ + auto arrow_array = garrow_array_get_raw(GARROW_ARRAY(array)); + auto arrow_list_array = + static_cast<arrow::ListArray *>(arrow_array.get()); + auto arrow_list = + arrow_list_array->values()->Slice(arrow_list_array->value_offset(i), + arrow_list_array->value_length(i)); + return garrow_array_new_raw(&arrow_list); +} + + +G_DEFINE_TYPE(GArrowStructArray, \ + garrow_struct_array, \ + GARROW_TYPE_ARRAY) + +static void +garrow_struct_array_init(GArrowStructArray *object) +{ +} + +static void +garrow_struct_array_class_init(GArrowStructArrayClass *klass) +{ +} + +/** + * garrow_struct_array_get_field + * @array: A #GArrowStructArray. + * @i: The index of the field in the struct. + * + * Returns: (transfer full): The i-th field. + */ +GArrowArray * +garrow_struct_array_get_field(GArrowStructArray *array, + gint i) +{ + auto arrow_array = garrow_array_get_raw(GARROW_ARRAY(array)); + auto arrow_struct_array = + static_cast<arrow::StructArray *>(arrow_array.get()); + auto arrow_field = arrow_struct_array->field(i); + return garrow_array_new_raw(&arrow_field); +} + +/** + * garrow_struct_array_get_fields + * @array: A #GArrowStructArray. + * + * Returns: (element-type GArrowArray) (transfer full): + * The fields in the struct. + */ +GList * +garrow_struct_array_get_fields(GArrowStructArray *array) +{ + const auto arrow_array = garrow_array_get_raw(GARROW_ARRAY(array)); + const auto arrow_struct_array = + static_cast<const arrow::StructArray *>(arrow_array.get()); + + GList *fields = NULL; + for (auto arrow_field : arrow_struct_array->fields()) { + GArrowArray *field = garrow_array_new_raw(&arrow_field); + fields = g_list_prepend(fields, field); + } + + return g_list_reverse(fields); +} + G_END_DECLS GArrowArray * http://git-wip-us.apache.org/repos/asf/arrow/blob/7c1fef51/c_glib/arrow-glib/array.h ---------------------------------------------------------------------- diff --git a/c_glib/arrow-glib/array.h b/c_glib/arrow-glib/array.h index 06a37e9..b417cdb 100644 --- a/c_glib/arrow-glib/array.h +++ b/c_glib/arrow-glib/array.h @@ -68,4 +68,739 @@ GArrowArray *garrow_array_slice (GArrowArray *array, gint64 offset, gint64 length); +#define GARROW_TYPE_NULL_ARRAY \ + (garrow_null_array_get_type()) +#define GARROW_NULL_ARRAY(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST((obj), \ + GARROW_TYPE_NULL_ARRAY, \ + GArrowNullArray)) +#define GARROW_NULL_ARRAY_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST((klass), \ + GARROW_TYPE_NULL_ARRAY, \ + GArrowNullArrayClass)) +#define GARROW_IS_NULL_ARRAY(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE((obj), \ + GARROW_TYPE_NULL_ARRAY)) +#define GARROW_IS_NULL_ARRAY_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_TYPE((klass), \ + GARROW_TYPE_NULL_ARRAY)) +#define GARROW_NULL_ARRAY_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS((obj), \ + GARROW_TYPE_NULL_ARRAY, \ + GArrowNullArrayClass)) + +typedef struct _GArrowNullArray GArrowNullArray; +typedef struct _GArrowNullArrayClass GArrowNullArrayClass; + +/** + * GArrowNullArray: + * + * It wraps `arrow::NullArray`. + */ +struct _GArrowNullArray +{ + /*< private >*/ + GArrowArray parent_instance; +}; + +struct _GArrowNullArrayClass +{ + GArrowArrayClass parent_class; +}; + +GType garrow_null_array_get_type(void) G_GNUC_CONST; + +GArrowNullArray *garrow_null_array_new(gint64 length); + + +#define GARROW_TYPE_BOOLEAN_ARRAY \ + (garrow_boolean_array_get_type()) +#define GARROW_BOOLEAN_ARRAY(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST((obj), \ + GARROW_TYPE_BOOLEAN_ARRAY, \ + GArrowBooleanArray)) +#define GARROW_BOOLEAN_ARRAY_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST((klass), \ + GARROW_TYPE_BOOLEAN_ARRAY, \ + GArrowBooleanArrayClass)) +#define GARROW_IS_BOOLEAN_ARRAY(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE((obj), \ + GARROW_TYPE_BOOLEAN_ARRAY)) +#define GARROW_IS_BOOLEAN_ARRAY_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_TYPE((klass), \ + GARROW_TYPE_BOOLEAN_ARRAY)) +#define GARROW_BOOLEAN_ARRAY_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS((obj), \ + GARROW_TYPE_BOOLEAN_ARRAY, \ + GArrowBooleanArrayClass)) + +typedef struct _GArrowBooleanArray GArrowBooleanArray; +typedef struct _GArrowBooleanArrayClass GArrowBooleanArrayClass; + +/** + * GArrowBooleanArray: + * + * It wraps `arrow::BooleanArray`. + */ +struct _GArrowBooleanArray +{ + /*< private >*/ + GArrowArray parent_instance; +}; + +struct _GArrowBooleanArrayClass +{ + GArrowArrayClass parent_class; +}; + +GType garrow_boolean_array_get_type (void) G_GNUC_CONST; +gboolean garrow_boolean_array_get_value (GArrowBooleanArray *array, + gint64 i); + + +#define GARROW_TYPE_INT8_ARRAY \ + (garrow_int8_array_get_type()) +#define GARROW_INT8_ARRAY(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST((obj), \ + GARROW_TYPE_INT8_ARRAY, \ + GArrowInt8Array)) +#define GARROW_INT8_ARRAY_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST((klass), \ + GARROW_TYPE_INT8_ARRAY, \ + GArrowInt8ArrayClass)) +#define GARROW_IS_INT8_ARRAY(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE((obj), \ + GARROW_TYPE_INT8_ARRAY)) +#define GARROW_IS_INT8_ARRAY_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_TYPE((klass), \ + GARROW_TYPE_INT8_ARRAY)) +#define GARROW_INT8_ARRAY_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS((obj), \ + GARROW_TYPE_INT8_ARRAY, \ + GArrowInt8ArrayClass)) + +typedef struct _GArrowInt8Array GArrowInt8Array; +typedef struct _GArrowInt8ArrayClass GArrowInt8ArrayClass; + +/** + * GArrowInt8Array: + * + * It wraps `arrow::Int8Array`. + */ +struct _GArrowInt8Array +{ + /*< private >*/ + GArrowArray parent_instance; +}; + +struct _GArrowInt8ArrayClass +{ + GArrowArrayClass parent_class; +}; + +GType garrow_int8_array_get_type(void) G_GNUC_CONST; + +gint8 garrow_int8_array_get_value(GArrowInt8Array *array, + gint64 i); + + +#define GARROW_TYPE_UINT8_ARRAY \ + (garrow_uint8_array_get_type()) +#define GARROW_UINT8_ARRAY(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST((obj), \ + GARROW_TYPE_UINT8_ARRAY, \ + GArrowUInt8Array)) +#define GARROW_UINT8_ARRAY_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST((klass), \ + GARROW_TYPE_UINT8_ARRAY, \ + GArrowUInt8ArrayClass)) +#define GARROW_IS_UINT8_ARRAY(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE((obj), \ + GARROW_TYPE_UINT8_ARRAY)) +#define GARROW_IS_UINT8_ARRAY_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_TYPE((klass), \ + GARROW_TYPE_UINT8_ARRAY)) +#define GARROW_UINT8_ARRAY_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS((obj), \ + GARROW_TYPE_UINT8_ARRAY, \ + GArrowUInt8ArrayClass)) + +typedef struct _GArrowUInt8Array GArrowUInt8Array; +typedef struct _GArrowUInt8ArrayClass GArrowUInt8ArrayClass; + +/** + * GArrowUInt8Array: + * + * It wraps `arrow::UInt8Array`. + */ +struct _GArrowUInt8Array +{ + /*< private >*/ + GArrowArray parent_instance; +}; + +struct _GArrowUInt8ArrayClass +{ + GArrowArrayClass parent_class; +}; + +GType garrow_uint8_array_get_type(void) G_GNUC_CONST; + +guint8 garrow_uint8_array_get_value(GArrowUInt8Array *array, + gint64 i); + + +#define GARROW_TYPE_INT16_ARRAY \ + (garrow_int16_array_get_type()) +#define GARROW_INT16_ARRAY(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST((obj), \ + GARROW_TYPE_INT16_ARRAY, \ + GArrowInt16Array)) +#define GARROW_INT16_ARRAY_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST((klass), \ + GARROW_TYPE_INT16_ARRAY, \ + GArrowInt16ArrayClass)) +#define GARROW_IS_INT16_ARRAY(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE((obj), \ + GARROW_TYPE_INT16_ARRAY)) +#define GARROW_IS_INT16_ARRAY_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_TYPE((klass), \ + GARROW_TYPE_INT16_ARRAY)) +#define GARROW_INT16_ARRAY_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS((obj), \ + GARROW_TYPE_INT16_ARRAY, \ + GArrowInt16ArrayClass)) + +typedef struct _GArrowInt16Array GArrowInt16Array; +typedef struct _GArrowInt16ArrayClass GArrowInt16ArrayClass; + +/** + * GArrowInt16Array: + * + * It wraps `arrow::Int16Array`. + */ +struct _GArrowInt16Array +{ + /*< private >*/ + GArrowArray parent_instance; +}; + +struct _GArrowInt16ArrayClass +{ + GArrowArrayClass parent_class; +}; + +GType garrow_int16_array_get_type(void) G_GNUC_CONST; + +gint16 garrow_int16_array_get_value(GArrowInt16Array *array, + gint64 i); + + +#define GARROW_TYPE_UINT16_ARRAY \ + (garrow_uint16_array_get_type()) +#define GARROW_UINT16_ARRAY(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST((obj), \ + GARROW_TYPE_UINT16_ARRAY, \ + GArrowUInt16Array)) +#define GARROW_UINT16_ARRAY_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST((klass), \ + GARROW_TYPE_UINT16_ARRAY, \ + GArrowUInt16ArrayClass)) +#define GARROW_IS_UINT16_ARRAY(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE((obj), \ + GARROW_TYPE_UINT16_ARRAY)) +#define GARROW_IS_UINT16_ARRAY_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_TYPE((klass), \ + GARROW_TYPE_UINT16_ARRAY)) +#define GARROW_UINT16_ARRAY_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS((obj), \ + GARROW_TYPE_UINT16_ARRAY, \ + GArrowUInt16ArrayClass)) + +typedef struct _GArrowUInt16Array GArrowUInt16Array; +typedef struct _GArrowUInt16ArrayClass GArrowUInt16ArrayClass; + +/** + * GArrowUInt16Array: + * + * It wraps `arrow::UInt16Array`. + */ +struct _GArrowUInt16Array +{ + /*< private >*/ + GArrowArray parent_instance; +}; + +struct _GArrowUInt16ArrayClass +{ + GArrowArrayClass parent_class; +}; + +GType garrow_uint16_array_get_type(void) G_GNUC_CONST; + +guint16 garrow_uint16_array_get_value(GArrowUInt16Array *array, + gint64 i); + + +#define GARROW_TYPE_INT32_ARRAY \ + (garrow_int32_array_get_type()) +#define GARROW_INT32_ARRAY(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST((obj), \ + GARROW_TYPE_INT32_ARRAY, \ + GArrowInt32Array)) +#define GARROW_INT32_ARRAY_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST((klass), \ + GARROW_TYPE_INT32_ARRAY, \ + GArrowInt32ArrayClass)) +#define GARROW_IS_INT32_ARRAY(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE((obj), \ + GARROW_TYPE_INT32_ARRAY)) +#define GARROW_IS_INT32_ARRAY_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_TYPE((klass), \ + GARROW_TYPE_INT32_ARRAY)) +#define GARROW_INT32_ARRAY_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS((obj), \ + GARROW_TYPE_INT32_ARRAY, \ + GArrowInt32ArrayClass)) + +typedef struct _GArrowInt32Array GArrowInt32Array; +typedef struct _GArrowInt32ArrayClass GArrowInt32ArrayClass; + +/** + * GArrowInt32Array: + * + * It wraps `arrow::Int32Array`. + */ +struct _GArrowInt32Array +{ + /*< private >*/ + GArrowArray parent_instance; +}; + +struct _GArrowInt32ArrayClass +{ + GArrowArrayClass parent_class; +}; + +GType garrow_int32_array_get_type(void) G_GNUC_CONST; + +gint32 garrow_int32_array_get_value(GArrowInt32Array *array, + gint64 i); + + +#define GARROW_TYPE_UINT32_ARRAY \ + (garrow_uint32_array_get_type()) +#define GARROW_UINT32_ARRAY(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST((obj), \ + GARROW_TYPE_UINT32_ARRAY, \ + GArrowUInt32Array)) +#define GARROW_UINT32_ARRAY_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST((klass), \ + GARROW_TYPE_UINT32_ARRAY, \ + GArrowUInt32ArrayClass)) +#define GARROW_IS_UINT32_ARRAY(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE((obj), \ + GARROW_TYPE_UINT32_ARRAY)) +#define GARROW_IS_UINT32_ARRAY_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_TYPE((klass), \ + GARROW_TYPE_UINT32_ARRAY)) +#define GARROW_UINT32_ARRAY_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS((obj), \ + GARROW_TYPE_UINT32_ARRAY, \ + GArrowUInt32ArrayClass)) + +typedef struct _GArrowUInt32Array GArrowUInt32Array; +typedef struct _GArrowUInt32ArrayClass GArrowUInt32ArrayClass; + +/** + * GArrowUInt32Array: + * + * It wraps `arrow::UInt32Array`. + */ +struct _GArrowUInt32Array +{ + /*< private >*/ + GArrowArray parent_instance; +}; + +struct _GArrowUInt32ArrayClass +{ + GArrowArrayClass parent_class; +}; + +GType garrow_uint32_array_get_type(void) G_GNUC_CONST; + +guint32 garrow_uint32_array_get_value(GArrowUInt32Array *array, + gint64 i); + + +#define GARROW_TYPE_INT64_ARRAY \ + (garrow_int64_array_get_type()) +#define GARROW_INT64_ARRAY(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST((obj), \ + GARROW_TYPE_INT64_ARRAY, \ + GArrowInt64Array)) +#define GARROW_INT64_ARRAY_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST((klass), \ + GARROW_TYPE_INT64_ARRAY, \ + GArrowInt64ArrayClass)) +#define GARROW_IS_INT64_ARRAY(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE((obj), \ + GARROW_TYPE_INT64_ARRAY)) +#define GARROW_IS_INT64_ARRAY_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_TYPE((klass), \ + GARROW_TYPE_INT64_ARRAY)) +#define GARROW_INT64_ARRAY_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS((obj), \ + GARROW_TYPE_INT64_ARRAY, \ + GArrowInt64ArrayClass)) + +typedef struct _GArrowInt64Array GArrowInt64Array; +typedef struct _GArrowInt64ArrayClass GArrowInt64ArrayClass; + +/** + * GArrowInt64Array: + * + * It wraps `arrow::Int64Array`. + */ +struct _GArrowInt64Array +{ + /*< private >*/ + GArrowArray parent_instance; +}; + +struct _GArrowInt64ArrayClass +{ + GArrowArrayClass parent_class; +}; + +GType garrow_int64_array_get_type(void) G_GNUC_CONST; + +gint64 garrow_int64_array_get_value(GArrowInt64Array *array, + gint64 i); + + +#define GARROW_TYPE_UINT64_ARRAY \ + (garrow_uint64_array_get_type()) +#define GARROW_UINT64_ARRAY(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST((obj), \ + GARROW_TYPE_UINT64_ARRAY, \ + GArrowUInt64Array)) +#define GARROW_UINT64_ARRAY_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST((klass), \ + GARROW_TYPE_UINT64_ARRAY, \ + GArrowUInt64ArrayClass)) +#define GARROW_IS_UINT64_ARRAY(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE((obj), \ + GARROW_TYPE_UINT64_ARRAY)) +#define GARROW_IS_UINT64_ARRAY_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_TYPE((klass), \ + GARROW_TYPE_UINT64_ARRAY)) +#define GARROW_UINT64_ARRAY_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS((obj), \ + GARROW_TYPE_UINT64_ARRAY, \ + GArrowUInt64ArrayClass)) + +typedef struct _GArrowUInt64Array GArrowUInt64Array; +typedef struct _GArrowUInt64ArrayClass GArrowUInt64ArrayClass; + +/** + * GArrowUInt64Array: + * + * It wraps `arrow::UInt64Array`. + */ +struct _GArrowUInt64Array +{ + /*< private >*/ + GArrowArray parent_instance; +}; + +struct _GArrowUInt64ArrayClass +{ + GArrowArrayClass parent_class; +}; + +GType garrow_uint64_array_get_type(void) G_GNUC_CONST; + +guint64 garrow_uint64_array_get_value(GArrowUInt64Array *array, + gint64 i); + + +#define GARROW_TYPE_FLOAT_ARRAY \ + (garrow_float_array_get_type()) +#define GARROW_FLOAT_ARRAY(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST((obj), \ + GARROW_TYPE_FLOAT_ARRAY, \ + GArrowFloatArray)) +#define GARROW_FLOAT_ARRAY_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST((klass), \ + GARROW_TYPE_FLOAT_ARRAY, \ + GArrowFloatArrayClass)) +#define GARROW_IS_FLOAT_ARRAY(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE((obj), \ + GARROW_TYPE_FLOAT_ARRAY)) +#define GARROW_IS_FLOAT_ARRAY_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_TYPE((klass), \ + GARROW_TYPE_FLOAT_ARRAY)) +#define GARROW_FLOAT_ARRAY_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS((obj), \ + GARROW_TYPE_FLOAT_ARRAY, \ + GArrowFloatArrayClass)) + +typedef struct _GArrowFloatArray GArrowFloatArray; +typedef struct _GArrowFloatArrayClass GArrowFloatArrayClass; + +/** + * GArrowFloatArray: + * + * It wraps `arrow::FloatArray`. + */ +struct _GArrowFloatArray +{ + /*< private >*/ + GArrowArray parent_instance; +}; + +struct _GArrowFloatArrayClass +{ + GArrowArrayClass parent_class; +}; + +GType garrow_float_array_get_type(void) G_GNUC_CONST; + +gfloat garrow_float_array_get_value(GArrowFloatArray *array, + gint64 i); + + +#define GARROW_TYPE_DOUBLE_ARRAY \ + (garrow_double_array_get_type()) +#define GARROW_DOUBLE_ARRAY(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST((obj), \ + GARROW_TYPE_DOUBLE_ARRAY, \ + GArrowDoubleArray)) +#define GARROW_DOUBLE_ARRAY_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST((klass), \ + GARROW_TYPE_DOUBLE_ARRAY, \ + GArrowDoubleArrayClass)) +#define GARROW_IS_DOUBLE_ARRAY(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE((obj), \ + GARROW_TYPE_DOUBLE_ARRAY)) +#define GARROW_IS_DOUBLE_ARRAY_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_TYPE((klass), \ + GARROW_TYPE_DOUBLE_ARRAY)) +#define GARROW_DOUBLE_ARRAY_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS((obj), \ + GARROW_TYPE_DOUBLE_ARRAY, \ + GArrowDoubleArrayClass)) + +typedef struct _GArrowDoubleArray GArrowDoubleArray; +typedef struct _GArrowDoubleArrayClass GArrowDoubleArrayClass; + +/** + * GArrowDoubleArray: + * + * It wraps `arrow::DoubleArray`. + */ +struct _GArrowDoubleArray +{ + /*< private >*/ + GArrowArray parent_instance; +}; + +struct _GArrowDoubleArrayClass +{ + GArrowArrayClass parent_class; +}; + +GType garrow_double_array_get_type(void) G_GNUC_CONST; + +gdouble garrow_double_array_get_value(GArrowDoubleArray *array, + gint64 i); + + +#define GARROW_TYPE_BINARY_ARRAY \ + (garrow_binary_array_get_type()) +#define GARROW_BINARY_ARRAY(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST((obj), \ + GARROW_TYPE_BINARY_ARRAY, \ + GArrowBinaryArray)) +#define GARROW_BINARY_ARRAY_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST((klass), \ + GARROW_TYPE_BINARY_ARRAY, \ + GArrowBinaryArrayClass)) +#define GARROW_IS_BINARY_ARRAY(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE((obj), \ + GARROW_TYPE_BINARY_ARRAY)) +#define GARROW_IS_BINARY_ARRAY_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_TYPE((klass), \ + GARROW_TYPE_BINARY_ARRAY)) +#define GARROW_BINARY_ARRAY_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS((obj), \ + GARROW_TYPE_BINARY_ARRAY, \ + GArrowBinaryArrayClass)) + +typedef struct _GArrowBinaryArray GArrowBinaryArray; +typedef struct _GArrowBinaryArrayClass GArrowBinaryArrayClass; + +/** + * GArrowBinaryArray: + * + * It wraps `arrow::BinaryArray`. + */ +struct _GArrowBinaryArray +{ + /*< private >*/ + GArrowArray parent_instance; +}; + +struct _GArrowBinaryArrayClass +{ + GArrowArrayClass parent_class; +}; + +GType garrow_binary_array_get_type(void) G_GNUC_CONST; + +const guint8 *garrow_binary_array_get_value(GArrowBinaryArray *array, + gint64 i, + gint32 *length); + +#define GARROW_TYPE_STRING_ARRAY \ + (garrow_string_array_get_type()) +#define GARROW_STRING_ARRAY(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST((obj), \ + GARROW_TYPE_STRING_ARRAY, \ + GArrowStringArray)) +#define GARROW_STRING_ARRAY_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST((klass), \ + GARROW_TYPE_STRING_ARRAY, \ + GArrowStringArrayClass)) +#define GARROW_IS_STRING_ARRAY(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE((obj), \ + GARROW_TYPE_STRING_ARRAY)) +#define GARROW_IS_STRING_ARRAY_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_TYPE((klass), \ + GARROW_TYPE_STRING_ARRAY)) +#define GARROW_STRING_ARRAY_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS((obj), \ + GARROW_TYPE_STRING_ARRAY, \ + GArrowStringArrayClass)) + +typedef struct _GArrowStringArray GArrowStringArray; +typedef struct _GArrowStringArrayClass GArrowStringArrayClass; + +/** + * GArrowStringArray: + * + * It wraps `arrow::StringArray`. + */ +struct _GArrowStringArray +{ + /*< private >*/ + GArrowBinaryArray parent_instance; +}; + +struct _GArrowStringArrayClass +{ + GArrowBinaryArrayClass parent_class; +}; + +GType garrow_string_array_get_type(void) G_GNUC_CONST; + +gchar *garrow_string_array_get_string(GArrowStringArray *array, + gint64 i); + + +#define GARROW_TYPE_LIST_ARRAY \ + (garrow_list_array_get_type()) +#define GARROW_LIST_ARRAY(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST((obj), \ + GARROW_TYPE_LIST_ARRAY, \ + GArrowListArray)) +#define GARROW_LIST_ARRAY_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST((klass), \ + GARROW_TYPE_LIST_ARRAY, \ + GArrowListArrayClass)) +#define GARROW_IS_LIST_ARRAY(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE((obj), \ + GARROW_TYPE_LIST_ARRAY)) +#define GARROW_IS_LIST_ARRAY_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_TYPE((klass), \ + GARROW_TYPE_LIST_ARRAY)) +#define GARROW_LIST_ARRAY_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS((obj), \ + GARROW_TYPE_LIST_ARRAY, \ + GArrowListArrayClass)) + +typedef struct _GArrowListArray GArrowListArray; +typedef struct _GArrowListArrayClass GArrowListArrayClass; + +/** + * GArrowListArray: + * + * It wraps `arrow::ListArray`. + */ +struct _GArrowListArray +{ + /*< private >*/ + GArrowArray parent_instance; +}; + +struct _GArrowListArrayClass +{ + GArrowArrayClass parent_class; +}; + +GType garrow_list_array_get_type(void) G_GNUC_CONST; + +GArrowDataType *garrow_list_array_get_value_type(GArrowListArray *array); +GArrowArray *garrow_list_array_get_value(GArrowListArray *array, + gint64 i); + + +#define GARROW_TYPE_STRUCT_ARRAY \ + (garrow_struct_array_get_type()) +#define GARROW_STRUCT_ARRAY(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST((obj), \ + GARROW_TYPE_STRUCT_ARRAY, \ + GArrowStructArray)) +#define GARROW_STRUCT_ARRAY_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST((klass), \ + GARROW_TYPE_STRUCT_ARRAY, \ + GArrowStructArrayClass)) +#define GARROW_IS_STRUCT_ARRAY(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE((obj), \ + GARROW_TYPE_STRUCT_ARRAY)) +#define GARROW_IS_STRUCT_ARRAY_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_TYPE((klass), \ + GARROW_TYPE_STRUCT_ARRAY)) +#define GARROW_STRUCT_ARRAY_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS((obj), \ + GARROW_TYPE_STRUCT_ARRAY, \ + GArrowStructArrayClass)) + +typedef struct _GArrowStructArray GArrowStructArray; +typedef struct _GArrowStructArrayClass GArrowStructArrayClass; + +/** + * GArrowStructArray: + * + * It wraps `arrow::StructArray`. + */ +struct _GArrowStructArray +{ + /*< private >*/ + GArrowArray parent_instance; +}; + +struct _GArrowStructArrayClass +{ + GArrowArrayClass parent_class; +}; + +GType garrow_struct_array_get_type(void) G_GNUC_CONST; + +GArrowArray *garrow_struct_array_get_field(GArrowStructArray *array, + gint i); +GList *garrow_struct_array_get_fields(GArrowStructArray *array); + G_END_DECLS http://git-wip-us.apache.org/repos/asf/arrow/blob/7c1fef51/c_glib/arrow-glib/arrow-glib.h ---------------------------------------------------------------------- diff --git a/c_glib/arrow-glib/arrow-glib.h b/c_glib/arrow-glib/arrow-glib.h index 8d9bfe2..ee408cd 100644 --- a/c_glib/arrow-glib/arrow-glib.h +++ b/c_glib/arrow-glib/arrow-glib.h @@ -21,62 +21,46 @@ #include <arrow-glib/array.h> #include <arrow-glib/array-builder.h> -#include <arrow-glib/binary-array.h> #include <arrow-glib/binary-array-builder.h> #include <arrow-glib/binary-data-type.h> -#include <arrow-glib/boolean-array.h> #include <arrow-glib/boolean-array-builder.h> #include <arrow-glib/boolean-data-type.h> #include <arrow-glib/chunked-array.h> #include <arrow-glib/column.h> #include <arrow-glib/data-type.h> -#include <arrow-glib/double-array.h> #include <arrow-glib/double-array-builder.h> #include <arrow-glib/double-data-type.h> #include <arrow-glib/enums.h> #include <arrow-glib/error.h> #include <arrow-glib/field.h> -#include <arrow-glib/float-array.h> #include <arrow-glib/float-array-builder.h> #include <arrow-glib/float-data-type.h> -#include <arrow-glib/int8-array.h> #include <arrow-glib/int8-array-builder.h> #include <arrow-glib/int8-data-type.h> -#include <arrow-glib/int16-array.h> #include <arrow-glib/int16-array-builder.h> #include <arrow-glib/int16-data-type.h> -#include <arrow-glib/int32-array.h> #include <arrow-glib/int32-array-builder.h> #include <arrow-glib/int32-data-type.h> -#include <arrow-glib/int64-array.h> #include <arrow-glib/int64-array-builder.h> #include <arrow-glib/int64-data-type.h> -#include <arrow-glib/list-array.h> #include <arrow-glib/list-array-builder.h> #include <arrow-glib/list-data-type.h> -#include <arrow-glib/null-array.h> #include <arrow-glib/null-data-type.h> #include <arrow-glib/record-batch.h> #include <arrow-glib/schema.h> -#include <arrow-glib/string-array.h> #include <arrow-glib/string-array-builder.h> #include <arrow-glib/string-data-type.h> -#include <arrow-glib/struct-array.h> #include <arrow-glib/struct-array-builder.h> #include <arrow-glib/struct-data-type.h> #include <arrow-glib/table.h> #include <arrow-glib/tensor.h> #include <arrow-glib/type.h> -#include <arrow-glib/uint8-array.h> #include <arrow-glib/uint8-array-builder.h> #include <arrow-glib/uint8-data-type.h> -#include <arrow-glib/uint16-array.h> #include <arrow-glib/uint16-array-builder.h> #include <arrow-glib/uint16-data-type.h> -#include <arrow-glib/uint32-array.h> #include <arrow-glib/uint32-array-builder.h> #include <arrow-glib/uint32-data-type.h> -#include <arrow-glib/uint64-array.h> #include <arrow-glib/uint64-array-builder.h> #include <arrow-glib/uint64-data-type.h> http://git-wip-us.apache.org/repos/asf/arrow/blob/7c1fef51/c_glib/arrow-glib/binary-array.cpp ---------------------------------------------------------------------- diff --git a/c_glib/arrow-glib/binary-array.cpp b/c_glib/arrow-glib/binary-array.cpp deleted file mode 100644 index c149d14..0000000 --- a/c_glib/arrow-glib/binary-array.cpp +++ /dev/null @@ -1,73 +0,0 @@ -/* - * 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. - */ - -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif - -#include <arrow-glib/array.hpp> -#include <arrow-glib/binary-array.h> - -G_BEGIN_DECLS - -/** - * SECTION: binary-array - * @short_description: Binary array class - * - * #GArrowBinaryArray is a class for binary array. It can store zero - * or more binary data. - * - * #GArrowBinaryArray is immutable. You need to use - * #GArrowBinaryArrayBuilder to create a new array. - */ - -G_DEFINE_TYPE(GArrowBinaryArray, \ - garrow_binary_array, \ - GARROW_TYPE_ARRAY) - -static void -garrow_binary_array_init(GArrowBinaryArray *object) -{ -} - -static void -garrow_binary_array_class_init(GArrowBinaryArrayClass *klass) -{ -} - -/** - * garrow_binary_array_get_value: - * @array: A #GArrowBinaryArray. - * @i: The index of the target value. - * @length: (out): The length of the value. - * - * Returns: (array length=length): The i-th value. - */ -const guint8 * -garrow_binary_array_get_value(GArrowBinaryArray *array, - gint64 i, - gint32 *length) -{ - auto arrow_array = garrow_array_get_raw(GARROW_ARRAY(array)); - auto arrow_binary_array = - static_cast<arrow::BinaryArray *>(arrow_array.get()); - return arrow_binary_array->GetValue(i, length); -} - -G_END_DECLS http://git-wip-us.apache.org/repos/asf/arrow/blob/7c1fef51/c_glib/arrow-glib/binary-array.h ---------------------------------------------------------------------- diff --git a/c_glib/arrow-glib/binary-array.h b/c_glib/arrow-glib/binary-array.h deleted file mode 100644 index ab63ece..0000000 --- a/c_glib/arrow-glib/binary-array.h +++ /dev/null @@ -1,72 +0,0 @@ -/* - * 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. - */ - -#pragma once - -#include <arrow-glib/array.h> - -G_BEGIN_DECLS - -#define GARROW_TYPE_BINARY_ARRAY \ - (garrow_binary_array_get_type()) -#define GARROW_BINARY_ARRAY(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST((obj), \ - GARROW_TYPE_BINARY_ARRAY, \ - GArrowBinaryArray)) -#define GARROW_BINARY_ARRAY_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_CAST((klass), \ - GARROW_TYPE_BINARY_ARRAY, \ - GArrowBinaryArrayClass)) -#define GARROW_IS_BINARY_ARRAY(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE((obj), \ - GARROW_TYPE_BINARY_ARRAY)) -#define GARROW_IS_BINARY_ARRAY_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_TYPE((klass), \ - GARROW_TYPE_BINARY_ARRAY)) -#define GARROW_BINARY_ARRAY_GET_CLASS(obj) \ - (G_TYPE_INSTANCE_GET_CLASS((obj), \ - GARROW_TYPE_BINARY_ARRAY, \ - GArrowBinaryArrayClass)) - -typedef struct _GArrowBinaryArray GArrowBinaryArray; -typedef struct _GArrowBinaryArrayClass GArrowBinaryArrayClass; - -/** - * GArrowBinaryArray: - * - * It wraps `arrow::BinaryArray`. - */ -struct _GArrowBinaryArray -{ - /*< private >*/ - GArrowArray parent_instance; -}; - -struct _GArrowBinaryArrayClass -{ - GArrowArrayClass parent_class; -}; - -GType garrow_binary_array_get_type(void) G_GNUC_CONST; - -const guint8 *garrow_binary_array_get_value(GArrowBinaryArray *array, - gint64 i, - gint32 *length); - -G_END_DECLS http://git-wip-us.apache.org/repos/asf/arrow/blob/7c1fef51/c_glib/arrow-glib/boolean-array.cpp ---------------------------------------------------------------------- diff --git a/c_glib/arrow-glib/boolean-array.cpp b/c_glib/arrow-glib/boolean-array.cpp deleted file mode 100644 index 62fc40f..0000000 --- a/c_glib/arrow-glib/boolean-array.cpp +++ /dev/null @@ -1,69 +0,0 @@ -/* - * 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. - */ - -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif - -#include <arrow-glib/array.hpp> -#include <arrow-glib/boolean-array.h> - -G_BEGIN_DECLS - -/** - * SECTION: boolean-array - * @short_description: Boolean array class - * - * #GArrowBooleanArray is a class for binary array. It can store zero - * or more boolean data. - * - * #GArrowBooleanArray is immutable. You need to use - * #GArrowBooleanArrayBuilder to create a new array. - */ - -G_DEFINE_TYPE(GArrowBooleanArray, \ - garrow_boolean_array, \ - GARROW_TYPE_ARRAY) - -static void -garrow_boolean_array_init(GArrowBooleanArray *object) -{ -} - -static void -garrow_boolean_array_class_init(GArrowBooleanArrayClass *klass) -{ -} - -/** - * garrow_boolean_array_get_value: - * @array: A #GArrowBooleanArray. - * @i: The index of the target value. - * - * Returns: The i-th value. - */ -gboolean -garrow_boolean_array_get_value(GArrowBooleanArray *array, - gint64 i) -{ - auto arrow_array = garrow_array_get_raw(GARROW_ARRAY(array)); - return static_cast<arrow::BooleanArray *>(arrow_array.get())->Value(i); -} - -G_END_DECLS http://git-wip-us.apache.org/repos/asf/arrow/blob/7c1fef51/c_glib/arrow-glib/boolean-array.h ---------------------------------------------------------------------- diff --git a/c_glib/arrow-glib/boolean-array.h b/c_glib/arrow-glib/boolean-array.h deleted file mode 100644 index 9899fdf..0000000 --- a/c_glib/arrow-glib/boolean-array.h +++ /dev/null @@ -1,70 +0,0 @@ -/* - * 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. - */ - -#pragma once - -#include <arrow-glib/array.h> - -G_BEGIN_DECLS - -#define GARROW_TYPE_BOOLEAN_ARRAY \ - (garrow_boolean_array_get_type()) -#define GARROW_BOOLEAN_ARRAY(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST((obj), \ - GARROW_TYPE_BOOLEAN_ARRAY, \ - GArrowBooleanArray)) -#define GARROW_BOOLEAN_ARRAY_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_CAST((klass), \ - GARROW_TYPE_BOOLEAN_ARRAY, \ - GArrowBooleanArrayClass)) -#define GARROW_IS_BOOLEAN_ARRAY(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE((obj), \ - GARROW_TYPE_BOOLEAN_ARRAY)) -#define GARROW_IS_BOOLEAN_ARRAY_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_TYPE((klass), \ - GARROW_TYPE_BOOLEAN_ARRAY)) -#define GARROW_BOOLEAN_ARRAY_GET_CLASS(obj) \ - (G_TYPE_INSTANCE_GET_CLASS((obj), \ - GARROW_TYPE_BOOLEAN_ARRAY, \ - GArrowBooleanArrayClass)) - -typedef struct _GArrowBooleanArray GArrowBooleanArray; -typedef struct _GArrowBooleanArrayClass GArrowBooleanArrayClass; - -/** - * GArrowBooleanArray: - * - * It wraps `arrow::BooleanArray`. - */ -struct _GArrowBooleanArray -{ - /*< private >*/ - GArrowArray parent_instance; -}; - -struct _GArrowBooleanArrayClass -{ - GArrowArrayClass parent_class; -}; - -GType garrow_boolean_array_get_type (void) G_GNUC_CONST; -gboolean garrow_boolean_array_get_value (GArrowBooleanArray *array, - gint64 i); - -G_END_DECLS http://git-wip-us.apache.org/repos/asf/arrow/blob/7c1fef51/c_glib/arrow-glib/double-array.cpp ---------------------------------------------------------------------- diff --git a/c_glib/arrow-glib/double-array.cpp b/c_glib/arrow-glib/double-array.cpp deleted file mode 100644 index ecc55d7..0000000 --- a/c_glib/arrow-glib/double-array.cpp +++ /dev/null @@ -1,69 +0,0 @@ -/* - * 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. - */ - -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif - -#include <arrow-glib/array.hpp> -#include <arrow-glib/double-array.h> - -G_BEGIN_DECLS - -/** - * SECTION: double-array - * @short_description: 64-bit floating point array class - * - * #GArrowDoubleArray is a class for 64-bit floating point array. It - * can store zero or more 64-bit floating data. - * - * #GArrowDoubleArray is immutable. You need to use - * #GArrowDoubleArrayBuilder to create a new array. - */ - -G_DEFINE_TYPE(GArrowDoubleArray, \ - garrow_double_array, \ - GARROW_TYPE_ARRAY) - -static void -garrow_double_array_init(GArrowDoubleArray *object) -{ -} - -static void -garrow_double_array_class_init(GArrowDoubleArrayClass *klass) -{ -} - -/** - * garrow_double_array_get_value: - * @array: A #GArrowDoubleArray. - * @i: The index of the target value. - * - * Returns: The i-th value. - */ -gdouble -garrow_double_array_get_value(GArrowDoubleArray *array, - gint64 i) -{ - auto arrow_array = garrow_array_get_raw(GARROW_ARRAY(array)); - return static_cast<arrow::DoubleArray *>(arrow_array.get())->Value(i); -} - -G_END_DECLS http://git-wip-us.apache.org/repos/asf/arrow/blob/7c1fef51/c_glib/arrow-glib/double-array.h ---------------------------------------------------------------------- diff --git a/c_glib/arrow-glib/double-array.h b/c_glib/arrow-glib/double-array.h deleted file mode 100644 index b9a2365..0000000 --- a/c_glib/arrow-glib/double-array.h +++ /dev/null @@ -1,71 +0,0 @@ -/* - * 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. - */ - -#pragma once - -#include <arrow-glib/array.h> - -G_BEGIN_DECLS - -#define GARROW_TYPE_DOUBLE_ARRAY \ - (garrow_double_array_get_type()) -#define GARROW_DOUBLE_ARRAY(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST((obj), \ - GARROW_TYPE_DOUBLE_ARRAY, \ - GArrowDoubleArray)) -#define GARROW_DOUBLE_ARRAY_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_CAST((klass), \ - GARROW_TYPE_DOUBLE_ARRAY, \ - GArrowDoubleArrayClass)) -#define GARROW_IS_DOUBLE_ARRAY(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE((obj), \ - GARROW_TYPE_DOUBLE_ARRAY)) -#define GARROW_IS_DOUBLE_ARRAY_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_TYPE((klass), \ - GARROW_TYPE_DOUBLE_ARRAY)) -#define GARROW_DOUBLE_ARRAY_GET_CLASS(obj) \ - (G_TYPE_INSTANCE_GET_CLASS((obj), \ - GARROW_TYPE_DOUBLE_ARRAY, \ - GArrowDoubleArrayClass)) - -typedef struct _GArrowDoubleArray GArrowDoubleArray; -typedef struct _GArrowDoubleArrayClass GArrowDoubleArrayClass; - -/** - * GArrowDoubleArray: - * - * It wraps `arrow::DoubleArray`. - */ -struct _GArrowDoubleArray -{ - /*< private >*/ - GArrowArray parent_instance; -}; - -struct _GArrowDoubleArrayClass -{ - GArrowArrayClass parent_class; -}; - -GType garrow_double_array_get_type(void) G_GNUC_CONST; - -gdouble garrow_double_array_get_value(GArrowDoubleArray *array, - gint64 i); - -G_END_DECLS http://git-wip-us.apache.org/repos/asf/arrow/blob/7c1fef51/c_glib/arrow-glib/float-array.cpp ---------------------------------------------------------------------- diff --git a/c_glib/arrow-glib/float-array.cpp b/c_glib/arrow-glib/float-array.cpp deleted file mode 100644 index 28e8047..0000000 --- a/c_glib/arrow-glib/float-array.cpp +++ /dev/null @@ -1,69 +0,0 @@ -/* - * 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. - */ - -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif - -#include <arrow-glib/array.hpp> -#include <arrow-glib/float-array.h> - -G_BEGIN_DECLS - -/** - * SECTION: float-array - * @short_description: 32-bit floating point array class - * - * #GArrowFloatArray is a class for 32-bit floating point array. It - * can store zero or more 32-bit floating data. - * - * #GArrowFloatArray is immutable. You need to use - * #GArrowFloatArrayBuilder to create a new array. - */ - -G_DEFINE_TYPE(GArrowFloatArray, \ - garrow_float_array, \ - GARROW_TYPE_ARRAY) - -static void -garrow_float_array_init(GArrowFloatArray *object) -{ -} - -static void -garrow_float_array_class_init(GArrowFloatArrayClass *klass) -{ -} - -/** - * garrow_float_array_get_value: - * @array: A #GArrowFloatArray. - * @i: The index of the target value. - * - * Returns: The i-th value. - */ -gfloat -garrow_float_array_get_value(GArrowFloatArray *array, - gint64 i) -{ - auto arrow_array = garrow_array_get_raw(GARROW_ARRAY(array)); - return static_cast<arrow::FloatArray *>(arrow_array.get())->Value(i); -} - -G_END_DECLS http://git-wip-us.apache.org/repos/asf/arrow/blob/7c1fef51/c_glib/arrow-glib/float-array.h ---------------------------------------------------------------------- diff --git a/c_glib/arrow-glib/float-array.h b/c_glib/arrow-glib/float-array.h deleted file mode 100644 index d113f97..0000000 --- a/c_glib/arrow-glib/float-array.h +++ /dev/null @@ -1,71 +0,0 @@ -/* - * 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. - */ - -#pragma once - -#include <arrow-glib/array.h> - -G_BEGIN_DECLS - -#define GARROW_TYPE_FLOAT_ARRAY \ - (garrow_float_array_get_type()) -#define GARROW_FLOAT_ARRAY(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST((obj), \ - GARROW_TYPE_FLOAT_ARRAY, \ - GArrowFloatArray)) -#define GARROW_FLOAT_ARRAY_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_CAST((klass), \ - GARROW_TYPE_FLOAT_ARRAY, \ - GArrowFloatArrayClass)) -#define GARROW_IS_FLOAT_ARRAY(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE((obj), \ - GARROW_TYPE_FLOAT_ARRAY)) -#define GARROW_IS_FLOAT_ARRAY_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_TYPE((klass), \ - GARROW_TYPE_FLOAT_ARRAY)) -#define GARROW_FLOAT_ARRAY_GET_CLASS(obj) \ - (G_TYPE_INSTANCE_GET_CLASS((obj), \ - GARROW_TYPE_FLOAT_ARRAY, \ - GArrowFloatArrayClass)) - -typedef struct _GArrowFloatArray GArrowFloatArray; -typedef struct _GArrowFloatArrayClass GArrowFloatArrayClass; - -/** - * GArrowFloatArray: - * - * It wraps `arrow::FloatArray`. - */ -struct _GArrowFloatArray -{ - /*< private >*/ - GArrowArray parent_instance; -}; - -struct _GArrowFloatArrayClass -{ - GArrowArrayClass parent_class; -}; - -GType garrow_float_array_get_type(void) G_GNUC_CONST; - -gfloat garrow_float_array_get_value(GArrowFloatArray *array, - gint64 i); - -G_END_DECLS http://git-wip-us.apache.org/repos/asf/arrow/blob/7c1fef51/c_glib/arrow-glib/int16-array.cpp ---------------------------------------------------------------------- diff --git a/c_glib/arrow-glib/int16-array.cpp b/c_glib/arrow-glib/int16-array.cpp deleted file mode 100644 index 456d085..0000000 --- a/c_glib/arrow-glib/int16-array.cpp +++ /dev/null @@ -1,69 +0,0 @@ -/* - * 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. - */ - -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif - -#include <arrow-glib/array.hpp> -#include <arrow-glib/int16-array.h> - -G_BEGIN_DECLS - -/** - * SECTION: int16-array - * @short_description: 16-bit integer array class - * - * #GArrowInt16Array is a class for 16-bit integer array. It can store - * zero or more 16-bit integer data. - * - * #GArrowInt16Array is immutable. You need to use - * #GArrowInt16ArrayBuilder to create a new array. - */ - -G_DEFINE_TYPE(GArrowInt16Array, \ - garrow_int16_array, \ - GARROW_TYPE_ARRAY) - -static void -garrow_int16_array_init(GArrowInt16Array *object) -{ -} - -static void -garrow_int16_array_class_init(GArrowInt16ArrayClass *klass) -{ -} - -/** - * garrow_int16_array_get_value: - * @array: A #GArrowInt16Array. - * @i: The index of the target value. - * - * Returns: The i-th value. - */ -gint16 -garrow_int16_array_get_value(GArrowInt16Array *array, - gint64 i) -{ - auto arrow_array = garrow_array_get_raw(GARROW_ARRAY(array)); - return static_cast<arrow::Int16Array *>(arrow_array.get())->Value(i); -} - -G_END_DECLS http://git-wip-us.apache.org/repos/asf/arrow/blob/7c1fef51/c_glib/arrow-glib/int16-array.h ---------------------------------------------------------------------- diff --git a/c_glib/arrow-glib/int16-array.h b/c_glib/arrow-glib/int16-array.h deleted file mode 100644 index d37144c..0000000 --- a/c_glib/arrow-glib/int16-array.h +++ /dev/null @@ -1,71 +0,0 @@ -/* - * 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. - */ - -#pragma once - -#include <arrow-glib/array.h> - -G_BEGIN_DECLS - -#define GARROW_TYPE_INT16_ARRAY \ - (garrow_int16_array_get_type()) -#define GARROW_INT16_ARRAY(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST((obj), \ - GARROW_TYPE_INT16_ARRAY, \ - GArrowInt16Array)) -#define GARROW_INT16_ARRAY_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_CAST((klass), \ - GARROW_TYPE_INT16_ARRAY, \ - GArrowInt16ArrayClass)) -#define GARROW_IS_INT16_ARRAY(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE((obj), \ - GARROW_TYPE_INT16_ARRAY)) -#define GARROW_IS_INT16_ARRAY_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_TYPE((klass), \ - GARROW_TYPE_INT16_ARRAY)) -#define GARROW_INT16_ARRAY_GET_CLASS(obj) \ - (G_TYPE_INSTANCE_GET_CLASS((obj), \ - GARROW_TYPE_INT16_ARRAY, \ - GArrowInt16ArrayClass)) - -typedef struct _GArrowInt16Array GArrowInt16Array; -typedef struct _GArrowInt16ArrayClass GArrowInt16ArrayClass; - -/** - * GArrowInt16Array: - * - * It wraps `arrow::Int16Array`. - */ -struct _GArrowInt16Array -{ - /*< private >*/ - GArrowArray parent_instance; -}; - -struct _GArrowInt16ArrayClass -{ - GArrowArrayClass parent_class; -}; - -GType garrow_int16_array_get_type(void) G_GNUC_CONST; - -gint16 garrow_int16_array_get_value(GArrowInt16Array *array, - gint64 i); - -G_END_DECLS http://git-wip-us.apache.org/repos/asf/arrow/blob/7c1fef51/c_glib/arrow-glib/int32-array.cpp ---------------------------------------------------------------------- diff --git a/c_glib/arrow-glib/int32-array.cpp b/c_glib/arrow-glib/int32-array.cpp deleted file mode 100644 index 8bd6f35..0000000 --- a/c_glib/arrow-glib/int32-array.cpp +++ /dev/null @@ -1,69 +0,0 @@ -/* - * 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. - */ - -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif - -#include <arrow-glib/array.hpp> -#include <arrow-glib/int32-array.h> - -G_BEGIN_DECLS - -/** - * SECTION: int32-array - * @short_description: 32-bit integer array class - * - * #GArrowInt32Array is a class for 32-bit integer array. It can store - * zero or more 32-bit integer data. - * - * #GArrowInt32Array is immutable. You need to use - * #GArrowInt32ArrayBuilder to create a new array. - */ - -G_DEFINE_TYPE(GArrowInt32Array, \ - garrow_int32_array, \ - GARROW_TYPE_ARRAY) - -static void -garrow_int32_array_init(GArrowInt32Array *object) -{ -} - -static void -garrow_int32_array_class_init(GArrowInt32ArrayClass *klass) -{ -} - -/** - * garrow_int32_array_get_value: - * @array: A #GArrowInt32Array. - * @i: The index of the target value. - * - * Returns: The i-th value. - */ -gint32 -garrow_int32_array_get_value(GArrowInt32Array *array, - gint64 i) -{ - auto arrow_array = garrow_array_get_raw(GARROW_ARRAY(array)); - return static_cast<arrow::Int32Array *>(arrow_array.get())->Value(i); -} - -G_END_DECLS http://git-wip-us.apache.org/repos/asf/arrow/blob/7c1fef51/c_glib/arrow-glib/int32-array.h ---------------------------------------------------------------------- diff --git a/c_glib/arrow-glib/int32-array.h b/c_glib/arrow-glib/int32-array.h deleted file mode 100644 index cce2b41..0000000 --- a/c_glib/arrow-glib/int32-array.h +++ /dev/null @@ -1,71 +0,0 @@ -/* - * 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. - */ - -#pragma once - -#include <arrow-glib/array.h> - -G_BEGIN_DECLS - -#define GARROW_TYPE_INT32_ARRAY \ - (garrow_int32_array_get_type()) -#define GARROW_INT32_ARRAY(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST((obj), \ - GARROW_TYPE_INT32_ARRAY, \ - GArrowInt32Array)) -#define GARROW_INT32_ARRAY_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_CAST((klass), \ - GARROW_TYPE_INT32_ARRAY, \ - GArrowInt32ArrayClass)) -#define GARROW_IS_INT32_ARRAY(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE((obj), \ - GARROW_TYPE_INT32_ARRAY)) -#define GARROW_IS_INT32_ARRAY_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_TYPE((klass), \ - GARROW_TYPE_INT32_ARRAY)) -#define GARROW_INT32_ARRAY_GET_CLASS(obj) \ - (G_TYPE_INSTANCE_GET_CLASS((obj), \ - GARROW_TYPE_INT32_ARRAY, \ - GArrowInt32ArrayClass)) - -typedef struct _GArrowInt32Array GArrowInt32Array; -typedef struct _GArrowInt32ArrayClass GArrowInt32ArrayClass; - -/** - * GArrowInt32Array: - * - * It wraps `arrow::Int32Array`. - */ -struct _GArrowInt32Array -{ - /*< private >*/ - GArrowArray parent_instance; -}; - -struct _GArrowInt32ArrayClass -{ - GArrowArrayClass parent_class; -}; - -GType garrow_int32_array_get_type(void) G_GNUC_CONST; - -gint32 garrow_int32_array_get_value(GArrowInt32Array *array, - gint64 i); - -G_END_DECLS http://git-wip-us.apache.org/repos/asf/arrow/blob/7c1fef51/c_glib/arrow-glib/int64-array.cpp ---------------------------------------------------------------------- diff --git a/c_glib/arrow-glib/int64-array.cpp b/c_glib/arrow-glib/int64-array.cpp deleted file mode 100644 index be49d5b..0000000 --- a/c_glib/arrow-glib/int64-array.cpp +++ /dev/null @@ -1,69 +0,0 @@ -/* - * 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. - */ - -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif - -#include <arrow-glib/array.hpp> -#include <arrow-glib/int64-array.h> - -G_BEGIN_DECLS - -/** - * SECTION: int64-array - * @short_description: 64-bit integer array class - * - * #GArrowInt64Array is a class for 64-bit integer array. It can store - * zero or more 64-bit integer data. - * - * #GArrowInt64Array is immutable. You need to use - * #GArrowInt64ArrayBuilder to create a new array. - */ - -G_DEFINE_TYPE(GArrowInt64Array, \ - garrow_int64_array, \ - GARROW_TYPE_ARRAY) - -static void -garrow_int64_array_init(GArrowInt64Array *object) -{ -} - -static void -garrow_int64_array_class_init(GArrowInt64ArrayClass *klass) -{ -} - -/** - * garrow_int64_array_get_value: - * @array: A #GArrowInt64Array. - * @i: The index of the target value. - * - * Returns: The i-th value. - */ -gint64 -garrow_int64_array_get_value(GArrowInt64Array *array, - gint64 i) -{ - auto arrow_array = garrow_array_get_raw(GARROW_ARRAY(array)); - return static_cast<arrow::Int64Array *>(arrow_array.get())->Value(i); -} - -G_END_DECLS
