You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by we...@apache.org on 2017/03/17 01:09:48 UTC
[1/9] arrow git commit: ARROW-631: [GLib] Import
Repository: arrow
Updated Branches:
refs/heads/master c13d671b1 -> 39c7274fc
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/test/test-uint64-data-type.rb
----------------------------------------------------------------------
diff --git a/c_glib/test/test-uint64-data-type.rb b/c_glib/test/test-uint64-data-type.rb
new file mode 100644
index 0000000..403fc9a
--- /dev/null
+++ b/c_glib/test/test-uint64-data-type.rb
@@ -0,0 +1,28 @@
+# 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 TestUInt64DataType < Test::Unit::TestCase
+ def test_type
+ data_type = Arrow::UInt64DataType.new
+ assert_equal(Arrow::Type::UINT64, data_type.type)
+ end
+
+ def test_to_s
+ data_type = Arrow::UInt64DataType.new
+ assert_equal("uint64", data_type.to_s)
+ end
+end
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/test/test-uint8-array.rb
----------------------------------------------------------------------
diff --git a/c_glib/test/test-uint8-array.rb b/c_glib/test/test-uint8-array.rb
new file mode 100644
index 0000000..02f3470
--- /dev/null
+++ b/c_glib/test/test-uint8-array.rb
@@ -0,0 +1,25 @@
+# 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 TestUInt8Array < Test::Unit::TestCase
+ def test_value
+ builder = Arrow::UInt8ArrayBuilder.new
+ builder.append(1)
+ array = builder.finish
+ assert_equal(1, array.get_value(0))
+ end
+end
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/test/test-uint8-data-type.rb
----------------------------------------------------------------------
diff --git a/c_glib/test/test-uint8-data-type.rb b/c_glib/test/test-uint8-data-type.rb
new file mode 100644
index 0000000..eb91da2
--- /dev/null
+++ b/c_glib/test/test-uint8-data-type.rb
@@ -0,0 +1,28 @@
+# 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 TestUInt8DataType < Test::Unit::TestCase
+ def test_type
+ data_type = Arrow::UInt8DataType.new
+ assert_equal(Arrow::Type::UINT8, data_type.type)
+ end
+
+ def test_to_s
+ data_type = Arrow::UInt8DataType.new
+ assert_equal("uint8", data_type.to_s)
+ end
+end
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/ci/travis_before_script_c_glib.sh
----------------------------------------------------------------------
diff --git a/ci/travis_before_script_c_glib.sh b/ci/travis_before_script_c_glib.sh
new file mode 100755
index 0000000..1a828e7
--- /dev/null
+++ b/ci/travis_before_script_c_glib.sh
@@ -0,0 +1,40 @@
+#!/usr/bin/env bash
+
+# Licensed 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. See accompanying LICENSE file.
+
+
+set -ex
+
+if [ $TRAVIS_OS_NAME == "osx" ]; then
+ brew install gtk-doc autoconf-archive gobject-introspection
+fi
+
+gem install gobject-introspection
+
+ARROW_C_GLIB_DIR=$TRAVIS_BUILD_DIR/c_glib
+
+pushd $ARROW_C_GLIB_DIR
+
+: ${ARROW_C_GLIB_INSTALL=$TRAVIS_BUILD_DIR/c-glib-install}
+
+./autogen.sh
+
+export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:$ARROW_CPP_INSTALL/lib/pkgconfig
+export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ARROW_CPP_INSTALL/lib
+
+./configure --prefix=${ARROW_C_GLIB_INSTALL} --enable-gtk-doc
+
+make -j4
+make install
+
+popd
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/ci/travis_script_c_glib.sh
----------------------------------------------------------------------
diff --git a/ci/travis_script_c_glib.sh b/ci/travis_script_c_glib.sh
new file mode 100755
index 0000000..1492354
--- /dev/null
+++ b/ci/travis_script_c_glib.sh
@@ -0,0 +1,24 @@
+#!/usr/bin/env bash
+
+# Licensed 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. See accompanying LICENSE file.
+
+set -e
+
+ARROW_C_GLIB_DIR=$TRAVIS_BUILD_DIR/c_glib
+
+pushd $ARROW_C_GLIB_DIR
+
+export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ARROW_CPP_INSTALL/lib
+NO_MAKE=yes test/run-test.sh
+
+popd
[6/9] arrow git commit: ARROW-631: [GLib] Import
Posted by we...@apache.org.
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/int8-array-builder.h
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/int8-array-builder.h b/c_glib/arrow-glib/int8-array-builder.h
new file mode 100644
index 0000000..321e931
--- /dev/null
+++ b/c_glib/arrow-glib/int8-array-builder.h
@@ -0,0 +1,76 @@
+/*
+ * 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-builder.h>
+
+G_BEGIN_DECLS
+
+#define GARROW_TYPE_INT8_ARRAY_BUILDER \
+ (garrow_int8_array_builder_get_type())
+#define GARROW_INT8_ARRAY_BUILDER(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj), \
+ GARROW_TYPE_INT8_ARRAY_BUILDER, \
+ GArrowInt8ArrayBuilder))
+#define GARROW_INT8_ARRAY_BUILDER_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST((klass), \
+ GARROW_TYPE_INT8_ARRAY_BUILDER, \
+ GArrowInt8ArrayBuilderClass))
+#define GARROW_IS_INT8_ARRAY_BUILDER(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj), \
+ GARROW_TYPE_INT8_ARRAY_BUILDER))
+#define GARROW_IS_INT8_ARRAY_BUILDER_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE((klass), \
+ GARROW_TYPE_INT8_ARRAY_BUILDER))
+#define GARROW_INT8_ARRAY_BUILDER_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS((obj), \
+ GARROW_TYPE_INT8_ARRAY_BUILDER, \
+ GArrowInt8ArrayBuilderClass))
+
+typedef struct _GArrowInt8ArrayBuilder GArrowInt8ArrayBuilder;
+typedef struct _GArrowInt8ArrayBuilderClass GArrowInt8ArrayBuilderClass;
+
+/**
+ * GArrowInt8ArrayBuilder:
+ *
+ * It wraps `arrow::Int8Builder`.
+ */
+struct _GArrowInt8ArrayBuilder
+{
+ /*< private >*/
+ GArrowArrayBuilder parent_instance;
+};
+
+struct _GArrowInt8ArrayBuilderClass
+{
+ GArrowArrayBuilderClass parent_class;
+};
+
+GType garrow_int8_array_builder_get_type(void) G_GNUC_CONST;
+
+GArrowInt8ArrayBuilder *garrow_int8_array_builder_new(void);
+
+gboolean garrow_int8_array_builder_append(GArrowInt8ArrayBuilder *builder,
+ gint8 value,
+ GError **error);
+gboolean garrow_int8_array_builder_append_null(GArrowInt8ArrayBuilder *builder,
+ GError **error);
+
+G_END_DECLS
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/int8-array.cpp
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/int8-array.cpp b/c_glib/arrow-glib/int8-array.cpp
new file mode 100644
index 0000000..d3f12ec
--- /dev/null
+++ b/c_glib/arrow-glib/int8-array.cpp
@@ -0,0 +1,69 @@
+/*
+ * 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/int8-array.h>
+
+G_BEGIN_DECLS
+
+/**
+ * SECTION: int8-array
+ * @short_description: 8-bit integer array class
+ *
+ * #GArrowInt8Array is a class for 8-bit integer array. It can store
+ * zero or more 8-bit integer data.
+ *
+ * #GArrowInt8Array is immutable. You need to use
+ * #GArrowInt8ArrayBuilder to create a new array.
+ */
+
+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_END_DECLS
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/int8-array.h
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/int8-array.h b/c_glib/arrow-glib/int8-array.h
new file mode 100644
index 0000000..0e1e901
--- /dev/null
+++ b/c_glib/arrow-glib/int8-array.h
@@ -0,0 +1,71 @@
+/*
+ * 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_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);
+
+G_END_DECLS
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/int8-data-type.cpp
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/int8-data-type.cpp b/c_glib/arrow-glib/int8-data-type.cpp
new file mode 100644
index 0000000..55b1ebc
--- /dev/null
+++ b/c_glib/arrow-glib/int8-data-type.cpp
@@ -0,0 +1,67 @@
+/*
+ * 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/data-type.hpp>
+#include <arrow-glib/int8-data-type.h>
+
+G_BEGIN_DECLS
+
+/**
+ * SECTION: int8-data-type
+ * @short_description: 8-bit integer data type
+ *
+ * #GArrowInt8DataType is a class for 8-bit integer data type.
+ */
+
+G_DEFINE_TYPE(GArrowInt8DataType, \
+ garrow_int8_data_type, \
+ GARROW_TYPE_DATA_TYPE)
+
+static void
+garrow_int8_data_type_init(GArrowInt8DataType *object)
+{
+}
+
+static void
+garrow_int8_data_type_class_init(GArrowInt8DataTypeClass *klass)
+{
+}
+
+/**
+ * garrow_int8_data_type_new:
+ *
+ * Returns: The newly created 8-bit integer data type.
+ */
+GArrowInt8DataType *
+garrow_int8_data_type_new(void)
+{
+ auto arrow_data_type = arrow::int8();
+
+ GArrowInt8DataType *data_type =
+ GARROW_INT8_DATA_TYPE(g_object_new(GARROW_TYPE_INT8_DATA_TYPE,
+ "data-type", &arrow_data_type,
+ NULL));
+ return data_type;
+}
+
+G_END_DECLS
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/int8-data-type.h
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/int8-data-type.h b/c_glib/arrow-glib/int8-data-type.h
new file mode 100644
index 0000000..4343bd1
--- /dev/null
+++ b/c_glib/arrow-glib/int8-data-type.h
@@ -0,0 +1,69 @@
+/*
+ * 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/data-type.h>
+
+G_BEGIN_DECLS
+
+#define GARROW_TYPE_INT8_DATA_TYPE \
+ (garrow_int8_data_type_get_type())
+#define GARROW_INT8_DATA_TYPE(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj), \
+ GARROW_TYPE_INT8_DATA_TYPE, \
+ GArrowInt8DataType))
+#define GARROW_INT8_DATA_TYPE_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST((klass), \
+ GARROW_TYPE_INT8_DATA_TYPE, \
+ GArrowInt8DataTypeClass))
+#define GARROW_IS_INT8_DATA_TYPE(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj), \
+ GARROW_TYPE_INT8_DATA_TYPE))
+#define GARROW_IS_INT8_DATA_TYPE_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE((klass), \
+ GARROW_TYPE_INT8_DATA_TYPE))
+#define GARROW_INT8_DATA_TYPE_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS((obj), \
+ GARROW_TYPE_INT8_DATA_TYPE, \
+ GArrowInt8DataTypeClass))
+
+typedef struct _GArrowInt8DataType GArrowInt8DataType;
+typedef struct _GArrowInt8DataTypeClass GArrowInt8DataTypeClass;
+
+/**
+ * GArrowInt8DataType:
+ *
+ * It wraps `arrow::Int8Type`.
+ */
+struct _GArrowInt8DataType
+{
+ /*< private >*/
+ GArrowDataType parent_instance;
+};
+
+struct _GArrowInt8DataTypeClass
+{
+ GArrowDataTypeClass parent_class;
+};
+
+GType garrow_int8_data_type_get_type (void) G_GNUC_CONST;
+GArrowInt8DataType *garrow_int8_data_type_new (void);
+
+G_END_DECLS
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/io-enums.c.template
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/io-enums.c.template b/c_glib/arrow-glib/io-enums.c.template
new file mode 100644
index 0000000..10ee775
--- /dev/null
+++ b/c_glib/arrow-glib/io-enums.c.template
@@ -0,0 +1,56 @@
+/*** BEGIN file-header ***/
+/*
+ * 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/arrow-io-glib.h>
+/*** END file-header ***/
+
+/*** BEGIN file-production ***/
+
+/* enumerations from "@filename@" */
+/*** END file-production ***/
+
+/*** BEGIN value-header ***/
+GType
+@enum_name@_get_type(void)
+{
+ static GType etype = 0;
+ if (G_UNLIKELY(etype == 0)) {
+ static const G@Type@Value values[] = {
+/*** END value-header ***/
+
+/*** BEGIN value-production ***/
+ {@VALUENAME@, "@VALUENAME@", "@valuenick@"},
+/*** END value-production ***/
+
+/*** BEGIN value-tail ***/
+ {0, NULL, NULL}
+ };
+ etype = g_@type@_register_static(g_intern_static_string("@EnumName@"), values);
+ }
+ return etype;
+}
+/*** END value-tail ***/
+
+/*** BEGIN file-tail ***/
+/*** END file-tail ***/
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/io-enums.h.template
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/io-enums.h.template b/c_glib/arrow-glib/io-enums.h.template
new file mode 100644
index 0000000..429141d
--- /dev/null
+++ b/c_glib/arrow-glib/io-enums.h.template
@@ -0,0 +1,41 @@
+/*** BEGIN file-header ***/
+/*
+ * 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/io-file-mode.h>
+
+G_BEGIN_DECLS
+/*** END file-header ***/
+
+/*** BEGIN file-production ***/
+
+/* enumerations from "@filename@" */
+/*** END file-production ***/
+
+/*** BEGIN value-header ***/
+GType @enum_name@_get_type(void) G_GNUC_CONST;
+#define @ENUMPREFIX@_TYPE_@ENUMSHORT@ (@enum_name@_get_type())
+/*** END value-header ***/
+
+/*** BEGIN file-tail ***/
+
+G_END_DECLS
+/*** END file-tail ***/
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/io-file-mode.cpp
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/io-file-mode.cpp b/c_glib/arrow-glib/io-file-mode.cpp
new file mode 100644
index 0000000..7998d3f
--- /dev/null
+++ b/c_glib/arrow-glib/io-file-mode.cpp
@@ -0,0 +1,63 @@
+/*
+ * 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/io-file-mode.hpp>
+
+/**
+ * SECTION: io-file-mode
+ * @title: GArrowIOFileMode
+ * @short_description: File mode mapping between Arrow and arrow-glib
+ *
+ * #GArrowIOFileMode provides file modes corresponding to
+ * `arrow::io::FileMode::type` values.
+ */
+
+GArrowIOFileMode
+garrow_io_file_mode_from_raw(arrow::io::FileMode::type mode)
+{
+ switch (mode) {
+ case arrow::io::FileMode::type::READ:
+ return GARROW_IO_FILE_MODE_READ;
+ case arrow::io::FileMode::type::WRITE:
+ return GARROW_IO_FILE_MODE_WRITE;
+ case arrow::io::FileMode::type::READWRITE:
+ return GARROW_IO_FILE_MODE_READWRITE;
+ default:
+ return GARROW_IO_FILE_MODE_READ;
+ }
+}
+
+arrow::io::FileMode::type
+garrow_io_file_mode_to_raw(GArrowIOFileMode mode)
+{
+ switch (mode) {
+ case GARROW_IO_FILE_MODE_READ:
+ return arrow::io::FileMode::type::READ;
+ case GARROW_IO_FILE_MODE_WRITE:
+ return arrow::io::FileMode::type::WRITE;
+ case GARROW_IO_FILE_MODE_READWRITE:
+ return arrow::io::FileMode::type::READWRITE;
+ default:
+ return arrow::io::FileMode::type::READ;
+ }
+}
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/io-file-mode.h
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/io-file-mode.h b/c_glib/arrow-glib/io-file-mode.h
new file mode 100644
index 0000000..03eca35
--- /dev/null
+++ b/c_glib/arrow-glib/io-file-mode.h
@@ -0,0 +1,40 @@
+/*
+ * 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 <glib-object.h>
+
+G_BEGIN_DECLS
+
+/**
+ * GArrowIOFileMode:
+ * @GARROW_IO_FILE_MODE_READ: For read.
+ * @GARROW_IO_FILE_MODE_WRITE: For write.
+ * @GARROW_IO_FILE_MODE_READWRITE: For read-write.
+ *
+ * They are corresponding to `arrow::io::FileMode::type` values.
+ */
+typedef enum {
+ GARROW_IO_FILE_MODE_READ,
+ GARROW_IO_FILE_MODE_WRITE,
+ GARROW_IO_FILE_MODE_READWRITE
+} GArrowIOFileMode;
+
+G_END_DECLS
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/io-file-mode.hpp
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/io-file-mode.hpp b/c_glib/arrow-glib/io-file-mode.hpp
new file mode 100644
index 0000000..b3d8ac6
--- /dev/null
+++ b/c_glib/arrow-glib/io-file-mode.hpp
@@ -0,0 +1,27 @@
+/*
+ * 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/io/interfaces.h>
+
+#include <arrow-glib/io-file-mode.h>
+
+GArrowIOFileMode garrow_io_file_mode_from_raw(arrow::io::FileMode::type mode);
+arrow::io::FileMode::type garrow_io_file_mode_to_raw(GArrowIOFileMode mode);
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/io-file-output-stream.cpp
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/io-file-output-stream.cpp b/c_glib/arrow-glib/io-file-output-stream.cpp
new file mode 100644
index 0000000..673e8cd
--- /dev/null
+++ b/c_glib/arrow-glib/io-file-output-stream.cpp
@@ -0,0 +1,231 @@
+/*
+ * 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/io/file.h>
+
+#include <arrow-glib/error.hpp>
+#include <arrow-glib/io-file.hpp>
+#include <arrow-glib/io-file-output-stream.hpp>
+#include <arrow-glib/io-output-stream.hpp>
+#include <arrow-glib/io-writeable.hpp>
+
+G_BEGIN_DECLS
+
+/**
+ * SECTION: io-file-output-stream
+ * @short_description: A file output stream.
+ *
+ * The #GArrowIOFileOutputStream is a class for file output stream.
+ */
+
+typedef struct GArrowIOFileOutputStreamPrivate_ {
+ std::shared_ptr<arrow::io::FileOutputStream> file_output_stream;
+} GArrowIOFileOutputStreamPrivate;
+
+enum {
+ PROP_0,
+ PROP_FILE_OUTPUT_STREAM
+};
+
+static std::shared_ptr<arrow::io::FileInterface>
+garrow_io_file_output_stream_get_raw_file_interface(GArrowIOFile *file)
+{
+ auto file_output_stream = GARROW_IO_FILE_OUTPUT_STREAM(file);
+ auto arrow_file_output_stream =
+ garrow_io_file_output_stream_get_raw(file_output_stream);
+ return arrow_file_output_stream;
+}
+
+static void
+garrow_io_file_interface_init(GArrowIOFileInterface *iface)
+{
+ iface->get_raw = garrow_io_file_output_stream_get_raw_file_interface;
+}
+
+static std::shared_ptr<arrow::io::Writeable>
+garrow_io_file_output_stream_get_raw_writeable_interface(GArrowIOWriteable *writeable)
+{
+ auto file_output_stream = GARROW_IO_FILE_OUTPUT_STREAM(writeable);
+ auto arrow_file_output_stream =
+ garrow_io_file_output_stream_get_raw(file_output_stream);
+ return arrow_file_output_stream;
+}
+
+static void
+garrow_io_writeable_interface_init(GArrowIOWriteableInterface *iface)
+{
+ iface->get_raw = garrow_io_file_output_stream_get_raw_writeable_interface;
+}
+
+static std::shared_ptr<arrow::io::OutputStream>
+garrow_io_file_output_stream_get_raw_output_stream_interface(GArrowIOOutputStream *output_stream)
+{
+ auto file_output_stream = GARROW_IO_FILE_OUTPUT_STREAM(output_stream);
+ auto arrow_file_output_stream =
+ garrow_io_file_output_stream_get_raw(file_output_stream);
+ return arrow_file_output_stream;
+}
+
+static void
+garrow_io_output_stream_interface_init(GArrowIOOutputStreamInterface *iface)
+{
+ iface->get_raw = garrow_io_file_output_stream_get_raw_output_stream_interface;
+}
+
+G_DEFINE_TYPE_WITH_CODE(GArrowIOFileOutputStream,
+ garrow_io_file_output_stream,
+ G_TYPE_OBJECT,
+ G_ADD_PRIVATE(GArrowIOFileOutputStream)
+ G_IMPLEMENT_INTERFACE(GARROW_IO_TYPE_FILE,
+ garrow_io_file_interface_init)
+ G_IMPLEMENT_INTERFACE(GARROW_IO_TYPE_WRITEABLE,
+ garrow_io_writeable_interface_init)
+ G_IMPLEMENT_INTERFACE(GARROW_IO_TYPE_OUTPUT_STREAM,
+ garrow_io_output_stream_interface_init));
+
+#define GARROW_IO_FILE_OUTPUT_STREAM_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE((obj), \
+ GARROW_IO_TYPE_FILE_OUTPUT_STREAM, \
+ GArrowIOFileOutputStreamPrivate))
+
+static void
+garrow_io_file_output_stream_finalize(GObject *object)
+{
+ GArrowIOFileOutputStreamPrivate *priv;
+
+ priv = GARROW_IO_FILE_OUTPUT_STREAM_GET_PRIVATE(object);
+
+ priv->file_output_stream = nullptr;
+
+ G_OBJECT_CLASS(garrow_io_file_output_stream_parent_class)->finalize(object);
+}
+
+static void
+garrow_io_file_output_stream_set_property(GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ GArrowIOFileOutputStreamPrivate *priv;
+
+ priv = GARROW_IO_FILE_OUTPUT_STREAM_GET_PRIVATE(object);
+
+ switch (prop_id) {
+ case PROP_FILE_OUTPUT_STREAM:
+ priv->file_output_stream =
+ *static_cast<std::shared_ptr<arrow::io::FileOutputStream> *>(g_value_get_pointer(value));
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+ break;
+ }
+}
+
+static void
+garrow_io_file_output_stream_get_property(GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ switch (prop_id) {
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+ break;
+ }
+}
+
+static void
+garrow_io_file_output_stream_init(GArrowIOFileOutputStream *object)
+{
+}
+
+static void
+garrow_io_file_output_stream_class_init(GArrowIOFileOutputStreamClass *klass)
+{
+ GObjectClass *gobject_class;
+ GParamSpec *spec;
+
+ gobject_class = G_OBJECT_CLASS(klass);
+
+ gobject_class->finalize = garrow_io_file_output_stream_finalize;
+ gobject_class->set_property = garrow_io_file_output_stream_set_property;
+ gobject_class->get_property = garrow_io_file_output_stream_get_property;
+
+ spec = g_param_spec_pointer("file-output-stream",
+ "io::FileOutputStream",
+ "The raw std::shared<arrow::io::FileOutputStream> *",
+ static_cast<GParamFlags>(G_PARAM_WRITABLE |
+ G_PARAM_CONSTRUCT_ONLY));
+ g_object_class_install_property(gobject_class, PROP_FILE_OUTPUT_STREAM, spec);
+}
+
+/**
+ * garrow_io_file_output_stream_open:
+ * @path: The path of the file output stream.
+ * @append: Whether the path is opened as append mode or recreate mode.
+ * @error: (nullable): Return location for a #GError or %NULL.
+ *
+ * Returns: (nullable) (transfer full): A newly opened
+ * #GArrowIOFileOutputStream or %NULL on error.
+ */
+GArrowIOFileOutputStream *
+garrow_io_file_output_stream_open(const gchar *path,
+ gboolean append,
+ GError **error)
+{
+ std::shared_ptr<arrow::io::FileOutputStream> arrow_file_output_stream;
+ auto status =
+ arrow::io::FileOutputStream::Open(std::string(path),
+ append,
+ &arrow_file_output_stream);
+ if (status.ok()) {
+ return garrow_io_file_output_stream_new_raw(&arrow_file_output_stream);
+ } else {
+ std::string context("[io][file-output-stream][open]: <");
+ context += path;
+ context += ">";
+ garrow_error_set(error, status, context.c_str());
+ return NULL;
+ }
+}
+
+G_END_DECLS
+
+GArrowIOFileOutputStream *
+garrow_io_file_output_stream_new_raw(std::shared_ptr<arrow::io::FileOutputStream> *arrow_file_output_stream)
+{
+ auto file_output_stream =
+ GARROW_IO_FILE_OUTPUT_STREAM(g_object_new(GARROW_IO_TYPE_FILE_OUTPUT_STREAM,
+ "file-output-stream", arrow_file_output_stream,
+ NULL));
+ return file_output_stream;
+}
+
+std::shared_ptr<arrow::io::FileOutputStream>
+garrow_io_file_output_stream_get_raw(GArrowIOFileOutputStream *file_output_stream)
+{
+ GArrowIOFileOutputStreamPrivate *priv;
+
+ priv = GARROW_IO_FILE_OUTPUT_STREAM_GET_PRIVATE(file_output_stream);
+ return priv->file_output_stream;
+}
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/io-file-output-stream.h
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/io-file-output-stream.h b/c_glib/arrow-glib/io-file-output-stream.h
new file mode 100644
index 0000000..032b125
--- /dev/null
+++ b/c_glib/arrow-glib/io-file-output-stream.h
@@ -0,0 +1,72 @@
+/*
+ * 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 <glib-object.h>
+
+G_BEGIN_DECLS
+
+#define GARROW_IO_TYPE_FILE_OUTPUT_STREAM \
+ (garrow_io_file_output_stream_get_type())
+#define GARROW_IO_FILE_OUTPUT_STREAM(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj), \
+ GARROW_IO_TYPE_FILE_OUTPUT_STREAM, \
+ GArrowIOFileOutputStream))
+#define GARROW_IO_FILE_OUTPUT_STREAM_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST((klass), \
+ GARROW_IO_TYPE_FILE_OUTPUT_STREAM, \
+ GArrowIOFileOutputStreamClass))
+#define GARROW_IO_IS_FILE_OUTPUT_STREAM(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj), \
+ GARROW_IO_TYPE_FILE_OUTPUT_STREAM))
+#define GARROW_IO_IS_FILE_OUTPUT_STREAM_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE((klass), \
+ GARROW_IO_TYPE_FILE_OUTPUT_STREAM))
+#define GARROW_IO_FILE_OUTPUT_STREAM_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS((obj), \
+ GARROW_IO_TYPE_FILE_OUTPUT_STREAM, \
+ GArrowIOFileOutputStreamClass))
+
+typedef struct _GArrowIOFileOutputStream GArrowIOFileOutputStream;
+typedef struct _GArrowIOFileOutputStreamClass GArrowIOFileOutputStreamClass;
+
+/**
+ * GArrowIOFileOutputStream:
+ *
+ * It wraps `arrow::io::FileOutputStream`.
+ */
+struct _GArrowIOFileOutputStream
+{
+ /*< private >*/
+ GObject parent_instance;
+};
+
+struct _GArrowIOFileOutputStreamClass
+{
+ GObjectClass parent_class;
+};
+
+GType garrow_io_file_output_stream_get_type(void) G_GNUC_CONST;
+
+GArrowIOFileOutputStream *garrow_io_file_output_stream_open(const gchar *path,
+ gboolean append,
+ GError **error);
+
+G_END_DECLS
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/io-file-output-stream.hpp
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/io-file-output-stream.hpp b/c_glib/arrow-glib/io-file-output-stream.hpp
new file mode 100644
index 0000000..76b8e91
--- /dev/null
+++ b/c_glib/arrow-glib/io-file-output-stream.hpp
@@ -0,0 +1,28 @@
+/*
+ * 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/api.h>
+#include <arrow/io/file.h>
+
+#include <arrow-glib/io-file-output-stream.h>
+
+GArrowIOFileOutputStream *garrow_io_file_output_stream_new_raw(std::shared_ptr<arrow::io::FileOutputStream> *arrow_file_output_stream);
+std::shared_ptr<arrow::io::FileOutputStream> garrow_io_file_output_stream_get_raw(GArrowIOFileOutputStream *file_output_stream);
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/io-file.cpp
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/io-file.cpp b/c_glib/arrow-glib/io-file.cpp
new file mode 100644
index 0000000..536ae3e
--- /dev/null
+++ b/c_glib/arrow-glib/io-file.cpp
@@ -0,0 +1,116 @@
+/*
+ * 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/api.h>
+
+#include <arrow-glib/error.hpp>
+#include <arrow-glib/io-file.hpp>
+#include <arrow-glib/io-file-mode.hpp>
+
+G_BEGIN_DECLS
+
+/**
+ * SECTION: io-file
+ * @title: GArrowIOFile
+ * @short_description: File interface
+ *
+ * #GArrowIOFile is an interface for file.
+ */
+
+G_DEFINE_INTERFACE(GArrowIOFile,
+ garrow_io_file,
+ G_TYPE_OBJECT)
+
+static void
+garrow_io_file_default_init (GArrowIOFileInterface *iface)
+{
+}
+
+/**
+ * garrow_io_file_close:
+ * @file: A #GArrowIOFile.
+ * @error: (nullable): Return location for a #GError or %NULL.
+ *
+ * Returns: %TRUE on success, %FALSE if there was an error.
+ */
+gboolean
+garrow_io_file_close(GArrowIOFile *file,
+ GError **error)
+{
+ auto arrow_file = garrow_io_file_get_raw(file);
+
+ auto status = arrow_file->Close();
+ if (status.ok()) {
+ return TRUE;
+ } else {
+ garrow_error_set(error, status, "[io][file][close]");
+ return FALSE;
+ }
+}
+
+/**
+ * garrow_io_file_tell:
+ * @file: A #GArrowIOFile.
+ * @error: (nullable): Return location for a #GError or %NULL.
+ *
+ * Returns: The current offset on success, -1 if there was an error.
+ */
+gint64
+garrow_io_file_tell(GArrowIOFile *file,
+ GError **error)
+{
+ auto arrow_file = garrow_io_file_get_raw(file);
+
+ gint64 position;
+ auto status = arrow_file->Tell(&position);
+ if (status.ok()) {
+ return position;
+ } else {
+ garrow_error_set(error, status, "[io][file][tell]");
+ return -1;
+ }
+}
+
+/**
+ * garrow_io_file_get_mode:
+ * @file: A #GArrowIOFile.
+ *
+ * Returns: The mode of the file.
+ */
+GArrowIOFileMode
+garrow_io_file_get_mode(GArrowIOFile *file)
+{
+ auto arrow_file = garrow_io_file_get_raw(file);
+
+ auto arrow_mode = arrow_file->mode();
+ return garrow_io_file_mode_from_raw(arrow_mode);
+}
+
+G_END_DECLS
+
+std::shared_ptr<arrow::io::FileInterface>
+garrow_io_file_get_raw(GArrowIOFile *file)
+{
+ auto *iface = GARROW_IO_FILE_GET_IFACE(file);
+ return iface->get_raw(file);
+}
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/io-file.h
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/io-file.h b/c_glib/arrow-glib/io-file.h
new file mode 100644
index 0000000..9fa0ec1
--- /dev/null
+++ b/c_glib/arrow-glib/io-file.h
@@ -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.
+ */
+
+#pragma once
+
+#include <arrow-glib/io-file-mode.h>
+
+G_BEGIN_DECLS
+
+#define GARROW_IO_TYPE_FILE \
+ (garrow_io_file_get_type())
+#define GARROW_IO_FILE(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj), \
+ GARROW_IO_TYPE_FILE, \
+ GArrowIOFileInterface))
+#define GARROW_IO_IS_FILE(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj), \
+ GARROW_IO_TYPE_FILE))
+#define GARROW_IO_FILE_GET_IFACE(obj) \
+ (G_TYPE_INSTANCE_GET_INTERFACE((obj), \
+ GARROW_IO_TYPE_FILE, \
+ GArrowIOFileInterface))
+
+typedef struct _GArrowIOFile GArrowIOFile;
+typedef struct _GArrowIOFileInterface GArrowIOFileInterface;
+
+GType garrow_io_file_get_type(void) G_GNUC_CONST;
+
+gboolean garrow_io_file_close(GArrowIOFile *file,
+ GError **error);
+gint64 garrow_io_file_tell(GArrowIOFile *file,
+ GError **error);
+GArrowIOFileMode garrow_io_file_get_mode(GArrowIOFile *file);
+
+G_END_DECLS
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/io-file.hpp
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/io-file.hpp b/c_glib/arrow-glib/io-file.hpp
new file mode 100644
index 0000000..afaca90
--- /dev/null
+++ b/c_glib/arrow-glib/io-file.hpp
@@ -0,0 +1,38 @@
+/*
+ * 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/io/interfaces.h>
+
+#include <arrow-glib/io-file.h>
+
+/**
+ * GArrowIOFileInterface:
+ *
+ * It wraps `arrow::io::FileInterface`.
+ */
+struct _GArrowIOFileInterface
+{
+ GTypeInterface parent_iface;
+
+ std::shared_ptr<arrow::io::FileInterface> (*get_raw)(GArrowIOFile *file);
+};
+
+std::shared_ptr<arrow::io::FileInterface> garrow_io_file_get_raw(GArrowIOFile *file);
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/io-input-stream.cpp
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/io-input-stream.cpp b/c_glib/arrow-glib/io-input-stream.cpp
new file mode 100644
index 0000000..a28b9c6
--- /dev/null
+++ b/c_glib/arrow-glib/io-input-stream.cpp
@@ -0,0 +1,56 @@
+/*
+ * 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/api.h>
+
+#include <arrow-glib/error.hpp>
+#include <arrow-glib/io-input-stream.hpp>
+
+G_BEGIN_DECLS
+
+/**
+ * SECTION: io-input-stream
+ * @title: GArrowIOInputStream
+ * @short_description: Stream input interface
+ *
+ * #GArrowIOInputStream is an interface for stream input. Stream input
+ * is file based and readable.
+ */
+
+G_DEFINE_INTERFACE(GArrowIOInputStream,
+ garrow_io_input_stream,
+ G_TYPE_OBJECT)
+
+static void
+garrow_io_input_stream_default_init (GArrowIOInputStreamInterface *iface)
+{
+}
+
+G_END_DECLS
+
+std::shared_ptr<arrow::io::InputStream>
+garrow_io_input_stream_get_raw(GArrowIOInputStream *input_stream)
+{
+ auto *iface = GARROW_IO_INPUT_STREAM_GET_IFACE(input_stream);
+ return iface->get_raw(input_stream);
+}
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/io-input-stream.h
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/io-input-stream.h b/c_glib/arrow-glib/io-input-stream.h
new file mode 100644
index 0000000..a7f0681
--- /dev/null
+++ b/c_glib/arrow-glib/io-input-stream.h
@@ -0,0 +1,45 @@
+/*
+ * 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 <glib-object.h>
+
+G_BEGIN_DECLS
+
+#define GARROW_IO_TYPE_INPUT_STREAM \
+ (garrow_io_input_stream_get_type())
+#define GARROW_IO_INPUT_STREAM(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj), \
+ GARROW_IO_TYPE_INPUT_STREAM, \
+ GArrowIOInputStreamInterface))
+#define GARROW_IO_IS_INPUT_STREAM(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj), \
+ GARROW_IO_TYPE_INPUT_STREAM))
+#define GARROW_IO_INPUT_STREAM_GET_IFACE(obj) \
+ (G_TYPE_INSTANCE_GET_INTERFACE((obj), \
+ GARROW_IO_TYPE_INPUT_STREAM, \
+ GArrowIOInputStreamInterface))
+
+typedef struct _GArrowIOInputStream GArrowIOInputStream;
+typedef struct _GArrowIOInputStreamInterface GArrowIOInputStreamInterface;
+
+GType garrow_io_input_stream_get_type(void) G_GNUC_CONST;
+
+G_END_DECLS
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/io-input-stream.hpp
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/io-input-stream.hpp b/c_glib/arrow-glib/io-input-stream.hpp
new file mode 100644
index 0000000..3b1de5d
--- /dev/null
+++ b/c_glib/arrow-glib/io-input-stream.hpp
@@ -0,0 +1,38 @@
+/*
+ * 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/io/interfaces.h>
+
+#include <arrow-glib/io-input-stream.h>
+
+/**
+ * GArrowIOInputStreamInterface:
+ *
+ * It wraps `arrow::io::InputStream`.
+ */
+struct _GArrowIOInputStreamInterface
+{
+ GTypeInterface parent_iface;
+
+ std::shared_ptr<arrow::io::InputStream> (*get_raw)(GArrowIOInputStream *file);
+};
+
+std::shared_ptr<arrow::io::InputStream> garrow_io_input_stream_get_raw(GArrowIOInputStream *input_stream);
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/io-memory-mapped-file.cpp
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/io-memory-mapped-file.cpp b/c_glib/arrow-glib/io-memory-mapped-file.cpp
new file mode 100644
index 0000000..aa6ae2a
--- /dev/null
+++ b/c_glib/arrow-glib/io-memory-mapped-file.cpp
@@ -0,0 +1,287 @@
+/*
+ * 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/io/file.h>
+
+#include <arrow-glib/error.hpp>
+#include <arrow-glib/io-file.hpp>
+#include <arrow-glib/io-file-mode.hpp>
+#include <arrow-glib/io-input-stream.hpp>
+#include <arrow-glib/io-memory-mapped-file.hpp>
+#include <arrow-glib/io-readable.hpp>
+#include <arrow-glib/io-readable-file.hpp>
+#include <arrow-glib/io-writeable.hpp>
+#include <arrow-glib/io-writeable-file.hpp>
+
+G_BEGIN_DECLS
+
+/**
+ * SECTION: io-memory-mapped-file
+ * @short_description: Memory mapped file class
+ *
+ * #GArrowIOMemoryMappedFile is a class for memory mapped file. It's
+ * readable and writeable. It supports zero copy.
+ */
+
+typedef struct GArrowIOMemoryMappedFilePrivate_ {
+ std::shared_ptr<arrow::io::MemoryMappedFile> memory_mapped_file;
+} GArrowIOMemoryMappedFilePrivate;
+
+enum {
+ PROP_0,
+ PROP_MEMORY_MAPPED_FILE
+};
+
+static std::shared_ptr<arrow::io::FileInterface>
+garrow_io_memory_mapped_file_get_raw_file_interface(GArrowIOFile *file)
+{
+ auto memory_mapped_file = GARROW_IO_MEMORY_MAPPED_FILE(file);
+ auto arrow_memory_mapped_file =
+ garrow_io_memory_mapped_file_get_raw(memory_mapped_file);
+ return arrow_memory_mapped_file;
+}
+
+static void
+garrow_io_file_interface_init(GArrowIOFileInterface *iface)
+{
+ iface->get_raw = garrow_io_memory_mapped_file_get_raw_file_interface;
+}
+
+static std::shared_ptr<arrow::io::Readable>
+garrow_io_memory_mapped_file_get_raw_readable_interface(GArrowIOReadable *readable)
+{
+ auto memory_mapped_file = GARROW_IO_MEMORY_MAPPED_FILE(readable);
+ auto arrow_memory_mapped_file =
+ garrow_io_memory_mapped_file_get_raw(memory_mapped_file);
+ return arrow_memory_mapped_file;
+}
+
+static void
+garrow_io_readable_interface_init(GArrowIOReadableInterface *iface)
+{
+ iface->get_raw = garrow_io_memory_mapped_file_get_raw_readable_interface;
+}
+
+static std::shared_ptr<arrow::io::InputStream>
+garrow_io_memory_mapped_file_get_raw_input_stream_interface(GArrowIOInputStream *input_stream)
+{
+ auto memory_mapped_file = GARROW_IO_MEMORY_MAPPED_FILE(input_stream);
+ auto arrow_memory_mapped_file =
+ garrow_io_memory_mapped_file_get_raw(memory_mapped_file);
+ return arrow_memory_mapped_file;
+}
+
+static void
+garrow_io_input_stream_interface_init(GArrowIOInputStreamInterface *iface)
+{
+ iface->get_raw = garrow_io_memory_mapped_file_get_raw_input_stream_interface;
+}
+
+static std::shared_ptr<arrow::io::ReadableFileInterface>
+garrow_io_memory_mapped_file_get_raw_readable_file_interface(GArrowIOReadableFile *file)
+{
+ auto memory_mapped_file = GARROW_IO_MEMORY_MAPPED_FILE(file);
+ auto arrow_memory_mapped_file =
+ garrow_io_memory_mapped_file_get_raw(memory_mapped_file);
+ return arrow_memory_mapped_file;
+}
+
+static void
+garrow_io_readable_file_interface_init(GArrowIOReadableFileInterface *iface)
+{
+ iface->get_raw = garrow_io_memory_mapped_file_get_raw_readable_file_interface;
+}
+
+static std::shared_ptr<arrow::io::Writeable>
+garrow_io_memory_mapped_file_get_raw_writeable_interface(GArrowIOWriteable *writeable)
+{
+ auto memory_mapped_file = GARROW_IO_MEMORY_MAPPED_FILE(writeable);
+ auto arrow_memory_mapped_file =
+ garrow_io_memory_mapped_file_get_raw(memory_mapped_file);
+ return arrow_memory_mapped_file;
+}
+
+static void
+garrow_io_writeable_interface_init(GArrowIOWriteableInterface *iface)
+{
+ iface->get_raw = garrow_io_memory_mapped_file_get_raw_writeable_interface;
+}
+
+static std::shared_ptr<arrow::io::WriteableFileInterface>
+garrow_io_memory_mapped_file_get_raw_writeable_file_interface(GArrowIOWriteableFile *file)
+{
+ auto memory_mapped_file = GARROW_IO_MEMORY_MAPPED_FILE(file);
+ auto arrow_memory_mapped_file =
+ garrow_io_memory_mapped_file_get_raw(memory_mapped_file);
+ return arrow_memory_mapped_file;
+}
+
+static void
+garrow_io_writeable_file_interface_init(GArrowIOWriteableFileInterface *iface)
+{
+ iface->get_raw = garrow_io_memory_mapped_file_get_raw_writeable_file_interface;
+}
+
+G_DEFINE_TYPE_WITH_CODE(GArrowIOMemoryMappedFile,
+ garrow_io_memory_mapped_file,
+ G_TYPE_OBJECT,
+ G_ADD_PRIVATE(GArrowIOMemoryMappedFile)
+ G_IMPLEMENT_INTERFACE(GARROW_IO_TYPE_FILE,
+ garrow_io_file_interface_init)
+ G_IMPLEMENT_INTERFACE(GARROW_IO_TYPE_READABLE,
+ garrow_io_readable_interface_init)
+ G_IMPLEMENT_INTERFACE(GARROW_IO_TYPE_INPUT_STREAM,
+ garrow_io_input_stream_interface_init)
+ G_IMPLEMENT_INTERFACE(GARROW_IO_TYPE_READABLE_FILE,
+ garrow_io_readable_file_interface_init)
+ G_IMPLEMENT_INTERFACE(GARROW_IO_TYPE_WRITEABLE,
+ garrow_io_writeable_interface_init)
+ G_IMPLEMENT_INTERFACE(GARROW_IO_TYPE_WRITEABLE_FILE,
+ garrow_io_writeable_file_interface_init));
+
+#define GARROW_IO_MEMORY_MAPPED_FILE_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE((obj), \
+ GARROW_IO_TYPE_MEMORY_MAPPED_FILE, \
+ GArrowIOMemoryMappedFilePrivate))
+
+static void
+garrow_io_memory_mapped_file_finalize(GObject *object)
+{
+ GArrowIOMemoryMappedFilePrivate *priv;
+
+ priv = GARROW_IO_MEMORY_MAPPED_FILE_GET_PRIVATE(object);
+
+ priv->memory_mapped_file = nullptr;
+
+ G_OBJECT_CLASS(garrow_io_memory_mapped_file_parent_class)->finalize(object);
+}
+
+static void
+garrow_io_memory_mapped_file_set_property(GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ GArrowIOMemoryMappedFilePrivate *priv;
+
+ priv = GARROW_IO_MEMORY_MAPPED_FILE_GET_PRIVATE(object);
+
+ switch (prop_id) {
+ case PROP_MEMORY_MAPPED_FILE:
+ priv->memory_mapped_file =
+ *static_cast<std::shared_ptr<arrow::io::MemoryMappedFile> *>(g_value_get_pointer(value));
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+ break;
+ }
+}
+
+static void
+garrow_io_memory_mapped_file_get_property(GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ switch (prop_id) {
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+ break;
+ }
+}
+
+static void
+garrow_io_memory_mapped_file_init(GArrowIOMemoryMappedFile *object)
+{
+}
+
+static void
+garrow_io_memory_mapped_file_class_init(GArrowIOMemoryMappedFileClass *klass)
+{
+ GObjectClass *gobject_class;
+ GParamSpec *spec;
+
+ gobject_class = G_OBJECT_CLASS(klass);
+
+ gobject_class->finalize = garrow_io_memory_mapped_file_finalize;
+ gobject_class->set_property = garrow_io_memory_mapped_file_set_property;
+ gobject_class->get_property = garrow_io_memory_mapped_file_get_property;
+
+ spec = g_param_spec_pointer("memory-mapped-file",
+ "io::MemoryMappedFile",
+ "The raw std::shared<arrow::io::MemoryMappedFile> *",
+ static_cast<GParamFlags>(G_PARAM_WRITABLE |
+ G_PARAM_CONSTRUCT_ONLY));
+ g_object_class_install_property(gobject_class, PROP_MEMORY_MAPPED_FILE, spec);
+}
+
+/**
+ * garrow_io_memory_mapped_file_open:
+ * @path: The path of the memory mapped file.
+ * @mode: The mode of the memory mapped file.
+ * @error: (nullable): Return location for a #GError or %NULL.
+ *
+ * Returns: (nullable) (transfer full): A newly opened
+ * #GArrowIOMemoryMappedFile or %NULL on error.
+ */
+GArrowIOMemoryMappedFile *
+garrow_io_memory_mapped_file_open(const gchar *path,
+ GArrowIOFileMode mode,
+ GError **error)
+{
+ std::shared_ptr<arrow::io::MemoryMappedFile> arrow_memory_mapped_file;
+ auto status =
+ arrow::io::MemoryMappedFile::Open(std::string(path),
+ garrow_io_file_mode_to_raw(mode),
+ &arrow_memory_mapped_file);
+ if (status.ok()) {
+ return garrow_io_memory_mapped_file_new_raw(&arrow_memory_mapped_file);
+ } else {
+ std::string context("[io][memory-mapped-file][open]: <");
+ context += path;
+ context += ">";
+ garrow_error_set(error, status, context.c_str());
+ return NULL;
+ }
+}
+
+G_END_DECLS
+
+GArrowIOMemoryMappedFile *
+garrow_io_memory_mapped_file_new_raw(std::shared_ptr<arrow::io::MemoryMappedFile> *arrow_memory_mapped_file)
+{
+ auto memory_mapped_file =
+ GARROW_IO_MEMORY_MAPPED_FILE(g_object_new(GARROW_IO_TYPE_MEMORY_MAPPED_FILE,
+ "memory-mapped-file", arrow_memory_mapped_file,
+ NULL));
+ return memory_mapped_file;
+}
+
+std::shared_ptr<arrow::io::MemoryMappedFile>
+garrow_io_memory_mapped_file_get_raw(GArrowIOMemoryMappedFile *memory_mapped_file)
+{
+ GArrowIOMemoryMappedFilePrivate *priv;
+
+ priv = GARROW_IO_MEMORY_MAPPED_FILE_GET_PRIVATE(memory_mapped_file);
+ return priv->memory_mapped_file;
+}
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/io-memory-mapped-file.h
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/io-memory-mapped-file.h b/c_glib/arrow-glib/io-memory-mapped-file.h
new file mode 100644
index 0000000..0d2d6c2
--- /dev/null
+++ b/c_glib/arrow-glib/io-memory-mapped-file.h
@@ -0,0 +1,72 @@
+/*
+ * 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/io-file-mode.h>
+
+G_BEGIN_DECLS
+
+#define GARROW_IO_TYPE_MEMORY_MAPPED_FILE \
+ (garrow_io_memory_mapped_file_get_type())
+#define GARROW_IO_MEMORY_MAPPED_FILE(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj), \
+ GARROW_IO_TYPE_MEMORY_MAPPED_FILE, \
+ GArrowIOMemoryMappedFile))
+#define GARROW_IO_MEMORY_MAPPED_FILE_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST((klass), \
+ GARROW_IO_TYPE_MEMORY_MAPPED_FILE, \
+ GArrowIOMemoryMappedFileClass))
+#define GARROW_IO_IS_MEMORY_MAPPED_FILE(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj), \
+ GARROW_IO_TYPE_MEMORY_MAPPED_FILE))
+#define GARROW_IO_IS_MEMORY_MAPPED_FILE_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE((klass), \
+ GARROW_IO_TYPE_MEMORY_MAPPED_FILE))
+#define GARROW_IO_MEMORY_MAPPED_FILE_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS((obj), \
+ GARROW_IO_TYPE_MEMORY_MAPPED_FILE, \
+ GArrowIOMemoryMappedFileClass))
+
+typedef struct _GArrowIOMemoryMappedFile GArrowIOMemoryMappedFile;
+typedef struct _GArrowIOMemoryMappedFileClass GArrowIOMemoryMappedFileClass;
+
+/**
+ * GArrowIOMemoryMappedFile:
+ *
+ * It wraps `arrow::io::MemoryMappedFile`.
+ */
+struct _GArrowIOMemoryMappedFile
+{
+ /*< private >*/
+ GObject parent_instance;
+};
+
+struct _GArrowIOMemoryMappedFileClass
+{
+ GObjectClass parent_class;
+};
+
+GType garrow_io_memory_mapped_file_get_type(void) G_GNUC_CONST;
+
+GArrowIOMemoryMappedFile *garrow_io_memory_mapped_file_open(const gchar *path,
+ GArrowIOFileMode mode,
+ GError **error);
+
+G_END_DECLS
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/io-memory-mapped-file.hpp
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/io-memory-mapped-file.hpp b/c_glib/arrow-glib/io-memory-mapped-file.hpp
new file mode 100644
index 0000000..b48e05f
--- /dev/null
+++ b/c_glib/arrow-glib/io-memory-mapped-file.hpp
@@ -0,0 +1,28 @@
+/*
+ * 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/api.h>
+#include <arrow/io/file.h>
+
+#include <arrow-glib/io-memory-mapped-file.h>
+
+GArrowIOMemoryMappedFile *garrow_io_memory_mapped_file_new_raw(std::shared_ptr<arrow::io::MemoryMappedFile> *arrow_memory_mapped_file);
+std::shared_ptr<arrow::io::MemoryMappedFile> garrow_io_memory_mapped_file_get_raw(GArrowIOMemoryMappedFile *memory_mapped_file);
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/io-output-stream.cpp
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/io-output-stream.cpp b/c_glib/arrow-glib/io-output-stream.cpp
new file mode 100644
index 0000000..bdf5587
--- /dev/null
+++ b/c_glib/arrow-glib/io-output-stream.cpp
@@ -0,0 +1,56 @@
+/*
+ * 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/api.h>
+
+#include <arrow-glib/error.hpp>
+#include <arrow-glib/io-output-stream.hpp>
+
+G_BEGIN_DECLS
+
+/**
+ * SECTION: io-output-stream
+ * @title: GArrowIOOutputStream
+ * @short_description: Stream output interface
+ *
+ * #GArrowIOOutputStream is an interface for stream output. Stream
+ * output is file based and writeable
+ */
+
+G_DEFINE_INTERFACE(GArrowIOOutputStream,
+ garrow_io_output_stream,
+ G_TYPE_OBJECT)
+
+static void
+garrow_io_output_stream_default_init (GArrowIOOutputStreamInterface *iface)
+{
+}
+
+G_END_DECLS
+
+std::shared_ptr<arrow::io::OutputStream>
+garrow_io_output_stream_get_raw(GArrowIOOutputStream *output_stream)
+{
+ auto *iface = GARROW_IO_OUTPUT_STREAM_GET_IFACE(output_stream);
+ return iface->get_raw(output_stream);
+}
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/io-output-stream.h
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/io-output-stream.h b/c_glib/arrow-glib/io-output-stream.h
new file mode 100644
index 0000000..c4079d5
--- /dev/null
+++ b/c_glib/arrow-glib/io-output-stream.h
@@ -0,0 +1,45 @@
+/*
+ * 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 <glib-object.h>
+
+G_BEGIN_DECLS
+
+#define GARROW_IO_TYPE_OUTPUT_STREAM \
+ (garrow_io_output_stream_get_type())
+#define GARROW_IO_OUTPUT_STREAM(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj), \
+ GARROW_IO_TYPE_OUTPUT_STREAM, \
+ GArrowIOOutputStreamInterface))
+#define GARROW_IO_IS_OUTPUT_STREAM(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj), \
+ GARROW_IO_TYPE_OUTPUT_STREAM))
+#define GARROW_IO_OUTPUT_STREAM_GET_IFACE(obj) \
+ (G_TYPE_INSTANCE_GET_INTERFACE((obj), \
+ GARROW_IO_TYPE_OUTPUT_STREAM, \
+ GArrowIOOutputStreamInterface))
+
+typedef struct _GArrowIOOutputStream GArrowIOOutputStream;
+typedef struct _GArrowIOOutputStreamInterface GArrowIOOutputStreamInterface;
+
+GType garrow_io_output_stream_get_type(void) G_GNUC_CONST;
+
+G_END_DECLS
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/io-output-stream.hpp
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/io-output-stream.hpp b/c_glib/arrow-glib/io-output-stream.hpp
new file mode 100644
index 0000000..f144130
--- /dev/null
+++ b/c_glib/arrow-glib/io-output-stream.hpp
@@ -0,0 +1,38 @@
+/*
+ * 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/io/interfaces.h>
+
+#include <arrow-glib/io-output-stream.h>
+
+/**
+ * GArrowIOOutputStreamInterface:
+ *
+ * It wraps `arrow::io::OutputStream`.
+ */
+struct _GArrowIOOutputStreamInterface
+{
+ GTypeInterface parent_iface;
+
+ std::shared_ptr<arrow::io::OutputStream> (*get_raw)(GArrowIOOutputStream *file);
+};
+
+std::shared_ptr<arrow::io::OutputStream> garrow_io_output_stream_get_raw(GArrowIOOutputStream *output_stream);
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/io-readable-file.cpp
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/io-readable-file.cpp b/c_glib/arrow-glib/io-readable-file.cpp
new file mode 100644
index 0000000..014fd7a
--- /dev/null
+++ b/c_glib/arrow-glib/io-readable-file.cpp
@@ -0,0 +1,127 @@
+/*
+ * 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/api.h>
+
+#include <arrow-glib/error.hpp>
+#include <arrow-glib/io-readable-file.hpp>
+
+G_BEGIN_DECLS
+
+/**
+ * SECTION: io-readable-file
+ * @title: GArrowIOReadableFile
+ * @short_description: File input interface
+ *
+ * #GArrowIOReadableFile is an interface for file input.
+ */
+
+G_DEFINE_INTERFACE(GArrowIOReadableFile,
+ garrow_io_readable_file,
+ G_TYPE_OBJECT)
+
+static void
+garrow_io_readable_file_default_init (GArrowIOReadableFileInterface *iface)
+{
+}
+
+/**
+ * garrow_io_readable_file_get_size:
+ * @file: A #GArrowIOReadableFile.
+ * @error: (nullable): Return location for a #GError or %NULL.
+ *
+ * Returns: The size of the file.
+ */
+guint64
+garrow_io_readable_file_get_size(GArrowIOReadableFile *file,
+ GError **error)
+{
+ auto *iface = GARROW_IO_READABLE_FILE_GET_IFACE(file);
+ auto arrow_readable_file = iface->get_raw(file);
+ int64_t size;
+
+ auto status = arrow_readable_file->GetSize(&size);
+ if (status.ok()) {
+ return size;
+ } else {
+ garrow_error_set(error, status, "[io][readable-file][get-size]");
+ return 0;
+ }
+}
+
+/**
+ * garrow_io_readable_file_get_support_zero_copy:
+ * @file: A #GArrowIOReadableFile.
+ *
+ * Returns: Whether zero copy read is supported or not.
+ */
+gboolean
+garrow_io_readable_file_get_support_zero_copy(GArrowIOReadableFile *file)
+{
+ auto *iface = GARROW_IO_READABLE_FILE_GET_IFACE(file);
+ auto arrow_readable_file = iface->get_raw(file);
+
+ return arrow_readable_file->supports_zero_copy();
+}
+
+/**
+ * garrow_io_readable_file_read_at:
+ * @file: A #GArrowIOReadableFile.
+ * @position: The read start position.
+ * @n_bytes: The number of bytes to be read.
+ * @n_read_bytes: (out): The read number of bytes.
+ * @buffer: (array length=n_bytes): The buffer to be read data.
+ * @error: (nullable): Return location for a #GError or %NULL.
+ *
+ * Returns: %TRUE on success, %FALSE if there was an error.
+ */
+gboolean
+garrow_io_readable_file_read_at(GArrowIOReadableFile *file,
+ gint64 position,
+ gint64 n_bytes,
+ gint64 *n_read_bytes,
+ guint8 *buffer,
+ GError **error)
+{
+ const auto arrow_readable_file = garrow_io_readable_file_get_raw(file);
+
+ auto status = arrow_readable_file->ReadAt(position,
+ n_bytes,
+ n_read_bytes,
+ buffer);
+ if (status.ok()) {
+ return TRUE;
+ } else {
+ garrow_error_set(error, status, "[io][readable-file][read-at]");
+ return FALSE;
+ }
+}
+
+G_END_DECLS
+
+std::shared_ptr<arrow::io::ReadableFileInterface>
+garrow_io_readable_file_get_raw(GArrowIOReadableFile *readable_file)
+{
+ auto *iface = GARROW_IO_READABLE_FILE_GET_IFACE(readable_file);
+ return iface->get_raw(readable_file);
+}
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/io-readable-file.h
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/io-readable-file.h b/c_glib/arrow-glib/io-readable-file.h
new file mode 100644
index 0000000..1dcb13e
--- /dev/null
+++ b/c_glib/arrow-glib/io-readable-file.h
@@ -0,0 +1,55 @@
+/*
+ * 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 <glib-object.h>
+
+G_BEGIN_DECLS
+
+#define GARROW_IO_TYPE_READABLE_FILE \
+ (garrow_io_readable_file_get_type())
+#define GARROW_IO_READABLE_FILE(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj), \
+ GARROW_IO_TYPE_READABLE_FILE, \
+ GArrowIOReadableFileInterface))
+#define GARROW_IO_IS_READABLE_FILE(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj), \
+ GARROW_IO_TYPE_READABLE_FILE))
+#define GARROW_IO_READABLE_FILE_GET_IFACE(obj) \
+ (G_TYPE_INSTANCE_GET_INTERFACE((obj), \
+ GARROW_IO_TYPE_READABLE_FILE, \
+ GArrowIOReadableFileInterface))
+
+typedef struct _GArrowIOReadableFile GArrowIOReadableFile;
+typedef struct _GArrowIOReadableFileInterface GArrowIOReadableFileInterface;
+
+GType garrow_io_readable_file_get_type(void) G_GNUC_CONST;
+
+guint64 garrow_io_readable_file_get_size(GArrowIOReadableFile *file,
+ GError **error);
+gboolean garrow_io_readable_file_get_support_zero_copy(GArrowIOReadableFile *file);
+gboolean garrow_io_readable_file_read_at(GArrowIOReadableFile *file,
+ gint64 position,
+ gint64 n_bytes,
+ gint64 *n_read_bytes,
+ guint8 *buffer,
+ GError **error);
+
+G_END_DECLS
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/io-readable-file.hpp
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/io-readable-file.hpp b/c_glib/arrow-glib/io-readable-file.hpp
new file mode 100644
index 0000000..83d8628
--- /dev/null
+++ b/c_glib/arrow-glib/io-readable-file.hpp
@@ -0,0 +1,38 @@
+/*
+ * 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/io/interfaces.h>
+
+#include <arrow-glib/io-readable-file.h>
+
+/**
+ * GArrowIOReadableFileInterface:
+ *
+ * It wraps `arrow::io::ReadableFileInterface`.
+ */
+struct _GArrowIOReadableFileInterface
+{
+ GTypeInterface parent_iface;
+
+ std::shared_ptr<arrow::io::ReadableFileInterface> (*get_raw)(GArrowIOReadableFile *file);
+};
+
+std::shared_ptr<arrow::io::ReadableFileInterface> garrow_io_readable_file_get_raw(GArrowIOReadableFile *readable_file);
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/io-readable.cpp
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/io-readable.cpp b/c_glib/arrow-glib/io-readable.cpp
new file mode 100644
index 0000000..b372a66
--- /dev/null
+++ b/c_glib/arrow-glib/io-readable.cpp
@@ -0,0 +1,84 @@
+/*
+ * 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/api.h>
+
+#include <arrow-glib/error.hpp>
+#include <arrow-glib/io-readable.hpp>
+
+G_BEGIN_DECLS
+
+/**
+ * SECTION: io-readable
+ * @title: GArrowIOReadable
+ * @short_description: Input interface
+ *
+ * #GArrowIOReadable is an interface for input. Input must be
+ * readable.
+ */
+
+G_DEFINE_INTERFACE(GArrowIOReadable,
+ garrow_io_readable,
+ G_TYPE_OBJECT)
+
+static void
+garrow_io_readable_default_init (GArrowIOReadableInterface *iface)
+{
+}
+
+/**
+ * garrow_io_readable_read:
+ * @readable: A #GArrowIOReadable.
+ * @n_bytes: The number of bytes to be read.
+ * @n_read_bytes: (out): The read number of bytes.
+ * @buffer: (array length=n_bytes): The buffer to be read data.
+ * @error: (nullable): Return location for a #GError or %NULL.
+ *
+ * Returns: %TRUE on success, %FALSE if there was an error.
+ */
+gboolean
+garrow_io_readable_read(GArrowIOReadable *readable,
+ gint64 n_bytes,
+ gint64 *n_read_bytes,
+ guint8 *buffer,
+ GError **error)
+{
+ const auto arrow_readable = garrow_io_readable_get_raw(readable);
+
+ auto status = arrow_readable->Read(n_bytes, n_read_bytes, buffer);
+ if (status.ok()) {
+ return TRUE;
+ } else {
+ garrow_error_set(error, status, "[io][readable][read]");
+ return FALSE;
+ }
+}
+
+G_END_DECLS
+
+std::shared_ptr<arrow::io::Readable>
+garrow_io_readable_get_raw(GArrowIOReadable *readable)
+{
+ auto *iface = GARROW_IO_READABLE_GET_IFACE(readable);
+ return iface->get_raw(readable);
+}
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/io-readable.h
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/io-readable.h b/c_glib/arrow-glib/io-readable.h
new file mode 100644
index 0000000..d24b46c
--- /dev/null
+++ b/c_glib/arrow-glib/io-readable.h
@@ -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.
+ */
+
+#pragma once
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+#define GARROW_IO_TYPE_READABLE \
+ (garrow_io_readable_get_type())
+#define GARROW_IO_READABLE(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj), \
+ GARROW_IO_TYPE_READABLE, \
+ GArrowIOReadableInterface))
+#define GARROW_IO_IS_READABLE(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj), \
+ GARROW_IO_TYPE_READABLE))
+#define GARROW_IO_READABLE_GET_IFACE(obj) \
+ (G_TYPE_INSTANCE_GET_INTERFACE((obj), \
+ GARROW_IO_TYPE_READABLE, \
+ GArrowIOReadableInterface))
+
+typedef struct _GArrowIOReadable GArrowIOReadable;
+typedef struct _GArrowIOReadableInterface GArrowIOReadableInterface;
+
+GType garrow_io_readable_get_type(void) G_GNUC_CONST;
+
+gboolean garrow_io_readable_read(GArrowIOReadable *readable,
+ gint64 n_bytes,
+ gint64 *n_read_bytes,
+ guint8 *buffer,
+ GError **error);
+
+G_END_DECLS
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/io-readable.hpp
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/io-readable.hpp b/c_glib/arrow-glib/io-readable.hpp
new file mode 100644
index 0000000..3d27b3f
--- /dev/null
+++ b/c_glib/arrow-glib/io-readable.hpp
@@ -0,0 +1,38 @@
+/*
+ * 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/io/interfaces.h>
+
+#include <arrow-glib/io-readable.h>
+
+/**
+ * GArrowIOReadableInterface:
+ *
+ * It wraps `arrow::io::Readable`.
+ */
+struct _GArrowIOReadableInterface
+{
+ GTypeInterface parent_iface;
+
+ std::shared_ptr<arrow::io::Readable> (*get_raw)(GArrowIOReadable *file);
+};
+
+std::shared_ptr<arrow::io::Readable> garrow_io_readable_get_raw(GArrowIOReadable *readable);
[3/9] arrow git commit: ARROW-631: [GLib] Import
Posted by we...@apache.org.
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/table.h
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/table.h b/c_glib/arrow-glib/table.h
new file mode 100644
index 0000000..34a89a7
--- /dev/null
+++ b/c_glib/arrow-glib/table.h
@@ -0,0 +1,80 @@
+/*
+ * 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/column.h>
+#include <arrow-glib/schema.h>
+
+G_BEGIN_DECLS
+
+#define GARROW_TYPE_TABLE \
+ (garrow_table_get_type())
+#define GARROW_TABLE(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj), \
+ GARROW_TYPE_TABLE, \
+ GArrowTable))
+#define GARROW_TABLE_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST((klass), \
+ GARROW_TYPE_TABLE, \
+ GArrowTableClass))
+#define GARROW_IS_TABLE(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj), \
+ GARROW_TYPE_TABLE))
+#define GARROW_IS_TABLE_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE((klass), \
+ GARROW_TYPE_TABLE))
+#define GARROW_TABLE_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS((obj), \
+ GARROW_TYPE_TABLE, \
+ GArrowTableClass))
+
+typedef struct _GArrowTable GArrowTable;
+typedef struct _GArrowTableClass GArrowTableClass;
+
+/**
+ * GArrowTable:
+ *
+ * It wraps `arrow::Table`.
+ */
+struct _GArrowTable
+{
+ /*< private >*/
+ GObject parent_instance;
+};
+
+struct _GArrowTableClass
+{
+ GObjectClass parent_class;
+};
+
+GType garrow_table_get_type (void) G_GNUC_CONST;
+
+GArrowTable *garrow_table_new (const gchar *name,
+ GArrowSchema *schema,
+ GList *columns);
+
+const gchar *garrow_table_get_name (GArrowTable *table);
+GArrowSchema *garrow_table_get_schema (GArrowTable *table);
+GArrowColumn *garrow_table_get_column (GArrowTable *table,
+ guint i);
+guint garrow_table_get_n_columns (GArrowTable *table);
+guint64 garrow_table_get_n_rows (GArrowTable *table);
+
+G_END_DECLS
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/table.hpp
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/table.hpp b/c_glib/arrow-glib/table.hpp
new file mode 100644
index 0000000..22b0fad
--- /dev/null
+++ b/c_glib/arrow-glib/table.hpp
@@ -0,0 +1,27 @@
+/*
+ * 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/api.h>
+
+#include <arrow-glib/table.h>
+
+GArrowTable *garrow_table_new_raw(std::shared_ptr<arrow::Table> *arrow_table);
+std::shared_ptr<arrow::Table> garrow_table_get_raw(GArrowTable *table);
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/type.cpp
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/type.cpp b/c_glib/arrow-glib/type.cpp
new file mode 100644
index 0000000..56cbc21
--- /dev/null
+++ b/c_glib/arrow-glib/type.cpp
@@ -0,0 +1,90 @@
+/*
+ * 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/type.hpp>
+
+/**
+ * SECTION: type
+ * @title: GArrowType
+ * @short_description: Type mapping between Arrow and arrow-glib
+ *
+ * #GArrowType provides types corresponding to `arrow::Type::type`
+ * values.
+ */
+
+GArrowType
+garrow_type_from_raw(arrow::Type::type type)
+{
+ switch (type) {
+ case arrow::Type::type::NA:
+ return GARROW_TYPE_NA;
+ case arrow::Type::type::BOOL:
+ return GARROW_TYPE_BOOL;
+ case arrow::Type::type::UINT8:
+ return GARROW_TYPE_UINT8;
+ case arrow::Type::type::INT8:
+ return GARROW_TYPE_INT8;
+ case arrow::Type::type::UINT16:
+ return GARROW_TYPE_UINT16;
+ case arrow::Type::type::INT16:
+ return GARROW_TYPE_INT16;
+ case arrow::Type::type::UINT32:
+ return GARROW_TYPE_UINT32;
+ case arrow::Type::type::INT32:
+ return GARROW_TYPE_INT32;
+ case arrow::Type::type::UINT64:
+ return GARROW_TYPE_UINT64;
+ case arrow::Type::type::INT64:
+ return GARROW_TYPE_INT64;
+ case arrow::Type::type::HALF_FLOAT:
+ return GARROW_TYPE_HALF_FLOAT;
+ case arrow::Type::type::FLOAT:
+ return GARROW_TYPE_FLOAT;
+ case arrow::Type::type::DOUBLE:
+ return GARROW_TYPE_DOUBLE;
+ case arrow::Type::type::STRING:
+ return GARROW_TYPE_STRING;
+ case arrow::Type::type::BINARY:
+ return GARROW_TYPE_BINARY;
+ case arrow::Type::type::DATE:
+ return GARROW_TYPE_DATE;
+ case arrow::Type::type::TIMESTAMP:
+ return GARROW_TYPE_TIMESTAMP;
+ case arrow::Type::type::TIME:
+ return GARROW_TYPE_TIME;
+ case arrow::Type::type::INTERVAL:
+ return GARROW_TYPE_INTERVAL;
+ case arrow::Type::type::DECIMAL:
+ return GARROW_TYPE_DECIMAL;
+ case arrow::Type::type::LIST:
+ return GARROW_TYPE_LIST;
+ case arrow::Type::type::STRUCT:
+ return GARROW_TYPE_STRUCT;
+ case arrow::Type::type::UNION:
+ return GARROW_TYPE_UNION;
+ case arrow::Type::type::DICTIONARY:
+ return GARROW_TYPE_DICTIONARY;
+ default:
+ return GARROW_TYPE_NA;
+ }
+}
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/type.h
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/type.h b/c_glib/arrow-glib/type.h
new file mode 100644
index 0000000..48d2801
--- /dev/null
+++ b/c_glib/arrow-glib/type.h
@@ -0,0 +1,84 @@
+/*
+ * 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 <glib-object.h>
+
+G_BEGIN_DECLS
+
+/**
+ * GArrowType:
+ * @GARROW_TYPE_NA: A degenerate NULL type represented as 0 bytes/bits.
+ * @GARROW_TYPE_BOOL: A boolean value represented as 1 bit.
+ * @GARROW_TYPE_UINT8: Little-endian 8bit unsigned integer.
+ * @GARROW_TYPE_INT8: Little-endian 8bit signed integer.
+ * @GARROW_TYPE_UINT16: Little-endian 16bit unsigned integer.
+ * @GARROW_TYPE_INT16: Little-endian 16bit signed integer.
+ * @GARROW_TYPE_UINT32: Little-endian 32bit unsigned integer.
+ * @GARROW_TYPE_INT32: Little-endian 32bit signed integer.
+ * @GARROW_TYPE_UINT64: Little-endian 64bit unsigned integer.
+ * @GARROW_TYPE_INT64: Little-endian 64bit signed integer.
+ * @GARROW_TYPE_HALF_FLOAT: 2-byte floating point value.
+ * @GARROW_TYPE_FLOAT: 4-byte floating point value.
+ * @GARROW_TYPE_DOUBLE: 8-byte floating point value.
+ * @GARROW_TYPE_STRING: UTF-8 variable-length string.
+ * @GARROW_TYPE_BINARY: Variable-length bytes (no guarantee of UTF-8-ness).
+ * @GARROW_TYPE_DATE: By default, int32 days since the UNIX epoch.
+ * @GARROW_TYPE_TIMESTAMP: Exact timestamp encoded with int64 since UNIX epoch.
+ * Default unit millisecond.
+ * @GARROW_TYPE_TIME: Exact time encoded with int64, default unit millisecond.
+ * @GARROW_TYPE_INTERVAL: YEAR_MONTH or DAY_TIME interval in SQL style.
+ * @GARROW_TYPE_DECIMAL: Precision- and scale-based decimal
+ * type. Storage type depends on the parameters.
+ * @GARROW_TYPE_LIST: A list of some logical data type.
+ * @GARROW_TYPE_STRUCT: Struct of logical types.
+ * @GARROW_TYPE_UNION: Unions of logical types.
+ * @GARROW_TYPE_DICTIONARY: Dictionary aka Category type.
+ *
+ * They are corresponding to `arrow::Type::type` values.
+ */
+typedef enum {
+ GARROW_TYPE_NA,
+ GARROW_TYPE_BOOL,
+ GARROW_TYPE_UINT8,
+ GARROW_TYPE_INT8,
+ GARROW_TYPE_UINT16,
+ GARROW_TYPE_INT16,
+ GARROW_TYPE_UINT32,
+ GARROW_TYPE_INT32,
+ GARROW_TYPE_UINT64,
+ GARROW_TYPE_INT64,
+ GARROW_TYPE_HALF_FLOAT,
+ GARROW_TYPE_FLOAT,
+ GARROW_TYPE_DOUBLE,
+ GARROW_TYPE_STRING,
+ GARROW_TYPE_BINARY,
+ GARROW_TYPE_DATE,
+ GARROW_TYPE_TIMESTAMP,
+ GARROW_TYPE_TIME,
+ GARROW_TYPE_INTERVAL,
+ GARROW_TYPE_DECIMAL,
+ GARROW_TYPE_LIST,
+ GARROW_TYPE_STRUCT,
+ GARROW_TYPE_UNION,
+ GARROW_TYPE_DICTIONARY
+} GArrowType;
+
+G_END_DECLS
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/type.hpp
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/type.hpp b/c_glib/arrow-glib/type.hpp
new file mode 100644
index 0000000..2a452be
--- /dev/null
+++ b/c_glib/arrow-glib/type.hpp
@@ -0,0 +1,26 @@
+/*
+ * 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/api.h>
+
+#include <arrow-glib/type.h>
+
+GArrowType garrow_type_from_raw(arrow::Type::type type);
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/uint16-array-builder.cpp
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/uint16-array-builder.cpp b/c_glib/arrow-glib/uint16-array-builder.cpp
new file mode 100644
index 0000000..bfade2d
--- /dev/null
+++ b/c_glib/arrow-glib/uint16-array-builder.cpp
@@ -0,0 +1,120 @@
+/*
+ * 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-builder.hpp>
+#include <arrow-glib/error.hpp>
+#include <arrow-glib/uint16-array-builder.h>
+
+G_BEGIN_DECLS
+
+/**
+ * SECTION: uint16-array-builder
+ * @short_description: 16-bit unsigned integer array builder class
+ *
+ * #GArrowUInt16ArrayBuilder is the class to create a new
+ * #GArrowUInt16Array.
+ */
+
+G_DEFINE_TYPE(GArrowUInt16ArrayBuilder,
+ garrow_uint16_array_builder,
+ GARROW_TYPE_ARRAY_BUILDER)
+
+static void
+garrow_uint16_array_builder_init(GArrowUInt16ArrayBuilder *builder)
+{
+}
+
+static void
+garrow_uint16_array_builder_class_init(GArrowUInt16ArrayBuilderClass *klass)
+{
+}
+
+/**
+ * garrow_uint16_array_builder_new:
+ *
+ * Returns: A newly created #GArrowUInt16ArrayBuilder.
+ */
+GArrowUInt16ArrayBuilder *
+garrow_uint16_array_builder_new(void)
+{
+ auto memory_pool = arrow::default_memory_pool();
+ auto arrow_builder =
+ std::make_shared<arrow::UInt16Builder>(memory_pool, arrow::uint16());
+ auto builder =
+ GARROW_UINT16_ARRAY_BUILDER(g_object_new(GARROW_TYPE_UINT16_ARRAY_BUILDER,
+ "array-builder", &arrow_builder,
+ NULL));
+ return builder;
+}
+
+/**
+ * garrow_uint16_array_builder_append:
+ * @builder: A #GArrowUInt16ArrayBuilder.
+ * @value: An uint16 value.
+ * @error: (nullable): Return location for a #GError or %NULL.
+ *
+ * Returns: %TRUE on success, %FALSE if there was an error.
+ */
+gboolean
+garrow_uint16_array_builder_append(GArrowUInt16ArrayBuilder *builder,
+ guint16 value,
+ GError **error)
+{
+ auto arrow_builder =
+ static_cast<arrow::UInt16Builder *>(
+ garrow_array_builder_get_raw(GARROW_ARRAY_BUILDER(builder)).get());
+
+ auto status = arrow_builder->Append(value);
+ if (status.ok()) {
+ return TRUE;
+ } else {
+ garrow_error_set(error, status, "[uint16-array-builder][append]");
+ return FALSE;
+ }
+}
+
+/**
+ * garrow_uint16_array_builder_append_null:
+ * @builder: A #GArrowUInt16ArrayBuilder.
+ * @error: (nullable): Return location for a #GError or %NULL.
+ *
+ * Returns: %TRUE on success, %FALSE if there was an error.
+ */
+gboolean
+garrow_uint16_array_builder_append_null(GArrowUInt16ArrayBuilder *builder,
+ GError **error)
+{
+ auto arrow_builder =
+ static_cast<arrow::UInt16Builder *>(
+ garrow_array_builder_get_raw(GARROW_ARRAY_BUILDER(builder)).get());
+
+ auto status = arrow_builder->AppendNull();
+ if (status.ok()) {
+ return TRUE;
+ } else {
+ garrow_error_set(error, status, "[uint16-array-builder][append-null]");
+ return FALSE;
+ }
+}
+
+G_END_DECLS
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/uint16-array-builder.h
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/uint16-array-builder.h b/c_glib/arrow-glib/uint16-array-builder.h
new file mode 100644
index 0000000..c08966e
--- /dev/null
+++ b/c_glib/arrow-glib/uint16-array-builder.h
@@ -0,0 +1,76 @@
+/*
+ * 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-builder.h>
+
+G_BEGIN_DECLS
+
+#define GARROW_TYPE_UINT16_ARRAY_BUILDER \
+ (garrow_uint16_array_builder_get_type())
+#define GARROW_UINT16_ARRAY_BUILDER(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj), \
+ GARROW_TYPE_UINT16_ARRAY_BUILDER, \
+ GArrowUInt16ArrayBuilder))
+#define GARROW_UINT16_ARRAY_BUILDER_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST((klass), \
+ GARROW_TYPE_UINT16_ARRAY_BUILDER, \
+ GArrowUInt16ArrayBuilderClass))
+#define GARROW_IS_UINT16_ARRAY_BUILDER(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj), \
+ GARROW_TYPE_UINT16_ARRAY_BUILDER))
+#define GARROW_IS_UINT16_ARRAY_BUILDER_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE((klass), \
+ GARROW_TYPE_UINT16_ARRAY_BUILDER))
+#define GARROW_UINT16_ARRAY_BUILDER_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS((obj), \
+ GARROW_TYPE_UINT16_ARRAY_BUILDER, \
+ GArrowUInt16ArrayBuilderClass))
+
+typedef struct _GArrowUInt16ArrayBuilder GArrowUInt16ArrayBuilder;
+typedef struct _GArrowUInt16ArrayBuilderClass GArrowUInt16ArrayBuilderClass;
+
+/**
+ * GArrowUInt16ArrayBuilder:
+ *
+ * It wraps `arrow::UInt16Builder`.
+ */
+struct _GArrowUInt16ArrayBuilder
+{
+ /*< private >*/
+ GArrowArrayBuilder parent_instance;
+};
+
+struct _GArrowUInt16ArrayBuilderClass
+{
+ GArrowArrayBuilderClass parent_class;
+};
+
+GType garrow_uint16_array_builder_get_type(void) G_GNUC_CONST;
+
+GArrowUInt16ArrayBuilder *garrow_uint16_array_builder_new(void);
+
+gboolean garrow_uint16_array_builder_append(GArrowUInt16ArrayBuilder *builder,
+ guint16 value,
+ GError **error);
+gboolean garrow_uint16_array_builder_append_null(GArrowUInt16ArrayBuilder *builder,
+ GError **error);
+
+G_END_DECLS
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/uint16-array.cpp
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/uint16-array.cpp b/c_glib/arrow-glib/uint16-array.cpp
new file mode 100644
index 0000000..6c416c6
--- /dev/null
+++ b/c_glib/arrow-glib/uint16-array.cpp
@@ -0,0 +1,69 @@
+/*
+ * 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/uint16-array.h>
+
+G_BEGIN_DECLS
+
+/**
+ * SECTION: uint16-array
+ * @short_description: 16-bit unsigned integer array class
+ *
+ * #GArrowUInt16Array is a class for 16-bit unsigned integer array. It
+ * can store zero or more 16-bit unsigned integer data.
+ *
+ * #GArrowUInt16Array is immutable. You need to use
+ * #GArrowUInt16ArrayBuilder to create a new array.
+ */
+
+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_END_DECLS
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/uint16-array.h
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/uint16-array.h b/c_glib/arrow-glib/uint16-array.h
new file mode 100644
index 0000000..4472551
--- /dev/null
+++ b/c_glib/arrow-glib/uint16-array.h
@@ -0,0 +1,71 @@
+/*
+ * 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_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);
+
+G_END_DECLS
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/uint16-data-type.cpp
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/uint16-data-type.cpp b/c_glib/arrow-glib/uint16-data-type.cpp
new file mode 100644
index 0000000..918b75d
--- /dev/null
+++ b/c_glib/arrow-glib/uint16-data-type.cpp
@@ -0,0 +1,67 @@
+/*
+ * 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/data-type.hpp>
+#include <arrow-glib/uint16-data-type.h>
+
+G_BEGIN_DECLS
+
+/**
+ * SECTION: uint16-data-type
+ * @short_description: 16-bit unsigned integer data type
+ *
+ * #GArrowUInt16DataType is a class for 16-bit unsigned integer data type.
+ */
+
+G_DEFINE_TYPE(GArrowUInt16DataType, \
+ garrow_uint16_data_type, \
+ GARROW_TYPE_DATA_TYPE)
+
+static void
+garrow_uint16_data_type_init(GArrowUInt16DataType *object)
+{
+}
+
+static void
+garrow_uint16_data_type_class_init(GArrowUInt16DataTypeClass *klass)
+{
+}
+
+/**
+ * garrow_uint16_data_type_new:
+ *
+ * Returns: The newly created 16-bit unsigned integer data type.
+ */
+GArrowUInt16DataType *
+garrow_uint16_data_type_new(void)
+{
+ auto arrow_data_type = arrow::uint16();
+
+ GArrowUInt16DataType *data_type =
+ GARROW_UINT16_DATA_TYPE(g_object_new(GARROW_TYPE_UINT16_DATA_TYPE,
+ "data-type", &arrow_data_type,
+ NULL));
+ return data_type;
+}
+
+G_END_DECLS
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/uint16-data-type.h
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/uint16-data-type.h b/c_glib/arrow-glib/uint16-data-type.h
new file mode 100644
index 0000000..b65189d
--- /dev/null
+++ b/c_glib/arrow-glib/uint16-data-type.h
@@ -0,0 +1,69 @@
+/*
+ * 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/data-type.h>
+
+G_BEGIN_DECLS
+
+#define GARROW_TYPE_UINT16_DATA_TYPE \
+ (garrow_uint16_data_type_get_type())
+#define GARROW_UINT16_DATA_TYPE(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj), \
+ GARROW_TYPE_UINT16_DATA_TYPE, \
+ GArrowUInt16DataType))
+#define GARROW_UINT16_DATA_TYPE_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST((klass), \
+ GARROW_TYPE_UINT16_DATA_TYPE, \
+ GArrowUInt16DataTypeClass))
+#define GARROW_IS_UINT16_DATA_TYPE(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj), \
+ GARROW_TYPE_UINT16_DATA_TYPE))
+#define GARROW_IS_UINT16_DATA_TYPE_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE((klass), \
+ GARROW_TYPE_UINT16_DATA_TYPE))
+#define GARROW_UINT16_DATA_TYPE_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS((obj), \
+ GARROW_TYPE_UINT16_DATA_TYPE, \
+ GArrowUInt16DataTypeClass))
+
+typedef struct _GArrowUInt16DataType GArrowUInt16DataType;
+typedef struct _GArrowUInt16DataTypeClass GArrowUInt16DataTypeClass;
+
+/**
+ * GArrowUInt16DataType:
+ *
+ * It wraps `arrow::UInt16Type`.
+ */
+struct _GArrowUInt16DataType
+{
+ /*< private >*/
+ GArrowDataType parent_instance;
+};
+
+struct _GArrowUInt16DataTypeClass
+{
+ GArrowDataTypeClass parent_class;
+};
+
+GType garrow_uint16_data_type_get_type (void) G_GNUC_CONST;
+GArrowUInt16DataType *garrow_uint16_data_type_new (void);
+
+G_END_DECLS
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/uint32-array-builder.cpp
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/uint32-array-builder.cpp b/c_glib/arrow-glib/uint32-array-builder.cpp
new file mode 100644
index 0000000..35b1893
--- /dev/null
+++ b/c_glib/arrow-glib/uint32-array-builder.cpp
@@ -0,0 +1,120 @@
+/*
+ * 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-builder.hpp>
+#include <arrow-glib/error.hpp>
+#include <arrow-glib/uint32-array-builder.h>
+
+G_BEGIN_DECLS
+
+/**
+ * SECTION: uint32-array-builder
+ * @short_description: 32-bit unsigned integer array builder class
+ *
+ * #GArrowUInt32ArrayBuilder is the class to create a new
+ * #GArrowUInt32Array.
+ */
+
+G_DEFINE_TYPE(GArrowUInt32ArrayBuilder,
+ garrow_uint32_array_builder,
+ GARROW_TYPE_ARRAY_BUILDER)
+
+static void
+garrow_uint32_array_builder_init(GArrowUInt32ArrayBuilder *builder)
+{
+}
+
+static void
+garrow_uint32_array_builder_class_init(GArrowUInt32ArrayBuilderClass *klass)
+{
+}
+
+/**
+ * garrow_uint32_array_builder_new:
+ *
+ * Returns: A newly created #GArrowUInt32ArrayBuilder.
+ */
+GArrowUInt32ArrayBuilder *
+garrow_uint32_array_builder_new(void)
+{
+ auto memory_pool = arrow::default_memory_pool();
+ auto arrow_builder =
+ std::make_shared<arrow::UInt32Builder>(memory_pool, arrow::uint32());
+ auto builder =
+ GARROW_UINT32_ARRAY_BUILDER(g_object_new(GARROW_TYPE_UINT32_ARRAY_BUILDER,
+ "array-builder", &arrow_builder,
+ NULL));
+ return builder;
+}
+
+/**
+ * garrow_uint32_array_builder_append:
+ * @builder: A #GArrowUInt32ArrayBuilder.
+ * @value: An uint32 value.
+ * @error: (nullable): Return location for a #GError or %NULL.
+ *
+ * Returns: %TRUE on success, %FALSE if there was an error.
+ */
+gboolean
+garrow_uint32_array_builder_append(GArrowUInt32ArrayBuilder *builder,
+ guint32 value,
+ GError **error)
+{
+ auto arrow_builder =
+ static_cast<arrow::UInt32Builder *>(
+ garrow_array_builder_get_raw(GARROW_ARRAY_BUILDER(builder)).get());
+
+ auto status = arrow_builder->Append(value);
+ if (status.ok()) {
+ return TRUE;
+ } else {
+ garrow_error_set(error, status, "[uint32-array-builder][append]");
+ return FALSE;
+ }
+}
+
+/**
+ * garrow_uint32_array_builder_append_null:
+ * @builder: A #GArrowUInt32ArrayBuilder.
+ * @error: (nullable): Return location for a #GError or %NULL.
+ *
+ * Returns: %TRUE on success, %FALSE if there was an error.
+ */
+gboolean
+garrow_uint32_array_builder_append_null(GArrowUInt32ArrayBuilder *builder,
+ GError **error)
+{
+ auto arrow_builder =
+ static_cast<arrow::UInt32Builder *>(
+ garrow_array_builder_get_raw(GARROW_ARRAY_BUILDER(builder)).get());
+
+ auto status = arrow_builder->AppendNull();
+ if (status.ok()) {
+ return TRUE;
+ } else {
+ garrow_error_set(error, status, "[uint32-array-builder][append-null]");
+ return FALSE;
+ }
+}
+
+G_END_DECLS
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/uint32-array-builder.h
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/uint32-array-builder.h b/c_glib/arrow-glib/uint32-array-builder.h
new file mode 100644
index 0000000..4881d3b
--- /dev/null
+++ b/c_glib/arrow-glib/uint32-array-builder.h
@@ -0,0 +1,76 @@
+/*
+ * 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-builder.h>
+
+G_BEGIN_DECLS
+
+#define GARROW_TYPE_UINT32_ARRAY_BUILDER \
+ (garrow_uint32_array_builder_get_type())
+#define GARROW_UINT32_ARRAY_BUILDER(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj), \
+ GARROW_TYPE_UINT32_ARRAY_BUILDER, \
+ GArrowUInt32ArrayBuilder))
+#define GARROW_UINT32_ARRAY_BUILDER_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST((klass), \
+ GARROW_TYPE_UINT32_ARRAY_BUILDER, \
+ GArrowUInt32ArrayBuilderClass))
+#define GARROW_IS_UINT32_ARRAY_BUILDER(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj), \
+ GARROW_TYPE_UINT32_ARRAY_BUILDER))
+#define GARROW_IS_UINT32_ARRAY_BUILDER_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE((klass), \
+ GARROW_TYPE_UINT32_ARRAY_BUILDER))
+#define GARROW_UINT32_ARRAY_BUILDER_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS((obj), \
+ GARROW_TYPE_UINT32_ARRAY_BUILDER, \
+ GArrowUInt32ArrayBuilderClass))
+
+typedef struct _GArrowUInt32ArrayBuilder GArrowUInt32ArrayBuilder;
+typedef struct _GArrowUInt32ArrayBuilderClass GArrowUInt32ArrayBuilderClass;
+
+/**
+ * GArrowUInt32ArrayBuilder:
+ *
+ * It wraps `arrow::UInt32Builder`.
+ */
+struct _GArrowUInt32ArrayBuilder
+{
+ /*< private >*/
+ GArrowArrayBuilder parent_instance;
+};
+
+struct _GArrowUInt32ArrayBuilderClass
+{
+ GArrowArrayBuilderClass parent_class;
+};
+
+GType garrow_uint32_array_builder_get_type(void) G_GNUC_CONST;
+
+GArrowUInt32ArrayBuilder *garrow_uint32_array_builder_new(void);
+
+gboolean garrow_uint32_array_builder_append(GArrowUInt32ArrayBuilder *builder,
+ guint32 value,
+ GError **error);
+gboolean garrow_uint32_array_builder_append_null(GArrowUInt32ArrayBuilder *builder,
+ GError **error);
+
+G_END_DECLS
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/uint32-array.cpp
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/uint32-array.cpp b/c_glib/arrow-glib/uint32-array.cpp
new file mode 100644
index 0000000..d10f100
--- /dev/null
+++ b/c_glib/arrow-glib/uint32-array.cpp
@@ -0,0 +1,69 @@
+/*
+ * 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/uint32-array.h>
+
+G_BEGIN_DECLS
+
+/**
+ * SECTION: uint32-array
+ * @short_description: 32-bit unsigned integer array class
+ *
+ * #GArrowUInt32Array is a class for 32-bit unsigned integer array. It
+ * can store zero or more 32-bit unsigned integer data.
+ *
+ * #GArrowUInt32Array is immutable. You need to use
+ * #GArrowUInt32ArrayBuilder to create a new array.
+ */
+
+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_END_DECLS
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/uint32-array.h
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/uint32-array.h b/c_glib/arrow-glib/uint32-array.h
new file mode 100644
index 0000000..57d4bea
--- /dev/null
+++ b/c_glib/arrow-glib/uint32-array.h
@@ -0,0 +1,71 @@
+/*
+ * 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_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);
+
+G_END_DECLS
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/uint32-data-type.cpp
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/uint32-data-type.cpp b/c_glib/arrow-glib/uint32-data-type.cpp
new file mode 100644
index 0000000..fde14f3
--- /dev/null
+++ b/c_glib/arrow-glib/uint32-data-type.cpp
@@ -0,0 +1,67 @@
+/*
+ * 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/data-type.hpp>
+#include <arrow-glib/uint32-data-type.h>
+
+G_BEGIN_DECLS
+
+/**
+ * SECTION: uint32-data-type
+ * @short_description: 32-bit unsigned integer data type
+ *
+ * #GArrowUInt32DataType is a class for 32-bit unsigned integer data type.
+ */
+
+G_DEFINE_TYPE(GArrowUInt32DataType, \
+ garrow_uint32_data_type, \
+ GARROW_TYPE_DATA_TYPE)
+
+static void
+garrow_uint32_data_type_init(GArrowUInt32DataType *object)
+{
+}
+
+static void
+garrow_uint32_data_type_class_init(GArrowUInt32DataTypeClass *klass)
+{
+}
+
+/**
+ * garrow_uint32_data_type_new:
+ *
+ * Returns: The newly created 32-bit unsigned integer data type.
+ */
+GArrowUInt32DataType *
+garrow_uint32_data_type_new(void)
+{
+ auto arrow_data_type = arrow::uint32();
+
+ GArrowUInt32DataType *data_type =
+ GARROW_UINT32_DATA_TYPE(g_object_new(GARROW_TYPE_UINT32_DATA_TYPE,
+ "data-type", &arrow_data_type,
+ NULL));
+ return data_type;
+}
+
+G_END_DECLS
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/uint32-data-type.h
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/uint32-data-type.h b/c_glib/arrow-glib/uint32-data-type.h
new file mode 100644
index 0000000..4fe60cd
--- /dev/null
+++ b/c_glib/arrow-glib/uint32-data-type.h
@@ -0,0 +1,69 @@
+/*
+ * 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/data-type.h>
+
+G_BEGIN_DECLS
+
+#define GARROW_TYPE_UINT32_DATA_TYPE \
+ (garrow_uint32_data_type_get_type())
+#define GARROW_UINT32_DATA_TYPE(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj), \
+ GARROW_TYPE_UINT32_DATA_TYPE, \
+ GArrowUInt32DataType))
+#define GARROW_UINT32_DATA_TYPE_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST((klass), \
+ GARROW_TYPE_UINT32_DATA_TYPE, \
+ GArrowUInt32DataTypeClass))
+#define GARROW_IS_UINT32_DATA_TYPE(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj), \
+ GARROW_TYPE_UINT32_DATA_TYPE))
+#define GARROW_IS_UINT32_DATA_TYPE_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE((klass), \
+ GARROW_TYPE_UINT32_DATA_TYPE))
+#define GARROW_UINT32_DATA_TYPE_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS((obj), \
+ GARROW_TYPE_UINT32_DATA_TYPE, \
+ GArrowUInt32DataTypeClass))
+
+typedef struct _GArrowUInt32DataType GArrowUInt32DataType;
+typedef struct _GArrowUInt32DataTypeClass GArrowUInt32DataTypeClass;
+
+/**
+ * GArrowUInt32DataType:
+ *
+ * It wraps `arrow::UInt32Type`.
+ */
+struct _GArrowUInt32DataType
+{
+ /*< private >*/
+ GArrowDataType parent_instance;
+};
+
+struct _GArrowUInt32DataTypeClass
+{
+ GArrowDataTypeClass parent_class;
+};
+
+GType garrow_uint32_data_type_get_type (void) G_GNUC_CONST;
+GArrowUInt32DataType *garrow_uint32_data_type_new (void);
+
+G_END_DECLS
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/uint64-array-builder.cpp
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/uint64-array-builder.cpp b/c_glib/arrow-glib/uint64-array-builder.cpp
new file mode 100644
index 0000000..85d24ca
--- /dev/null
+++ b/c_glib/arrow-glib/uint64-array-builder.cpp
@@ -0,0 +1,120 @@
+/*
+ * 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-builder.hpp>
+#include <arrow-glib/error.hpp>
+#include <arrow-glib/uint64-array-builder.h>
+
+G_BEGIN_DECLS
+
+/**
+ * SECTION: uint64-array-builder
+ * @short_description: 64-bit unsigned integer array builder class
+ *
+ * #GArrowUInt64ArrayBuilder is the class to create a new
+ * #GArrowUInt64Array.
+ */
+
+G_DEFINE_TYPE(GArrowUInt64ArrayBuilder,
+ garrow_uint64_array_builder,
+ GARROW_TYPE_ARRAY_BUILDER)
+
+static void
+garrow_uint64_array_builder_init(GArrowUInt64ArrayBuilder *builder)
+{
+}
+
+static void
+garrow_uint64_array_builder_class_init(GArrowUInt64ArrayBuilderClass *klass)
+{
+}
+
+/**
+ * garrow_uint64_array_builder_new:
+ *
+ * Returns: A newly created #GArrowUInt64ArrayBuilder.
+ */
+GArrowUInt64ArrayBuilder *
+garrow_uint64_array_builder_new(void)
+{
+ auto memory_pool = arrow::default_memory_pool();
+ auto arrow_builder =
+ std::make_shared<arrow::UInt64Builder>(memory_pool, arrow::uint64());
+ auto builder =
+ GARROW_UINT64_ARRAY_BUILDER(g_object_new(GARROW_TYPE_UINT64_ARRAY_BUILDER,
+ "array-builder", &arrow_builder,
+ NULL));
+ return builder;
+}
+
+/**
+ * garrow_uint64_array_builder_append:
+ * @builder: A #GArrowUInt64ArrayBuilder.
+ * @value: An uint64 value.
+ * @error: (nullable): Return location for a #GError or %NULL.
+ *
+ * Returns: %TRUE on success, %FALSE if there was an error.
+ */
+gboolean
+garrow_uint64_array_builder_append(GArrowUInt64ArrayBuilder *builder,
+ guint64 value,
+ GError **error)
+{
+ auto arrow_builder =
+ static_cast<arrow::UInt64Builder *>(
+ garrow_array_builder_get_raw(GARROW_ARRAY_BUILDER(builder)).get());
+
+ auto status = arrow_builder->Append(value);
+ if (status.ok()) {
+ return TRUE;
+ } else {
+ garrow_error_set(error, status, "[uint64-array-builder][append]");
+ return FALSE;
+ }
+}
+
+/**
+ * garrow_uint64_array_builder_append_null:
+ * @builder: A #GArrowUInt64ArrayBuilder.
+ * @error: (nullable): Return location for a #GError or %NULL.
+ *
+ * Returns: %TRUE on success, %FALSE if there was an error.
+ */
+gboolean
+garrow_uint64_array_builder_append_null(GArrowUInt64ArrayBuilder *builder,
+ GError **error)
+{
+ auto arrow_builder =
+ static_cast<arrow::UInt64Builder *>(
+ garrow_array_builder_get_raw(GARROW_ARRAY_BUILDER(builder)).get());
+
+ auto status = arrow_builder->AppendNull();
+ if (status.ok()) {
+ return TRUE;
+ } else {
+ garrow_error_set(error, status, "[uint64-array-builder][append-null]");
+ return FALSE;
+ }
+}
+
+G_END_DECLS
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/uint64-array-builder.h
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/uint64-array-builder.h b/c_glib/arrow-glib/uint64-array-builder.h
new file mode 100644
index 0000000..c51d1e2
--- /dev/null
+++ b/c_glib/arrow-glib/uint64-array-builder.h
@@ -0,0 +1,76 @@
+/*
+ * 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-builder.h>
+
+G_BEGIN_DECLS
+
+#define GARROW_TYPE_UINT64_ARRAY_BUILDER \
+ (garrow_uint64_array_builder_get_type())
+#define GARROW_UINT64_ARRAY_BUILDER(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj), \
+ GARROW_TYPE_UINT64_ARRAY_BUILDER, \
+ GArrowUInt64ArrayBuilder))
+#define GARROW_UINT64_ARRAY_BUILDER_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST((klass), \
+ GARROW_TYPE_UINT64_ARRAY_BUILDER, \
+ GArrowUInt64ArrayBuilderClass))
+#define GARROW_IS_UINT64_ARRAY_BUILDER(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj), \
+ GARROW_TYPE_UINT64_ARRAY_BUILDER))
+#define GARROW_IS_UINT64_ARRAY_BUILDER_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE((klass), \
+ GARROW_TYPE_UINT64_ARRAY_BUILDER))
+#define GARROW_UINT64_ARRAY_BUILDER_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS((obj), \
+ GARROW_TYPE_UINT64_ARRAY_BUILDER, \
+ GArrowUInt64ArrayBuilderClass))
+
+typedef struct _GArrowUInt64ArrayBuilder GArrowUInt64ArrayBuilder;
+typedef struct _GArrowUInt64ArrayBuilderClass GArrowUInt64ArrayBuilderClass;
+
+/**
+ * GArrowUInt64ArrayBuilder:
+ *
+ * It wraps `arrow::UInt64Builder`.
+ */
+struct _GArrowUInt64ArrayBuilder
+{
+ /*< private >*/
+ GArrowArrayBuilder parent_instance;
+};
+
+struct _GArrowUInt64ArrayBuilderClass
+{
+ GArrowArrayBuilderClass parent_class;
+};
+
+GType garrow_uint64_array_builder_get_type(void) G_GNUC_CONST;
+
+GArrowUInt64ArrayBuilder *garrow_uint64_array_builder_new(void);
+
+gboolean garrow_uint64_array_builder_append(GArrowUInt64ArrayBuilder *builder,
+ guint64 value,
+ GError **error);
+gboolean garrow_uint64_array_builder_append_null(GArrowUInt64ArrayBuilder *builder,
+ GError **error);
+
+G_END_DECLS
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/uint64-array.cpp
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/uint64-array.cpp b/c_glib/arrow-glib/uint64-array.cpp
new file mode 100644
index 0000000..1f90084
--- /dev/null
+++ b/c_glib/arrow-glib/uint64-array.cpp
@@ -0,0 +1,69 @@
+/*
+ * 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/uint64-array.h>
+
+G_BEGIN_DECLS
+
+/**
+ * SECTION: uint64-array
+ * @short_description: 64-bit unsigned integer array class
+ *
+ * #GArrowUInt64Array is a class for 64-bit unsigned integer array. It
+ * can store zero or more 64-bit unsigned integer data.
+ *
+ * #GArrowUInt64Array is immutable. You need to use
+ * #GArrowUInt64ArrayBuilder to create a new array.
+ */
+
+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_END_DECLS
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/uint64-array.h
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/uint64-array.h b/c_glib/arrow-glib/uint64-array.h
new file mode 100644
index 0000000..b5abde5
--- /dev/null
+++ b/c_glib/arrow-glib/uint64-array.h
@@ -0,0 +1,71 @@
+/*
+ * 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_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);
+
+G_END_DECLS
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/uint64-data-type.cpp
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/uint64-data-type.cpp b/c_glib/arrow-glib/uint64-data-type.cpp
new file mode 100644
index 0000000..7c18b36
--- /dev/null
+++ b/c_glib/arrow-glib/uint64-data-type.cpp
@@ -0,0 +1,67 @@
+/*
+ * 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/data-type.hpp>
+#include <arrow-glib/uint64-data-type.h>
+
+G_BEGIN_DECLS
+
+/**
+ * SECTION: uint64-data-type
+ * @short_description: 64-bit unsigned integer data type
+ *
+ * #GArrowUInt64DataType is a class for 64-bit unsigned integer data type.
+ */
+
+G_DEFINE_TYPE(GArrowUInt64DataType, \
+ garrow_uint64_data_type, \
+ GARROW_TYPE_DATA_TYPE)
+
+static void
+garrow_uint64_data_type_init(GArrowUInt64DataType *object)
+{
+}
+
+static void
+garrow_uint64_data_type_class_init(GArrowUInt64DataTypeClass *klass)
+{
+}
+
+/**
+ * garrow_uint64_data_type_new:
+ *
+ * Returns: The newly created 64-bit unsigned integer data type.
+ */
+GArrowUInt64DataType *
+garrow_uint64_data_type_new(void)
+{
+ auto arrow_data_type = arrow::uint64();
+
+ GArrowUInt64DataType *data_type =
+ GARROW_UINT64_DATA_TYPE(g_object_new(GARROW_TYPE_UINT64_DATA_TYPE,
+ "data-type", &arrow_data_type,
+ NULL));
+ return data_type;
+}
+
+G_END_DECLS
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/uint64-data-type.h
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/uint64-data-type.h b/c_glib/arrow-glib/uint64-data-type.h
new file mode 100644
index 0000000..221023c
--- /dev/null
+++ b/c_glib/arrow-glib/uint64-data-type.h
@@ -0,0 +1,69 @@
+/*
+ * 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/data-type.h>
+
+G_BEGIN_DECLS
+
+#define GARROW_TYPE_UINT64_DATA_TYPE \
+ (garrow_uint64_data_type_get_type())
+#define GARROW_UINT64_DATA_TYPE(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj), \
+ GARROW_TYPE_UINT64_DATA_TYPE, \
+ GArrowUInt64DataType))
+#define GARROW_UINT64_DATA_TYPE_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST((klass), \
+ GARROW_TYPE_UINT64_DATA_TYPE, \
+ GArrowUInt64DataTypeClass))
+#define GARROW_IS_UINT64_DATA_TYPE(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj), \
+ GARROW_TYPE_UINT64_DATA_TYPE))
+#define GARROW_IS_UINT64_DATA_TYPE_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE((klass), \
+ GARROW_TYPE_UINT64_DATA_TYPE))
+#define GARROW_UINT64_DATA_TYPE_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS((obj), \
+ GARROW_TYPE_UINT64_DATA_TYPE, \
+ GArrowUInt64DataTypeClass))
+
+typedef struct _GArrowUInt64DataType GArrowUInt64DataType;
+typedef struct _GArrowUInt64DataTypeClass GArrowUInt64DataTypeClass;
+
+/**
+ * GArrowUInt64DataType:
+ *
+ * It wraps `arrow::UInt64Type`.
+ */
+struct _GArrowUInt64DataType
+{
+ /*< private >*/
+ GArrowDataType parent_instance;
+};
+
+struct _GArrowUInt64DataTypeClass
+{
+ GArrowDataTypeClass parent_class;
+};
+
+GType garrow_uint64_data_type_get_type (void) G_GNUC_CONST;
+GArrowUInt64DataType *garrow_uint64_data_type_new (void);
+
+G_END_DECLS
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/uint8-array-builder.cpp
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/uint8-array-builder.cpp b/c_glib/arrow-glib/uint8-array-builder.cpp
new file mode 100644
index 0000000..2f49693
--- /dev/null
+++ b/c_glib/arrow-glib/uint8-array-builder.cpp
@@ -0,0 +1,120 @@
+/*
+ * 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-builder.hpp>
+#include <arrow-glib/error.hpp>
+#include <arrow-glib/uint8-array-builder.h>
+
+G_BEGIN_DECLS
+
+/**
+ * SECTION: uint8-array-builder
+ * @short_description: 8-bit unsigned integer array builder class
+ *
+ * #GArrowUInt8ArrayBuilder is the class to create a new
+ * #GArrowUInt8Array.
+ */
+
+G_DEFINE_TYPE(GArrowUInt8ArrayBuilder,
+ garrow_uint8_array_builder,
+ GARROW_TYPE_ARRAY_BUILDER)
+
+static void
+garrow_uint8_array_builder_init(GArrowUInt8ArrayBuilder *builder)
+{
+}
+
+static void
+garrow_uint8_array_builder_class_init(GArrowUInt8ArrayBuilderClass *klass)
+{
+}
+
+/**
+ * garrow_uint8_array_builder_new:
+ *
+ * Returns: A newly created #GArrowUInt8ArrayBuilder.
+ */
+GArrowUInt8ArrayBuilder *
+garrow_uint8_array_builder_new(void)
+{
+ auto memory_pool = arrow::default_memory_pool();
+ auto arrow_builder =
+ std::make_shared<arrow::UInt8Builder>(memory_pool, arrow::uint8());
+ auto builder =
+ GARROW_UINT8_ARRAY_BUILDER(g_object_new(GARROW_TYPE_UINT8_ARRAY_BUILDER,
+ "array-builder", &arrow_builder,
+ NULL));
+ return builder;
+}
+
+/**
+ * garrow_uint8_array_builder_append:
+ * @builder: A #GArrowUInt8ArrayBuilder.
+ * @value: An uint8 value.
+ * @error: (nullable): Return location for a #GError or %NULL.
+ *
+ * Returns: %TRUE on success, %FALSE if there was an error.
+ */
+gboolean
+garrow_uint8_array_builder_append(GArrowUInt8ArrayBuilder *builder,
+ guint8 value,
+ GError **error)
+{
+ auto arrow_builder =
+ static_cast<arrow::UInt8Builder *>(
+ garrow_array_builder_get_raw(GARROW_ARRAY_BUILDER(builder)).get());
+
+ auto status = arrow_builder->Append(value);
+ if (status.ok()) {
+ return TRUE;
+ } else {
+ garrow_error_set(error, status, "[uint8-array-builder][append]");
+ return FALSE;
+ }
+}
+
+/**
+ * garrow_uint8_array_builder_append_null:
+ * @builder: A #GArrowUInt8ArrayBuilder.
+ * @error: (nullable): Return location for a #GError or %NULL.
+ *
+ * Returns: %TRUE on success, %FALSE if there was an error.
+ */
+gboolean
+garrow_uint8_array_builder_append_null(GArrowUInt8ArrayBuilder *builder,
+ GError **error)
+{
+ auto arrow_builder =
+ static_cast<arrow::UInt8Builder *>(
+ garrow_array_builder_get_raw(GARROW_ARRAY_BUILDER(builder)).get());
+
+ auto status = arrow_builder->AppendNull();
+ if (status.ok()) {
+ return TRUE;
+ } else {
+ garrow_error_set(error, status, "[uint8-array-builder][append-null]");
+ return FALSE;
+ }
+}
+
+G_END_DECLS
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/uint8-array-builder.h
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/uint8-array-builder.h b/c_glib/arrow-glib/uint8-array-builder.h
new file mode 100644
index 0000000..e721693
--- /dev/null
+++ b/c_glib/arrow-glib/uint8-array-builder.h
@@ -0,0 +1,76 @@
+/*
+ * 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-builder.h>
+
+G_BEGIN_DECLS
+
+#define GARROW_TYPE_UINT8_ARRAY_BUILDER \
+ (garrow_uint8_array_builder_get_type())
+#define GARROW_UINT8_ARRAY_BUILDER(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj), \
+ GARROW_TYPE_UINT8_ARRAY_BUILDER, \
+ GArrowUInt8ArrayBuilder))
+#define GARROW_UINT8_ARRAY_BUILDER_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST((klass), \
+ GARROW_TYPE_UINT8_ARRAY_BUILDER, \
+ GArrowUInt8ArrayBuilderClass))
+#define GARROW_IS_UINT8_ARRAY_BUILDER(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj), \
+ GARROW_TYPE_UINT8_ARRAY_BUILDER))
+#define GARROW_IS_UINT8_ARRAY_BUILDER_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE((klass), \
+ GARROW_TYPE_UINT8_ARRAY_BUILDER))
+#define GARROW_UINT8_ARRAY_BUILDER_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS((obj), \
+ GARROW_TYPE_UINT8_ARRAY_BUILDER, \
+ GArrowUInt8ArrayBuilderClass))
+
+typedef struct _GArrowUInt8ArrayBuilder GArrowUInt8ArrayBuilder;
+typedef struct _GArrowUInt8ArrayBuilderClass GArrowUInt8ArrayBuilderClass;
+
+/**
+ * GArrowUInt8ArrayBuilder:
+ *
+ * It wraps `arrow::UInt8Builder`.
+ */
+struct _GArrowUInt8ArrayBuilder
+{
+ /*< private >*/
+ GArrowArrayBuilder parent_instance;
+};
+
+struct _GArrowUInt8ArrayBuilderClass
+{
+ GArrowArrayBuilderClass parent_class;
+};
+
+GType garrow_uint8_array_builder_get_type(void) G_GNUC_CONST;
+
+GArrowUInt8ArrayBuilder *garrow_uint8_array_builder_new(void);
+
+gboolean garrow_uint8_array_builder_append(GArrowUInt8ArrayBuilder *builder,
+ guint8 value,
+ GError **error);
+gboolean garrow_uint8_array_builder_append_null(GArrowUInt8ArrayBuilder *builder,
+ GError **error);
+
+G_END_DECLS
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/uint8-array.cpp
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/uint8-array.cpp b/c_glib/arrow-glib/uint8-array.cpp
new file mode 100644
index 0000000..b5a2595
--- /dev/null
+++ b/c_glib/arrow-glib/uint8-array.cpp
@@ -0,0 +1,69 @@
+/*
+ * 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/uint8-array.h>
+
+G_BEGIN_DECLS
+
+/**
+ * SECTION: uint8-array
+ * @short_description: 8-bit unsigned integer array class
+ *
+ * #GArrowUInt8Array is a class for 8-bit unsigned integer array. It
+ * can store zero or more 8-bit unsigned integer data.
+ *
+ * #GArrowUInt8Array is immutable. You need to use
+ * #GArrowUInt8ArrayBuilder to create a new array.
+ */
+
+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_END_DECLS
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/uint8-array.h
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/uint8-array.h b/c_glib/arrow-glib/uint8-array.h
new file mode 100644
index 0000000..a572bc5
--- /dev/null
+++ b/c_glib/arrow-glib/uint8-array.h
@@ -0,0 +1,71 @@
+/*
+ * 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_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);
+
+G_END_DECLS
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/uint8-data-type.cpp
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/uint8-data-type.cpp b/c_glib/arrow-glib/uint8-data-type.cpp
new file mode 100644
index 0000000..7c93e45
--- /dev/null
+++ b/c_glib/arrow-glib/uint8-data-type.cpp
@@ -0,0 +1,67 @@
+/*
+ * 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/data-type.hpp>
+#include <arrow-glib/uint8-data-type.h>
+
+G_BEGIN_DECLS
+
+/**
+ * SECTION: uint8-data-type
+ * @short_description: 8-bit unsigned integer data type
+ *
+ * #GArrowUInt8DataType is a class for 8-bit unsigned integer data type.
+ */
+
+G_DEFINE_TYPE(GArrowUInt8DataType, \
+ garrow_uint8_data_type, \
+ GARROW_TYPE_DATA_TYPE)
+
+static void
+garrow_uint8_data_type_init(GArrowUInt8DataType *object)
+{
+}
+
+static void
+garrow_uint8_data_type_class_init(GArrowUInt8DataTypeClass *klass)
+{
+}
+
+/**
+ * garrow_uint8_data_type_new:
+ *
+ * Returns: The newly created 8-bit unsigned integer data type.
+ */
+GArrowUInt8DataType *
+garrow_uint8_data_type_new(void)
+{
+ auto arrow_data_type = arrow::uint8();
+
+ GArrowUInt8DataType *data_type =
+ GARROW_UINT8_DATA_TYPE(g_object_new(GARROW_TYPE_UINT8_DATA_TYPE,
+ "data-type", &arrow_data_type,
+ NULL));
+ return data_type;
+}
+
+G_END_DECLS
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/uint8-data-type.h
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/uint8-data-type.h b/c_glib/arrow-glib/uint8-data-type.h
new file mode 100644
index 0000000..6e05852
--- /dev/null
+++ b/c_glib/arrow-glib/uint8-data-type.h
@@ -0,0 +1,69 @@
+/*
+ * 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/data-type.h>
+
+G_BEGIN_DECLS
+
+#define GARROW_TYPE_UINT8_DATA_TYPE \
+ (garrow_uint8_data_type_get_type())
+#define GARROW_UINT8_DATA_TYPE(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj), \
+ GARROW_TYPE_UINT8_DATA_TYPE, \
+ GArrowUInt8DataType))
+#define GARROW_UINT8_DATA_TYPE_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST((klass), \
+ GARROW_TYPE_UINT8_DATA_TYPE, \
+ GArrowUInt8DataTypeClass))
+#define GARROW_IS_UINT8_DATA_TYPE(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj), \
+ GARROW_TYPE_UINT8_DATA_TYPE))
+#define GARROW_IS_UINT8_DATA_TYPE_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE((klass), \
+ GARROW_TYPE_UINT8_DATA_TYPE))
+#define GARROW_UINT8_DATA_TYPE_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS((obj), \
+ GARROW_TYPE_UINT8_DATA_TYPE, \
+ GArrowUInt8DataTypeClass))
+
+typedef struct _GArrowUInt8DataType GArrowUInt8DataType;
+typedef struct _GArrowUInt8DataTypeClass GArrowUInt8DataTypeClass;
+
+/**
+ * GArrowUInt8DataType:
+ *
+ * It wraps `arrow::UInt8Type`.
+ */
+struct _GArrowUInt8DataType
+{
+ /*< private >*/
+ GArrowDataType parent_instance;
+};
+
+struct _GArrowUInt8DataTypeClass
+{
+ GArrowDataTypeClass parent_class;
+};
+
+GType garrow_uint8_data_type_get_type (void) G_GNUC_CONST;
+GArrowUInt8DataType *garrow_uint8_data_type_new (void);
+
+G_END_DECLS
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/autogen.sh
----------------------------------------------------------------------
diff --git a/c_glib/autogen.sh b/c_glib/autogen.sh
new file mode 100755
index 0000000..08e33e6
--- /dev/null
+++ b/c_glib/autogen.sh
@@ -0,0 +1,31 @@
+#!/bin/sh
+#
+# 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.
+
+set -u
+set -e
+
+ruby \
+ -e 'print ARGF.read.scan(/^ <version>(.+?)<\/version>/)[0][0]' \
+ ../java/pom.xml > \
+ version
+
+mkdir -p m4
+
+gtkdocize --copy --docdir doc/reference
+autoreconf --install
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/configure.ac
----------------------------------------------------------------------
diff --git a/c_glib/configure.ac b/c_glib/configure.ac
new file mode 100644
index 0000000..85f7eec
--- /dev/null
+++ b/c_glib/configure.ac
@@ -0,0 +1,76 @@
+# 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.
+
+AC_PREREQ(2.65)
+
+m4_define([arrow_glib_version], m4_include(version))
+AC_INIT([arrow-glib], arrow_glib_version, [kou@clear-code.com])
+AC_CONFIG_AUX_DIR([config])
+AC_CONFIG_MACRO_DIR([m4])
+
+AC_CONFIG_SRCDIR([arrow-glib/arrow-glib.h])
+AC_CONFIG_HEADERS([config.h])
+
+AM_INIT_AUTOMAKE([1.13 foreign])
+AM_SILENT_RULES([yes])
+
+AC_PROG_CC
+AC_PROG_CXX
+AX_CXX_COMPILE_STDCXX_11([ext], [mandatory])
+LT_INIT
+
+GARROW_CFLAGS="-Wall -Wconversion"
+GARROW_CXXFLAGS="-Wall -Wconversion"
+AC_ARG_ENABLE(debug,
+ [AS_HELP_STRING([--enable-debug],
+ [Use debug flags (default=no)])],
+ [GARROW_DEBUG="$enableval"],
+ [GARROW_DEBUG="no"])
+if test "x$GARROW_DEBUG" != "xno"; then
+ GARROW_DEBUG="yes"
+ if test "$CLANG" = "yes"; then
+ CFLAGS="$CFLAGS -O0 -g"
+ CXXFLAGS="$CXXFLAGS -O0 -g"
+ elif test "$GCC" = "yes"; then
+ CFLAGS="$CFLAGS -O0 -g3"
+ CXXFLAGS="$CXXFLAGS -O0 -g3"
+ fi
+fi
+AC_SUBST(GARROW_CFLAGS)
+AC_SUBST(GARROW_CXXFLAGS)
+
+AM_PATH_GLIB_2_0([2.32.4], [], [], [gobject])
+
+GOBJECT_INTROSPECTION_REQUIRE([1.32.1])
+GTK_DOC_CHECK([1.18-2])
+
+PKG_CHECK_MODULES([ARROW], [arrow])
+PKG_CHECK_MODULES([ARROW_IO], [arrow-io])
+PKG_CHECK_MODULES([ARROW_IPC], [arrow-ipc])
+
+AC_CONFIG_FILES([
+ Makefile
+ arrow-glib/Makefile
+ arrow-glib/arrow-glib.pc
+ arrow-glib/arrow-io-glib.pc
+ arrow-glib/arrow-ipc-glib.pc
+ doc/Makefile
+ doc/reference/Makefile
+ example/Makefile
+])
+
+AC_OUTPUT
[8/9] arrow git commit: ARROW-631: [GLib] Import
Posted by we...@apache.org.
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/binary-data-type.h
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/binary-data-type.h b/c_glib/arrow-glib/binary-data-type.h
new file mode 100644
index 0000000..9654fe2
--- /dev/null
+++ b/c_glib/arrow-glib/binary-data-type.h
@@ -0,0 +1,69 @@
+/*
+ * 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/data-type.h>
+
+G_BEGIN_DECLS
+
+#define GARROW_TYPE_BINARY_DATA_TYPE \
+ (garrow_binary_data_type_get_type())
+#define GARROW_BINARY_DATA_TYPE(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj), \
+ GARROW_TYPE_BINARY_DATA_TYPE, \
+ GArrowBinaryDataType))
+#define GARROW_BINARY_DATA_TYPE_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST((klass), \
+ GARROW_TYPE_BINARY_DATA_TYPE, \
+ GArrowBinaryDataTypeClass))
+#define GARROW_IS_BINARY_DATA_TYPE(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj), \
+ GARROW_TYPE_BINARY_DATA_TYPE))
+#define GARROW_IS_BINARY_DATA_TYPE_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE((klass), \
+ GARROW_TYPE_BINARY_DATA_TYPE))
+#define GARROW_BINARY_DATA_TYPE_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS((obj), \
+ GARROW_TYPE_BINARY_DATA_TYPE, \
+ GArrowBinaryDataTypeClass))
+
+typedef struct _GArrowBinaryDataType GArrowBinaryDataType;
+typedef struct _GArrowBinaryDataTypeClass GArrowBinaryDataTypeClass;
+
+/**
+ * GArrowBinaryDataType:
+ *
+ * It wraps `arrow::BinaryType`.
+ */
+struct _GArrowBinaryDataType
+{
+ /*< private >*/
+ GArrowDataType parent_instance;
+};
+
+struct _GArrowBinaryDataTypeClass
+{
+ GArrowDataTypeClass parent_class;
+};
+
+GType garrow_binary_data_type_get_type (void) G_GNUC_CONST;
+GArrowBinaryDataType *garrow_binary_data_type_new (void);
+
+G_END_DECLS
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/boolean-array-builder.cpp
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/boolean-array-builder.cpp b/c_glib/arrow-glib/boolean-array-builder.cpp
new file mode 100644
index 0000000..1a4c1f9
--- /dev/null
+++ b/c_glib/arrow-glib/boolean-array-builder.cpp
@@ -0,0 +1,120 @@
+/*
+ * 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-builder.hpp>
+#include <arrow-glib/boolean-array-builder.h>
+#include <arrow-glib/error.hpp>
+
+G_BEGIN_DECLS
+
+/**
+ * SECTION: boolean-array-builder
+ * @short_description: Boolean array builder class
+ *
+ * #GArrowBooleanArrayBuilder is the class to create a new
+ * #GArrowBooleanArray.
+ */
+
+G_DEFINE_TYPE(GArrowBooleanArrayBuilder,
+ garrow_boolean_array_builder,
+ GARROW_TYPE_ARRAY_BUILDER)
+
+static void
+garrow_boolean_array_builder_init(GArrowBooleanArrayBuilder *builder)
+{
+}
+
+static void
+garrow_boolean_array_builder_class_init(GArrowBooleanArrayBuilderClass *klass)
+{
+}
+
+/**
+ * garrow_boolean_array_builder_new:
+ *
+ * Returns: A newly created #GArrowBooleanArrayBuilder.
+ */
+GArrowBooleanArrayBuilder *
+garrow_boolean_array_builder_new(void)
+{
+ auto memory_pool = arrow::default_memory_pool();
+ auto arrow_builder =
+ std::make_shared<arrow::BooleanBuilder>(memory_pool);
+ auto builder =
+ GARROW_BOOLEAN_ARRAY_BUILDER(g_object_new(GARROW_TYPE_BOOLEAN_ARRAY_BUILDER,
+ "array-builder", &arrow_builder,
+ NULL));
+ return builder;
+}
+
+/**
+ * garrow_boolean_array_builder_append:
+ * @builder: A #GArrowBooleanArrayBuilder.
+ * @value: A boolean value.
+ * @error: (nullable): Return location for a #GError or %NULL.
+ *
+ * Returns: %TRUE on success, %FALSE if there was an error.
+ */
+gboolean
+garrow_boolean_array_builder_append(GArrowBooleanArrayBuilder *builder,
+ gboolean value,
+ GError **error)
+{
+ auto arrow_builder =
+ static_cast<arrow::BooleanBuilder *>(
+ garrow_array_builder_get_raw(GARROW_ARRAY_BUILDER(builder)).get());
+
+ auto status = arrow_builder->Append(value);
+ if (status.ok()) {
+ return TRUE;
+ } else {
+ garrow_error_set(error, status, "[boolean-array-builder][append]");
+ return FALSE;
+ }
+}
+
+/**
+ * garrow_boolean_array_builder_append_null:
+ * @builder: A #GArrowBooleanArrayBuilder.
+ * @error: (nullable): Return location for a #GError or %NULL.
+ *
+ * Returns: %TRUE on success, %FALSE if there was an error.
+ */
+gboolean
+garrow_boolean_array_builder_append_null(GArrowBooleanArrayBuilder *builder,
+ GError **error)
+{
+ auto arrow_builder =
+ static_cast<arrow::BooleanBuilder *>(
+ garrow_array_builder_get_raw(GARROW_ARRAY_BUILDER(builder)).get());
+
+ auto status = arrow_builder->AppendNull();
+ if (status.ok()) {
+ return TRUE;
+ } else {
+ garrow_error_set(error, status, "[boolean-array-builder][append-null]");
+ return FALSE;
+ }
+}
+
+G_END_DECLS
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/boolean-array-builder.h
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/boolean-array-builder.h b/c_glib/arrow-glib/boolean-array-builder.h
new file mode 100644
index 0000000..ca50e97
--- /dev/null
+++ b/c_glib/arrow-glib/boolean-array-builder.h
@@ -0,0 +1,76 @@
+/*
+ * 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-builder.h>
+
+G_BEGIN_DECLS
+
+#define GARROW_TYPE_BOOLEAN_ARRAY_BUILDER \
+ (garrow_boolean_array_builder_get_type())
+#define GARROW_BOOLEAN_ARRAY_BUILDER(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj), \
+ GARROW_TYPE_BOOLEAN_ARRAY_BUILDER, \
+ GArrowBooleanArrayBuilder))
+#define GARROW_BOOLEAN_ARRAY_BUILDER_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST((klass), \
+ GARROW_TYPE_BOOLEAN_ARRAY_BUILDER, \
+ GArrowBooleanArrayBuilderClass))
+#define GARROW_IS_BOOLEAN_ARRAY_BUILDER(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj), \
+ GARROW_TYPE_BOOLEAN_ARRAY_BUILDER))
+#define GARROW_IS_BOOLEAN_ARRAY_BUILDER_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE((klass), \
+ GARROW_TYPE_BOOLEAN_ARRAY_BUILDER))
+#define GARROW_BOOLEAN_ARRAY_BUILDER_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS((obj), \
+ GARROW_TYPE_BOOLEAN_ARRAY_BUILDER, \
+ GArrowBooleanArrayBuilderClass))
+
+typedef struct _GArrowBooleanArrayBuilder GArrowBooleanArrayBuilder;
+typedef struct _GArrowBooleanArrayBuilderClass GArrowBooleanArrayBuilderClass;
+
+/**
+ * GArrowBooleanArrayBuilder:
+ *
+ * It wraps `arrow::BooleanBuilder`.
+ */
+struct _GArrowBooleanArrayBuilder
+{
+ /*< private >*/
+ GArrowArrayBuilder parent_instance;
+};
+
+struct _GArrowBooleanArrayBuilderClass
+{
+ GArrowArrayBuilderClass parent_class;
+};
+
+GType garrow_boolean_array_builder_get_type(void) G_GNUC_CONST;
+
+GArrowBooleanArrayBuilder *garrow_boolean_array_builder_new(void);
+
+gboolean garrow_boolean_array_builder_append(GArrowBooleanArrayBuilder *builder,
+ gboolean value,
+ GError **error);
+gboolean garrow_boolean_array_builder_append_null(GArrowBooleanArrayBuilder *builder,
+ GError **error);
+
+G_END_DECLS
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/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
new file mode 100644
index 0000000..62fc40f
--- /dev/null
+++ b/c_glib/arrow-glib/boolean-array.cpp
@@ -0,0 +1,69 @@
+/*
+ * 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/39c7274f/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
new file mode 100644
index 0000000..9899fdf
--- /dev/null
+++ b/c_glib/arrow-glib/boolean-array.h
@@ -0,0 +1,70 @@
+/*
+ * 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/39c7274f/c_glib/arrow-glib/boolean-data-type.cpp
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/boolean-data-type.cpp b/c_glib/arrow-glib/boolean-data-type.cpp
new file mode 100644
index 0000000..99c73d9
--- /dev/null
+++ b/c_glib/arrow-glib/boolean-data-type.cpp
@@ -0,0 +1,67 @@
+/*
+ * 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/data-type.hpp>
+#include <arrow-glib/boolean-data-type.h>
+
+G_BEGIN_DECLS
+
+/**
+ * SECTION: boolean-data-type
+ * @short_description: Boolean data type
+ *
+ * #GArrowBooleanDataType is a class for boolean data type.
+ */
+
+G_DEFINE_TYPE(GArrowBooleanDataType, \
+ garrow_boolean_data_type, \
+ GARROW_TYPE_DATA_TYPE)
+
+static void
+garrow_boolean_data_type_init(GArrowBooleanDataType *object)
+{
+}
+
+static void
+garrow_boolean_data_type_class_init(GArrowBooleanDataTypeClass *klass)
+{
+}
+
+/**
+ * garrow_boolean_data_type_new:
+ *
+ * Returns: The newly created boolean data type.
+ */
+GArrowBooleanDataType *
+garrow_boolean_data_type_new(void)
+{
+ auto arrow_data_type = arrow::boolean();
+
+ GArrowBooleanDataType *data_type =
+ GARROW_BOOLEAN_DATA_TYPE(g_object_new(GARROW_TYPE_BOOLEAN_DATA_TYPE,
+ "data-type", &arrow_data_type,
+ NULL));
+ return data_type;
+}
+
+G_END_DECLS
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/boolean-data-type.h
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/boolean-data-type.h b/c_glib/arrow-glib/boolean-data-type.h
new file mode 100644
index 0000000..ad30c99
--- /dev/null
+++ b/c_glib/arrow-glib/boolean-data-type.h
@@ -0,0 +1,69 @@
+/*
+ * 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/data-type.h>
+
+G_BEGIN_DECLS
+
+#define GARROW_TYPE_BOOLEAN_DATA_TYPE \
+ (garrow_boolean_data_type_get_type())
+#define GARROW_BOOLEAN_DATA_TYPE(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj), \
+ GARROW_TYPE_BOOLEAN_DATA_TYPE, \
+ GArrowBooleanDataType))
+#define GARROW_BOOLEAN_DATA_TYPE_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST((klass), \
+ GARROW_TYPE_BOOLEAN_DATA_TYPE, \
+ GArrowBooleanDataTypeClass))
+#define GARROW_IS_BOOLEAN_DATA_TYPE(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj), \
+ GARROW_TYPE_BOOLEAN_DATA_TYPE))
+#define GARROW_IS_BOOLEAN_DATA_TYPE_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE((klass), \
+ GARROW_TYPE_BOOLEAN_DATA_TYPE))
+#define GARROW_BOOLEAN_DATA_TYPE_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS((obj), \
+ GARROW_TYPE_BOOLEAN_DATA_TYPE, \
+ GArrowBooleanDataTypeClass))
+
+typedef struct _GArrowBooleanDataType GArrowBooleanDataType;
+typedef struct _GArrowBooleanDataTypeClass GArrowBooleanDataTypeClass;
+
+/**
+ * GArrowBooleanDataType:
+ *
+ * It wraps `arrow::BooleanType`.
+ */
+struct _GArrowBooleanDataType
+{
+ /*< private >*/
+ GArrowDataType parent_instance;
+};
+
+struct _GArrowBooleanDataTypeClass
+{
+ GArrowDataTypeClass parent_class;
+};
+
+GType garrow_boolean_data_type_get_type (void) G_GNUC_CONST;
+GArrowBooleanDataType *garrow_boolean_data_type_new (void);
+
+G_END_DECLS
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/chunked-array.cpp
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/chunked-array.cpp b/c_glib/arrow-glib/chunked-array.cpp
new file mode 100644
index 0000000..e732ece
--- /dev/null
+++ b/c_glib/arrow-glib/chunked-array.cpp
@@ -0,0 +1,241 @@
+/*
+ * 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/chunked-array.hpp>
+
+G_BEGIN_DECLS
+
+/**
+ * SECTION: chunked-array
+ * @short_description: Chunked array class
+ *
+ * #GArrowChunkedArray is a class for chunked array. Chunked array
+ * makes a list of #GArrowArrays one logical large array.
+ */
+
+typedef struct GArrowChunkedArrayPrivate_ {
+ std::shared_ptr<arrow::ChunkedArray> chunked_array;
+} GArrowChunkedArrayPrivate;
+
+enum {
+ PROP_0,
+ PROP_CHUNKED_ARRAY
+};
+
+G_DEFINE_TYPE_WITH_PRIVATE(GArrowChunkedArray,
+ garrow_chunked_array,
+ G_TYPE_OBJECT)
+
+#define GARROW_CHUNKED_ARRAY_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE((obj), \
+ GARROW_TYPE_CHUNKED_ARRAY, \
+ GArrowChunkedArrayPrivate))
+
+static void
+garrow_chunked_array_finalize(GObject *object)
+{
+ GArrowChunkedArrayPrivate *priv;
+
+ priv = GARROW_CHUNKED_ARRAY_GET_PRIVATE(object);
+
+ priv->chunked_array = nullptr;
+
+ G_OBJECT_CLASS(garrow_chunked_array_parent_class)->finalize(object);
+}
+
+static void
+garrow_chunked_array_set_property(GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ GArrowChunkedArrayPrivate *priv;
+
+ priv = GARROW_CHUNKED_ARRAY_GET_PRIVATE(object);
+
+ switch (prop_id) {
+ case PROP_CHUNKED_ARRAY:
+ priv->chunked_array =
+ *static_cast<std::shared_ptr<arrow::ChunkedArray> *>(g_value_get_pointer(value));
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+ break;
+ }
+}
+
+static void
+garrow_chunked_array_get_property(GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ switch (prop_id) {
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+ break;
+ }
+}
+
+static void
+garrow_chunked_array_init(GArrowChunkedArray *object)
+{
+}
+
+static void
+garrow_chunked_array_class_init(GArrowChunkedArrayClass *klass)
+{
+ GObjectClass *gobject_class;
+ GParamSpec *spec;
+
+ gobject_class = G_OBJECT_CLASS(klass);
+
+ gobject_class->finalize = garrow_chunked_array_finalize;
+ gobject_class->set_property = garrow_chunked_array_set_property;
+ gobject_class->get_property = garrow_chunked_array_get_property;
+
+ spec = g_param_spec_pointer("chunked-array",
+ "Chunked array",
+ "The raw std::shared<arrow::ChunkedArray> *",
+ static_cast<GParamFlags>(G_PARAM_WRITABLE |
+ G_PARAM_CONSTRUCT_ONLY));
+ g_object_class_install_property(gobject_class, PROP_CHUNKED_ARRAY, spec);
+}
+
+/**
+ * garrow_chunked_array_new:
+ * @chunks: (element-type GArrowArray): The array chunks.
+ *
+ * Returns: A newly created #GArrowChunkedArray.
+ */
+GArrowChunkedArray *
+garrow_chunked_array_new(GList *chunks)
+{
+ std::vector<std::shared_ptr<arrow::Array>> arrow_chunks;
+ for (GList *node = chunks; node; node = node->next) {
+ GArrowArray *chunk = GARROW_ARRAY(node->data);
+ arrow_chunks.push_back(garrow_array_get_raw(chunk));
+ }
+
+ auto arrow_chunked_array =
+ std::make_shared<arrow::ChunkedArray>(arrow_chunks);
+ return garrow_chunked_array_new_raw(&arrow_chunked_array);
+}
+
+/**
+ * garrow_chunked_array_get_length:
+ * @chunked_array: A #GArrowChunkedArray.
+ *
+ * Returns: The total number of rows in the chunked array.
+ */
+guint64
+garrow_chunked_array_get_length(GArrowChunkedArray *chunked_array)
+{
+ const auto arrow_chunked_array = garrow_chunked_array_get_raw(chunked_array);
+ return arrow_chunked_array->length();
+}
+
+/**
+ * garrow_chunked_array_get_n_nulls:
+ * @chunked_array: A #GArrowChunkedArray.
+ *
+ * Returns: The total number of NULL in the chunked array.
+ */
+guint64
+garrow_chunked_array_get_n_nulls(GArrowChunkedArray *chunked_array)
+{
+ const auto arrow_chunked_array = garrow_chunked_array_get_raw(chunked_array);
+ return arrow_chunked_array->null_count();
+}
+
+/**
+ * garrow_chunked_array_get_n_chunks:
+ * @chunked_array: A #GArrowChunkedArray.
+ *
+ * Returns: The total number of chunks in the chunked array.
+ */
+guint
+garrow_chunked_array_get_n_chunks(GArrowChunkedArray *chunked_array)
+{
+ const auto arrow_chunked_array = garrow_chunked_array_get_raw(chunked_array);
+ return arrow_chunked_array->num_chunks();
+}
+
+/**
+ * garrow_chunked_array_get_chunk:
+ * @chunked_array: A #GArrowChunkedArray.
+ * @i: The index of the target chunk.
+ *
+ * Returns: (transfer full): The i-th chunk of the chunked array.
+ */
+GArrowArray *
+garrow_chunked_array_get_chunk(GArrowChunkedArray *chunked_array,
+ guint i)
+{
+ const auto arrow_chunked_array = garrow_chunked_array_get_raw(chunked_array);
+ auto arrow_chunk = arrow_chunked_array->chunk(i);
+ return garrow_array_new_raw(&arrow_chunk);
+}
+
+/**
+ * garrow_chunked_array_get_chunks:
+ * @chunked_array: A #GArrowChunkedArray.
+ *
+ * Returns: (element-type GArrowArray) (transfer full):
+ * The chunks in the chunked array.
+ */
+GList *
+garrow_chunked_array_get_chunks(GArrowChunkedArray *chunked_array)
+{
+ const auto arrow_chunked_array = garrow_chunked_array_get_raw(chunked_array);
+
+ GList *chunks = NULL;
+ for (auto arrow_chunk : arrow_chunked_array->chunks()) {
+ GArrowArray *chunk = garrow_array_new_raw(&arrow_chunk);
+ chunks = g_list_prepend(chunks, chunk);
+ }
+
+ return g_list_reverse(chunks);
+}
+
+G_END_DECLS
+
+GArrowChunkedArray *
+garrow_chunked_array_new_raw(std::shared_ptr<arrow::ChunkedArray> *arrow_chunked_array)
+{
+ auto chunked_array =
+ GARROW_CHUNKED_ARRAY(g_object_new(GARROW_TYPE_CHUNKED_ARRAY,
+ "chunked-array", arrow_chunked_array,
+ NULL));
+ return chunked_array;
+}
+
+std::shared_ptr<arrow::ChunkedArray>
+garrow_chunked_array_get_raw(GArrowChunkedArray *chunked_array)
+{
+ GArrowChunkedArrayPrivate *priv;
+
+ priv = GARROW_CHUNKED_ARRAY_GET_PRIVATE(chunked_array);
+ return priv->chunked_array;
+}
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/chunked-array.h
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/chunked-array.h b/c_glib/arrow-glib/chunked-array.h
new file mode 100644
index 0000000..338930b
--- /dev/null
+++ b/c_glib/arrow-glib/chunked-array.h
@@ -0,0 +1,78 @@
+/*
+ * 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_CHUNKED_ARRAY \
+ (garrow_chunked_array_get_type())
+#define GARROW_CHUNKED_ARRAY(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj), \
+ GARROW_TYPE_CHUNKED_ARRAY, \
+ GArrowChunkedArray))
+#define GARROW_CHUNKED_ARRAY_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST((klass), \
+ GARROW_TYPE_CHUNKED_ARRAY, \
+ GArrowChunkedArrayClass))
+#define GARROW_IS_CHUNKED_ARRAY(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj), \
+ GARROW_TYPE_CHUNKED_ARRAY))
+#define GARROW_IS_CHUNKED_ARRAY_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE((klass), \
+ GARROW_TYPE_CHUNKED_ARRAY))
+#define GARROW_CHUNKED_ARRAY_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS((obj), \
+ GARROW_TYPE_CHUNKED_ARRAY, \
+ GArrowChunkedArrayClass))
+
+typedef struct _GArrowChunkedArray GArrowChunkedArray;
+typedef struct _GArrowChunkedArrayClass GArrowChunkedArrayClass;
+
+/**
+ * GArrowChunkedArray:
+ *
+ * It wraps `arrow::ChunkedArray`.
+ */
+struct _GArrowChunkedArray
+{
+ /*< private >*/
+ GObject parent_instance;
+};
+
+struct _GArrowChunkedArrayClass
+{
+ GObjectClass parent_class;
+};
+
+GType garrow_chunked_array_get_type(void) G_GNUC_CONST;
+
+GArrowChunkedArray *garrow_chunked_array_new(GList *chunks);
+
+guint64 garrow_chunked_array_get_length (GArrowChunkedArray *chunked_array);
+guint64 garrow_chunked_array_get_n_nulls(GArrowChunkedArray *chunked_array);
+guint garrow_chunked_array_get_n_chunks (GArrowChunkedArray *chunked_array);
+
+GArrowArray *garrow_chunked_array_get_chunk(GArrowChunkedArray *chunked_array,
+ guint i);
+GList *garrow_chunked_array_get_chunks(GArrowChunkedArray *chunked_array);
+
+G_END_DECLS
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/chunked-array.hpp
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/chunked-array.hpp b/c_glib/arrow-glib/chunked-array.hpp
new file mode 100644
index 0000000..ec5068a
--- /dev/null
+++ b/c_glib/arrow-glib/chunked-array.hpp
@@ -0,0 +1,27 @@
+/*
+ * 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/api.h>
+
+#include <arrow-glib/chunked-array.h>
+
+GArrowChunkedArray *garrow_chunked_array_new_raw(std::shared_ptr<arrow::ChunkedArray> *arrow_chunked_array);
+std::shared_ptr<arrow::ChunkedArray> garrow_chunked_array_get_raw(GArrowChunkedArray *chunked_array);
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/column.cpp
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/column.cpp b/c_glib/arrow-glib/column.cpp
new file mode 100644
index 0000000..94df640
--- /dev/null
+++ b/c_glib/arrow-glib/column.cpp
@@ -0,0 +1,262 @@
+/*
+ * 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/chunked-array.hpp>
+#include <arrow-glib/column.hpp>
+#include <arrow-glib/data-type.hpp>
+#include <arrow-glib/field.hpp>
+
+G_BEGIN_DECLS
+
+/**
+ * SECTION: column
+ * @short_description: Column class
+ *
+ * #GArrowColumn is a class for column. Column has a #GArrowField and
+ * zero or more values. Values are #GArrowChunkedArray.
+ */
+
+typedef struct GArrowColumnPrivate_ {
+ std::shared_ptr<arrow::Column> column;
+} GArrowColumnPrivate;
+
+enum {
+ PROP_0,
+ PROP_COLUMN
+};
+
+G_DEFINE_TYPE_WITH_PRIVATE(GArrowColumn,
+ garrow_column,
+ G_TYPE_OBJECT)
+
+#define GARROW_COLUMN_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE((obj), \
+ GARROW_TYPE_COLUMN, \
+ GArrowColumnPrivate))
+
+static void
+garrow_column_dispose(GObject *object)
+{
+ GArrowColumnPrivate *priv;
+
+ priv = GARROW_COLUMN_GET_PRIVATE(object);
+
+ priv->column = nullptr;
+
+ G_OBJECT_CLASS(garrow_column_parent_class)->dispose(object);
+}
+
+static void
+garrow_column_set_property(GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ GArrowColumnPrivate *priv;
+
+ priv = GARROW_COLUMN_GET_PRIVATE(object);
+
+ switch (prop_id) {
+ case PROP_COLUMN:
+ priv->column =
+ *static_cast<std::shared_ptr<arrow::Column> *>(g_value_get_pointer(value));
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+ break;
+ }
+}
+
+static void
+garrow_column_get_property(GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ switch (prop_id) {
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+ break;
+ }
+}
+
+static void
+garrow_column_init(GArrowColumn *object)
+{
+}
+
+static void
+garrow_column_class_init(GArrowColumnClass *klass)
+{
+ GObjectClass *gobject_class;
+ GParamSpec *spec;
+
+ gobject_class = G_OBJECT_CLASS(klass);
+
+ gobject_class->dispose = garrow_column_dispose;
+ gobject_class->set_property = garrow_column_set_property;
+ gobject_class->get_property = garrow_column_get_property;
+
+ spec = g_param_spec_pointer("column",
+ "Column",
+ "The raw std::shared<arrow::Column> *",
+ static_cast<GParamFlags>(G_PARAM_WRITABLE |
+ G_PARAM_CONSTRUCT_ONLY));
+ g_object_class_install_property(gobject_class, PROP_COLUMN, spec);
+}
+
+/**
+ * garrow_column_new_array:
+ * @field: The metadata of the column.
+ * @array: The data of the column.
+ *
+ * Returns: A newly created #GArrowColumn.
+ */
+GArrowColumn *
+garrow_column_new_array(GArrowField *field,
+ GArrowArray *array)
+{
+ auto arrow_column =
+ std::make_shared<arrow::Column>(garrow_field_get_raw(field),
+ garrow_array_get_raw(array));
+ return garrow_column_new_raw(&arrow_column);
+}
+
+/**
+ * garrow_column_new_chunked_array:
+ * @field: The metadata of the column.
+ * @chunked_array: The data of the column.
+ *
+ * Returns: A newly created #GArrowColumn.
+ */
+GArrowColumn *
+garrow_column_new_chunked_array(GArrowField *field,
+ GArrowChunkedArray *chunked_array)
+{
+ auto arrow_column =
+ std::make_shared<arrow::Column>(garrow_field_get_raw(field),
+ garrow_chunked_array_get_raw(chunked_array));
+ return garrow_column_new_raw(&arrow_column);
+}
+
+/**
+ * garrow_column_get_length:
+ * @column: A #GArrowColumn.
+ *
+ * Returns: The number of data of the column.
+ */
+guint64
+garrow_column_get_length(GArrowColumn *column)
+{
+ const auto arrow_column = garrow_column_get_raw(column);
+ return arrow_column->length();
+}
+
+/**
+ * garrow_column_get_n_nulls:
+ * @column: A #GArrowColumn.
+ *
+ * Returns: The number of nulls of the column.
+ */
+guint64
+garrow_column_get_n_nulls(GArrowColumn *column)
+{
+ const auto arrow_column = garrow_column_get_raw(column);
+ return arrow_column->null_count();
+}
+
+/**
+ * garrow_column_get_field:
+ * @column: A #GArrowColumn.
+ *
+ * Returns: (transfer full): The metadata of the column.
+ */
+GArrowField *
+garrow_column_get_field(GArrowColumn *column)
+{
+ const auto arrow_column = garrow_column_get_raw(column);
+ auto arrow_field = arrow_column->field();
+ return garrow_field_new_raw(&arrow_field);
+}
+
+/**
+ * garrow_column_get_name:
+ * @column: A #GArrowColumn.
+ *
+ * Returns: The name of the column.
+ */
+const gchar *
+garrow_column_get_name(GArrowColumn *column)
+{
+ const auto arrow_column = garrow_column_get_raw(column);
+ return arrow_column->name().c_str();
+}
+
+/**
+ * garrow_column_get_data_type:
+ * @column: A #GArrowColumn.
+ *
+ * Returns: (transfer full): The data type of the column.
+ */
+GArrowDataType *
+garrow_column_get_data_type(GArrowColumn *column)
+{
+ const auto arrow_column = garrow_column_get_raw(column);
+ auto arrow_data_type = arrow_column->type();
+ return garrow_data_type_new_raw(&arrow_data_type);
+}
+
+/**
+ * garrow_column_get_data:
+ * @column: A #GArrowColumn.
+ *
+ * Returns: (transfer full): The data of the column.
+ */
+GArrowChunkedArray *
+garrow_column_get_data(GArrowColumn *column)
+{
+ const auto arrow_column = garrow_column_get_raw(column);
+ auto arrow_chunked_array = arrow_column->data();
+ return garrow_chunked_array_new_raw(&arrow_chunked_array);
+}
+
+G_END_DECLS
+
+GArrowColumn *
+garrow_column_new_raw(std::shared_ptr<arrow::Column> *arrow_column)
+{
+ auto column = GARROW_COLUMN(g_object_new(GARROW_TYPE_COLUMN,
+ "column", arrow_column,
+ NULL));
+ return column;
+}
+
+std::shared_ptr<arrow::Column>
+garrow_column_get_raw(GArrowColumn *column)
+{
+ GArrowColumnPrivate *priv;
+
+ priv = GARROW_COLUMN_GET_PRIVATE(column);
+ return priv->column;
+}
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/column.h
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/column.h b/c_glib/arrow-glib/column.h
new file mode 100644
index 0000000..fba3c26
--- /dev/null
+++ b/c_glib/arrow-glib/column.h
@@ -0,0 +1,82 @@
+/*
+ * 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>
+#include <arrow-glib/chunked-array.h>
+#include <arrow-glib/field.h>
+
+G_BEGIN_DECLS
+
+#define GARROW_TYPE_COLUMN \
+ (garrow_column_get_type())
+#define GARROW_COLUMN(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj), \
+ GARROW_TYPE_COLUMN, \
+ GArrowColumn))
+#define GARROW_COLUMN_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST((klass), \
+ GARROW_TYPE_COLUMN, \
+ GArrowColumnClass))
+#define GARROW_IS_COLUMN(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj), \
+ GARROW_TYPE_COLUMN))
+#define GARROW_IS_COLUMN_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE((klass), \
+ GARROW_TYPE_COLUMN))
+#define GARROW_COLUMN_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS((obj), \
+ GARROW_TYPE_COLUMN, \
+ GArrowColumnClass))
+
+typedef struct _GArrowColumn GArrowColumn;
+typedef struct _GArrowColumnClass GArrowColumnClass;
+
+/**
+ * GArrowColumn:
+ *
+ * It wraps `arrow::Column`.
+ */
+struct _GArrowColumn
+{
+ /*< private >*/
+ GObject parent_instance;
+};
+
+struct _GArrowColumnClass
+{
+ GObjectClass parent_class;
+};
+
+GType garrow_column_get_type (void) G_GNUC_CONST;
+
+GArrowColumn *garrow_column_new_array(GArrowField *field,
+ GArrowArray *array);
+GArrowColumn *garrow_column_new_chunked_array(GArrowField *field,
+ GArrowChunkedArray *chunked_array);
+
+guint64 garrow_column_get_length (GArrowColumn *column);
+guint64 garrow_column_get_n_nulls (GArrowColumn *column);
+GArrowField *garrow_column_get_field (GArrowColumn *column);
+const gchar *garrow_column_get_name (GArrowColumn *column);
+GArrowDataType *garrow_column_get_data_type (GArrowColumn *column);
+GArrowChunkedArray *garrow_column_get_data (GArrowColumn *column);
+
+G_END_DECLS
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/column.hpp
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/column.hpp b/c_glib/arrow-glib/column.hpp
new file mode 100644
index 0000000..4ebb742
--- /dev/null
+++ b/c_glib/arrow-glib/column.hpp
@@ -0,0 +1,27 @@
+/*
+ * 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/api.h>
+
+#include <arrow-glib/column.h>
+
+GArrowColumn *garrow_column_new_raw(std::shared_ptr<arrow::Column> *arrow_column);
+std::shared_ptr<arrow::Column> garrow_column_get_raw(GArrowColumn *column);
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/data-type.cpp
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/data-type.cpp b/c_glib/arrow-glib/data-type.cpp
new file mode 100644
index 0000000..2df9e7a
--- /dev/null
+++ b/c_glib/arrow-glib/data-type.cpp
@@ -0,0 +1,260 @@
+/*
+ * 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/boolean-data-type.h>
+#include <arrow-glib/binary-data-type.h>
+#include <arrow-glib/boolean-data-type.h>
+#include <arrow-glib/data-type.hpp>
+#include <arrow-glib/double-data-type.h>
+#include <arrow-glib/float-data-type.h>
+#include <arrow-glib/int8-data-type.h>
+#include <arrow-glib/int16-data-type.h>
+#include <arrow-glib/int32-data-type.h>
+#include <arrow-glib/int64-data-type.h>
+#include <arrow-glib/list-data-type.h>
+#include <arrow-glib/null-data-type.h>
+#include <arrow-glib/string-data-type.h>
+#include <arrow-glib/struct-data-type.h>
+#include <arrow-glib/type.hpp>
+#include <arrow-glib/uint8-data-type.h>
+#include <arrow-glib/uint16-data-type.h>
+#include <arrow-glib/uint32-data-type.h>
+#include <arrow-glib/uint64-data-type.h>
+
+G_BEGIN_DECLS
+
+/**
+ * SECTION: data-type
+ * @short_description: Base class for all data type classes
+ *
+ * #GArrowDataType is a base class for all data type classes such as
+ * #GArrowBooleanDataType.
+ */
+
+typedef struct GArrowDataTypePrivate_ {
+ std::shared_ptr<arrow::DataType> data_type;
+} GArrowDataTypePrivate;
+
+enum {
+ PROP_0,
+ PROP_DATA_TYPE
+};
+
+G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE(GArrowDataType,
+ garrow_data_type,
+ G_TYPE_OBJECT)
+
+#define GARROW_DATA_TYPE_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE((obj), \
+ GARROW_TYPE_DATA_TYPE, \
+ GArrowDataTypePrivate))
+
+static void
+garrow_data_type_finalize(GObject *object)
+{
+ GArrowDataTypePrivate *priv;
+
+ priv = GARROW_DATA_TYPE_GET_PRIVATE(object);
+
+ priv->data_type = nullptr;
+
+ G_OBJECT_CLASS(garrow_data_type_parent_class)->finalize(object);
+}
+
+static void
+garrow_data_type_set_property(GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ GArrowDataTypePrivate *priv;
+
+ priv = GARROW_DATA_TYPE_GET_PRIVATE(object);
+
+ switch (prop_id) {
+ case PROP_DATA_TYPE:
+ priv->data_type =
+ *static_cast<std::shared_ptr<arrow::DataType> *>(g_value_get_pointer(value));
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+ break;
+ }
+}
+
+static void
+garrow_data_type_get_property(GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ switch (prop_id) {
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+ break;
+ }
+}
+
+static void
+garrow_data_type_init(GArrowDataType *object)
+{
+}
+
+static void
+garrow_data_type_class_init(GArrowDataTypeClass *klass)
+{
+ GObjectClass *gobject_class;
+ GParamSpec *spec;
+
+ gobject_class = G_OBJECT_CLASS(klass);
+
+ gobject_class->finalize = garrow_data_type_finalize;
+ gobject_class->set_property = garrow_data_type_set_property;
+ gobject_class->get_property = garrow_data_type_get_property;
+
+ spec = g_param_spec_pointer("data-type",
+ "DataType",
+ "The raw std::shared<arrow::DataType> *",
+ static_cast<GParamFlags>(G_PARAM_WRITABLE |
+ G_PARAM_CONSTRUCT_ONLY));
+ g_object_class_install_property(gobject_class, PROP_DATA_TYPE, spec);
+}
+
+/**
+ * garrow_data_type_equal:
+ * @data_type: A #GArrowDataType.
+ * @other_data_type: A #GArrowDataType.
+ *
+ * Returns: Whether they are equal or not.
+ */
+gboolean
+garrow_data_type_equal(GArrowDataType *data_type,
+ GArrowDataType *other_data_type)
+{
+ const auto arrow_data_type = garrow_data_type_get_raw(data_type);
+ const auto arrow_other_data_type = garrow_data_type_get_raw(other_data_type);
+ return arrow_data_type->Equals(arrow_other_data_type);
+}
+
+/**
+ * garrow_data_type_to_string:
+ * @data_type: A #GArrowDataType.
+ *
+ * Returns: The string representation of the data type. The caller
+ * must free it by g_free() when the caller doesn't need it anymore.
+ */
+gchar *
+garrow_data_type_to_string(GArrowDataType *data_type)
+{
+ const auto arrow_data_type = garrow_data_type_get_raw(data_type);
+ return g_strdup(arrow_data_type->ToString().c_str());
+}
+
+/**
+ * garrow_data_type_type:
+ * @data_type: A #GArrowDataType.
+ *
+ * Returns: The type of the data type.
+ */
+GArrowType
+garrow_data_type_type(GArrowDataType *data_type)
+{
+ const auto arrow_data_type = garrow_data_type_get_raw(data_type);
+ return garrow_type_from_raw(arrow_data_type->type);
+}
+
+G_END_DECLS
+
+GArrowDataType *
+garrow_data_type_new_raw(std::shared_ptr<arrow::DataType> *arrow_data_type)
+{
+ GType type;
+ GArrowDataType *data_type;
+
+ switch ((*arrow_data_type)->type) {
+ case arrow::Type::type::NA:
+ type = GARROW_TYPE_NULL_DATA_TYPE;
+ break;
+ case arrow::Type::type::BOOL:
+ type = GARROW_TYPE_BOOLEAN_DATA_TYPE;
+ break;
+ case arrow::Type::type::UINT8:
+ type = GARROW_TYPE_UINT8_DATA_TYPE;
+ break;
+ case arrow::Type::type::INT8:
+ type = GARROW_TYPE_INT8_DATA_TYPE;
+ break;
+ case arrow::Type::type::UINT16:
+ type = GARROW_TYPE_UINT16_DATA_TYPE;
+ break;
+ case arrow::Type::type::INT16:
+ type = GARROW_TYPE_INT16_DATA_TYPE;
+ break;
+ case arrow::Type::type::UINT32:
+ type = GARROW_TYPE_UINT32_DATA_TYPE;
+ break;
+ case arrow::Type::type::INT32:
+ type = GARROW_TYPE_INT32_DATA_TYPE;
+ break;
+ case arrow::Type::type::UINT64:
+ type = GARROW_TYPE_UINT64_DATA_TYPE;
+ break;
+ case arrow::Type::type::INT64:
+ type = GARROW_TYPE_INT64_DATA_TYPE;
+ break;
+ case arrow::Type::type::FLOAT:
+ type = GARROW_TYPE_FLOAT_DATA_TYPE;
+ break;
+ case arrow::Type::type::DOUBLE:
+ type = GARROW_TYPE_DOUBLE_DATA_TYPE;
+ break;
+ case arrow::Type::type::BINARY:
+ type = GARROW_TYPE_BINARY_DATA_TYPE;
+ break;
+ case arrow::Type::type::STRING:
+ type = GARROW_TYPE_STRING_DATA_TYPE;
+ break;
+ case arrow::Type::type::LIST:
+ type = GARROW_TYPE_LIST_DATA_TYPE;
+ break;
+ case arrow::Type::type::STRUCT:
+ type = GARROW_TYPE_STRUCT_DATA_TYPE;
+ break;
+ default:
+ type = GARROW_TYPE_DATA_TYPE;
+ break;
+ }
+ data_type = GARROW_DATA_TYPE(g_object_new(type,
+ "data_type", arrow_data_type,
+ NULL));
+ return data_type;
+}
+
+std::shared_ptr<arrow::DataType>
+garrow_data_type_get_raw(GArrowDataType *data_type)
+{
+ GArrowDataTypePrivate *priv;
+
+ priv = GARROW_DATA_TYPE_GET_PRIVATE(data_type);
+ return priv->data_type;
+}
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/data-type.h
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/data-type.h b/c_glib/arrow-glib/data-type.h
new file mode 100644
index 0000000..3203d09
--- /dev/null
+++ b/c_glib/arrow-glib/data-type.h
@@ -0,0 +1,72 @@
+/*
+ * 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/type.h>
+
+G_BEGIN_DECLS
+
+#define GARROW_TYPE_DATA_TYPE \
+ (garrow_data_type_get_type())
+#define GARROW_DATA_TYPE(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj), \
+ GARROW_TYPE_DATA_TYPE, \
+ GArrowDataType))
+#define GARROW_DATA_TYPE_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST((klass), \
+ GARROW_TYPE_DATA_TYPE, \
+ GArrowDataTypeClass))
+#define GARROW_IS_DATA_TYPE(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj), \
+ GARROW_TYPE_DATA_TYPE))
+#define GARROW_IS_DATA_TYPE_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE((klass), \
+ GARROW_TYPE_DATA_TYPE))
+#define GARROW_DATA_TYPE_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS((obj), \
+ GARROW_TYPE_DATA_TYPE, \
+ GArrowDataTypeClass))
+
+typedef struct _GArrowDataType GArrowDataType;
+typedef struct _GArrowDataTypeClass GArrowDataTypeClass;
+
+/**
+ * GArrowDataType:
+ *
+ * It wraps `arrow::DataType`.
+ */
+struct _GArrowDataType
+{
+ /*< private >*/
+ GObject parent_instance;
+};
+
+struct _GArrowDataTypeClass
+{
+ GObjectClass parent_class;
+};
+
+GType garrow_data_type_get_type (void) G_GNUC_CONST;
+gboolean garrow_data_type_equal (GArrowDataType *data_type,
+ GArrowDataType *other_data_type);
+gchar *garrow_data_type_to_string (GArrowDataType *data_type);
+GArrowType garrow_data_type_type (GArrowDataType *data_type);
+
+G_END_DECLS
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/data-type.hpp
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/data-type.hpp b/c_glib/arrow-glib/data-type.hpp
new file mode 100644
index 0000000..fddcb2e
--- /dev/null
+++ b/c_glib/arrow-glib/data-type.hpp
@@ -0,0 +1,27 @@
+/*
+ * 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/api.h>
+
+#include <arrow-glib/data-type.h>
+
+GArrowDataType *garrow_data_type_new_raw(std::shared_ptr<arrow::DataType> *arrow_data_type);
+std::shared_ptr<arrow::DataType> garrow_data_type_get_raw(GArrowDataType *data_type);
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/double-array-builder.cpp
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/double-array-builder.cpp b/c_glib/arrow-glib/double-array-builder.cpp
new file mode 100644
index 0000000..cc44eea
--- /dev/null
+++ b/c_glib/arrow-glib/double-array-builder.cpp
@@ -0,0 +1,120 @@
+/*
+ * 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-builder.hpp>
+#include <arrow-glib/double-array-builder.h>
+#include <arrow-glib/error.hpp>
+
+G_BEGIN_DECLS
+
+/**
+ * SECTION: double-array-builder
+ * @short_description: 64-bit floating point array builder class
+ *
+ * #GArrowDoubleArrayBuilder is the class to create a new
+ * #GArrowDoubleArray.
+ */
+
+G_DEFINE_TYPE(GArrowDoubleArrayBuilder,
+ garrow_double_array_builder,
+ GARROW_TYPE_ARRAY_BUILDER)
+
+static void
+garrow_double_array_builder_init(GArrowDoubleArrayBuilder *builder)
+{
+}
+
+static void
+garrow_double_array_builder_class_init(GArrowDoubleArrayBuilderClass *klass)
+{
+}
+
+/**
+ * garrow_double_array_builder_new:
+ *
+ * Returns: A newly created #GArrowDoubleArrayBuilder.
+ */
+GArrowDoubleArrayBuilder *
+garrow_double_array_builder_new(void)
+{
+ auto memory_pool = arrow::default_memory_pool();
+ auto arrow_builder =
+ std::make_shared<arrow::DoubleBuilder>(memory_pool, arrow::float64());
+ auto builder =
+ GARROW_DOUBLE_ARRAY_BUILDER(g_object_new(GARROW_TYPE_DOUBLE_ARRAY_BUILDER,
+ "array-builder", &arrow_builder,
+ NULL));
+ return builder;
+}
+
+/**
+ * garrow_double_array_builder_append:
+ * @builder: A #GArrowDoubleArrayBuilder.
+ * @value: A double value.
+ * @error: (nullable): Return location for a #GError or %NULL.
+ *
+ * Returns: %TRUE on success, %FALSE if there was an error.
+ */
+gboolean
+garrow_double_array_builder_append(GArrowDoubleArrayBuilder *builder,
+ gdouble value,
+ GError **error)
+{
+ auto arrow_builder =
+ static_cast<arrow::DoubleBuilder *>(
+ garrow_array_builder_get_raw(GARROW_ARRAY_BUILDER(builder)).get());
+
+ auto status = arrow_builder->Append(value);
+ if (status.ok()) {
+ return TRUE;
+ } else {
+ garrow_error_set(error, status, "[double-array-builder][append]");
+ return FALSE;
+ }
+}
+
+/**
+ * garrow_double_array_builder_append_null:
+ * @builder: A #GArrowDoubleArrayBuilder.
+ * @error: (nullable): Return location for a #GError or %NULL.
+ *
+ * Returns: %TRUE on success, %FALSE if there was an error.
+ */
+gboolean
+garrow_double_array_builder_append_null(GArrowDoubleArrayBuilder *builder,
+ GError **error)
+{
+ auto arrow_builder =
+ static_cast<arrow::DoubleBuilder *>(
+ garrow_array_builder_get_raw(GARROW_ARRAY_BUILDER(builder)).get());
+
+ auto status = arrow_builder->AppendNull();
+ if (status.ok()) {
+ return TRUE;
+ } else {
+ garrow_error_set(error, status, "[double-array-builder][append-null]");
+ return FALSE;
+ }
+}
+
+G_END_DECLS
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/double-array-builder.h
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/double-array-builder.h b/c_glib/arrow-glib/double-array-builder.h
new file mode 100644
index 0000000..5d95c89
--- /dev/null
+++ b/c_glib/arrow-glib/double-array-builder.h
@@ -0,0 +1,76 @@
+/*
+ * 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-builder.h>
+
+G_BEGIN_DECLS
+
+#define GARROW_TYPE_DOUBLE_ARRAY_BUILDER \
+ (garrow_double_array_builder_get_type())
+#define GARROW_DOUBLE_ARRAY_BUILDER(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj), \
+ GARROW_TYPE_DOUBLE_ARRAY_BUILDER, \
+ GArrowDoubleArrayBuilder))
+#define GARROW_DOUBLE_ARRAY_BUILDER_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST((klass), \
+ GARROW_TYPE_DOUBLE_ARRAY_BUILDER, \
+ GArrowDoubleArrayBuilderClass))
+#define GARROW_IS_DOUBLE_ARRAY_BUILDER(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj), \
+ GARROW_TYPE_DOUBLE_ARRAY_BUILDER))
+#define GARROW_IS_DOUBLE_ARRAY_BUILDER_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE((klass), \
+ GARROW_TYPE_DOUBLE_ARRAY_BUILDER))
+#define GARROW_DOUBLE_ARRAY_BUILDER_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS((obj), \
+ GARROW_TYPE_DOUBLE_ARRAY_BUILDER, \
+ GArrowDoubleArrayBuilderClass))
+
+typedef struct _GArrowDoubleArrayBuilder GArrowDoubleArrayBuilder;
+typedef struct _GArrowDoubleArrayBuilderClass GArrowDoubleArrayBuilderClass;
+
+/**
+ * GArrowDoubleArrayBuilder:
+ *
+ * It wraps `arrow::DoubleBuilder`.
+ */
+struct _GArrowDoubleArrayBuilder
+{
+ /*< private >*/
+ GArrowArrayBuilder parent_instance;
+};
+
+struct _GArrowDoubleArrayBuilderClass
+{
+ GArrowArrayBuilderClass parent_class;
+};
+
+GType garrow_double_array_builder_get_type(void) G_GNUC_CONST;
+
+GArrowDoubleArrayBuilder *garrow_double_array_builder_new(void);
+
+gboolean garrow_double_array_builder_append(GArrowDoubleArrayBuilder *builder,
+ gdouble value,
+ GError **error);
+gboolean garrow_double_array_builder_append_null(GArrowDoubleArrayBuilder *builder,
+ GError **error);
+
+G_END_DECLS
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/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
new file mode 100644
index 0000000..ecc55d7
--- /dev/null
+++ b/c_glib/arrow-glib/double-array.cpp
@@ -0,0 +1,69 @@
+/*
+ * 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/39c7274f/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
new file mode 100644
index 0000000..b9a2365
--- /dev/null
+++ b/c_glib/arrow-glib/double-array.h
@@ -0,0 +1,71 @@
+/*
+ * 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/39c7274f/c_glib/arrow-glib/double-data-type.cpp
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/double-data-type.cpp b/c_glib/arrow-glib/double-data-type.cpp
new file mode 100644
index 0000000..c132f97
--- /dev/null
+++ b/c_glib/arrow-glib/double-data-type.cpp
@@ -0,0 +1,68 @@
+/*
+ * 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/data-type.hpp>
+#include <arrow-glib/double-data-type.h>
+
+G_BEGIN_DECLS
+
+/**
+ * SECTION: double-data-type
+ * @short_description: 64-bit floating point data type
+ *
+ * #GArrowDoubleDataType is a class for 64-bit floating point data
+ * type.
+ */
+
+G_DEFINE_TYPE(GArrowDoubleDataType, \
+ garrow_double_data_type, \
+ GARROW_TYPE_DATA_TYPE)
+
+static void
+garrow_double_data_type_init(GArrowDoubleDataType *object)
+{
+}
+
+static void
+garrow_double_data_type_class_init(GArrowDoubleDataTypeClass *klass)
+{
+}
+
+/**
+ * garrow_double_data_type_new:
+ *
+ * Returns: The newly created 64-bit floating point data type.
+ */
+GArrowDoubleDataType *
+garrow_double_data_type_new(void)
+{
+ auto arrow_data_type = arrow::float64();
+
+ GArrowDoubleDataType *data_type =
+ GARROW_DOUBLE_DATA_TYPE(g_object_new(GARROW_TYPE_DOUBLE_DATA_TYPE,
+ "data-type", &arrow_data_type,
+ NULL));
+ return data_type;
+}
+
+G_END_DECLS
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/double-data-type.h
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/double-data-type.h b/c_glib/arrow-glib/double-data-type.h
new file mode 100644
index 0000000..ec725cb
--- /dev/null
+++ b/c_glib/arrow-glib/double-data-type.h
@@ -0,0 +1,70 @@
+/*
+ * 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/data-type.h>
+
+G_BEGIN_DECLS
+
+#define GARROW_TYPE_DOUBLE_DATA_TYPE \
+ (garrow_double_data_type_get_type())
+#define GARROW_DOUBLE_DATA_TYPE(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj), \
+ GARROW_TYPE_DOUBLE_DATA_TYPE, \
+ GArrowDoubleDataType))
+#define GARROW_DOUBLE_DATA_TYPE_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST((klass), \
+ GARROW_TYPE_DOUBLE_DATA_TYPE, \
+ GArrowDoubleDataTypeClass))
+#define GARROW_IS_DOUBLE_DATA_TYPE(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj), \
+ GARROW_TYPE_DOUBLE_DATA_TYPE))
+#define GARROW_IS_DOUBLE_DATA_TYPE_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE((klass), \
+ GARROW_TYPE_DOUBLE_DATA_TYPE))
+#define GARROW_DOUBLE_DATA_TYPE_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS((obj), \
+ GARROW_TYPE_DOUBLE_DATA_TYPE, \
+ GArrowDoubleDataTypeClass))
+
+typedef struct _GArrowDoubleDataType GArrowDoubleDataType;
+typedef struct _GArrowDoubleDataTypeClass GArrowDoubleDataTypeClass;
+
+/**
+ * GArrowDoubleDataType:
+ *
+ * It wraps `arrow::DoubleType`.
+ */
+struct _GArrowDoubleDataType
+{
+ /*< private >*/
+ GArrowDataType parent_instance;
+};
+
+struct _GArrowDoubleDataTypeClass
+{
+ GArrowDataTypeClass parent_class;
+};
+
+GType garrow_double_data_type_get_type(void) G_GNUC_CONST;
+
+GArrowDoubleDataType *garrow_double_data_type_new(void);
+
+G_END_DECLS
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/enums.c.template
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/enums.c.template b/c_glib/arrow-glib/enums.c.template
new file mode 100644
index 0000000..6becbd5
--- /dev/null
+++ b/c_glib/arrow-glib/enums.c.template
@@ -0,0 +1,56 @@
+/*** BEGIN file-header ***/
+/*
+ * 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/arrow-glib.h>
+/*** END file-header ***/
+
+/*** BEGIN file-production ***/
+
+/* enumerations from "@filename@" */
+/*** END file-production ***/
+
+/*** BEGIN value-header ***/
+GType
+@enum_name@_get_type(void)
+{
+ static GType etype = 0;
+ if (G_UNLIKELY(etype == 0)) {
+ static const G@Type@Value values[] = {
+/*** END value-header ***/
+
+/*** BEGIN value-production ***/
+ {@VALUENAME@, "@VALUENAME@", "@valuenick@"},
+/*** END value-production ***/
+
+/*** BEGIN value-tail ***/
+ {0, NULL, NULL}
+ };
+ etype = g_@type@_register_static(g_intern_static_string("@EnumName@"), values);
+ }
+ return etype;
+}
+/*** END value-tail ***/
+
+/*** BEGIN file-tail ***/
+/*** END file-tail ***/
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/enums.h.template
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/enums.h.template b/c_glib/arrow-glib/enums.h.template
new file mode 100644
index 0000000..3509ed2
--- /dev/null
+++ b/c_glib/arrow-glib/enums.h.template
@@ -0,0 +1,41 @@
+/*** BEGIN file-header ***/
+/*
+ * 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/error.h>
+
+G_BEGIN_DECLS
+/*** END file-header ***/
+
+/*** BEGIN file-production ***/
+
+/* enumerations from "@filename@" */
+/*** END file-production ***/
+
+/*** BEGIN value-header ***/
+GType @enum_name@_get_type(void) G_GNUC_CONST;
+#define @ENUMPREFIX@_TYPE_@ENUMSHORT@ (@enum_name@_get_type())
+/*** END value-header ***/
+
+/*** BEGIN file-tail ***/
+
+G_END_DECLS
+/*** END file-tail ***/
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/error.cpp
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/error.cpp b/c_glib/arrow-glib/error.cpp
new file mode 100644
index 0000000..efbc6ae
--- /dev/null
+++ b/c_glib/arrow-glib/error.cpp
@@ -0,0 +1,81 @@
+/*
+ * 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/error.hpp>
+
+G_BEGIN_DECLS
+
+/**
+ * SECTION: error
+ * @title: GArrowError
+ * @short_description: Error code mapping between Arrow and arrow-glib
+ *
+ * #GArrowError provides error codes corresponding to `arrow::Status`
+ * values.
+ */
+
+G_DEFINE_QUARK(garrow-error-quark, garrow_error)
+
+static GArrowError
+garrow_error_code(const arrow::Status &status)
+{
+ switch (status.code()) {
+ case arrow::StatusCode::OK:
+ return GARROW_ERROR_UNKNOWN;
+ case arrow::StatusCode::OutOfMemory:
+ return GARROW_ERROR_OUT_OF_MEMORY;
+ case arrow::StatusCode::KeyError:
+ return GARROW_ERROR_KEY;
+ case arrow::StatusCode::TypeError:
+ return GARROW_ERROR_TYPE;
+ case arrow::StatusCode::Invalid:
+ return GARROW_ERROR_INVALID;
+ case arrow::StatusCode::IOError:
+ return GARROW_ERROR_IO;
+ case arrow::StatusCode::UnknownError:
+ return GARROW_ERROR_UNKNOWN;
+ case arrow::StatusCode::NotImplemented:
+ return GARROW_ERROR_NOT_IMPLEMENTED;
+ default:
+ return GARROW_ERROR_UNKNOWN;
+ }
+}
+
+G_END_DECLS
+
+void
+garrow_error_set(GError **error,
+ const arrow::Status &status,
+ const char *context)
+{
+ if (status.ok()) {
+ return;
+ }
+
+ g_set_error(error,
+ GARROW_ERROR,
+ garrow_error_code(status),
+ "%s: %s",
+ context,
+ status.ToString().c_str());
+}
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/error.h
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/error.h b/c_glib/arrow-glib/error.h
new file mode 100644
index 0000000..b4a4fac
--- /dev/null
+++ b/c_glib/arrow-glib/error.h
@@ -0,0 +1,54 @@
+/*
+ * 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 <glib-object.h>
+
+G_BEGIN_DECLS
+
+/**
+ * GArrowError:
+ * @GARROW_ERROR_OUT_OF_MEMORY: Out of memory error.
+ * @GARROW_ERROR_KEY: Key error.
+ * @GARROW_ERROR_TYPE: Type error.
+ * @GARROW_ERROR_INVALID: Invalid value error.
+ * @GARROW_ERROR_IO: IO error.
+ * @GARROW_ERROR_UNKNOWN: Unknown error.
+ * @GARROW_ERROR_NOT_IMPLEMENTED: The feature is not implemented.
+ *
+ * The error codes are used by all arrow-glib functions.
+ *
+ * They are corresponding to `arrow::Status` values.
+ */
+typedef enum {
+ GARROW_ERROR_OUT_OF_MEMORY = 1,
+ GARROW_ERROR_KEY,
+ GARROW_ERROR_TYPE,
+ GARROW_ERROR_INVALID,
+ GARROW_ERROR_IO,
+ GARROW_ERROR_UNKNOWN = 9,
+ GARROW_ERROR_NOT_IMPLEMENTED = 10
+} GArrowError;
+
+#define GARROW_ERROR garrow_error_quark()
+
+GQuark garrow_error_quark(void);
+
+G_END_DECLS
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/error.hpp
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/error.hpp b/c_glib/arrow-glib/error.hpp
new file mode 100644
index 0000000..357d293
--- /dev/null
+++ b/c_glib/arrow-glib/error.hpp
@@ -0,0 +1,28 @@
+/*
+ * 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/api.h>
+
+#include <arrow-glib/error.h>
+
+void garrow_error_set(GError **error,
+ const arrow::Status &status,
+ const char *context);
[7/9] arrow git commit: ARROW-631: [GLib] Import
Posted by we...@apache.org.
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/field.cpp
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/field.cpp b/c_glib/arrow-glib/field.cpp
new file mode 100644
index 0000000..0dcaf0a
--- /dev/null
+++ b/c_glib/arrow-glib/field.cpp
@@ -0,0 +1,250 @@
+/*
+ * 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/data-type.hpp>
+#include <arrow-glib/field.hpp>
+
+G_BEGIN_DECLS
+
+/**
+ * SECTION: field
+ * @short_description: Field class
+ *
+ * #GArrowField is a class for field. Field is metadata of a
+ * column. It has name, data type (#GArrowDataType) and nullable
+ * information of the column.
+ */
+
+typedef struct GArrowFieldPrivate_ {
+ std::shared_ptr<arrow::Field> field;
+} GArrowFieldPrivate;
+
+enum {
+ PROP_0,
+ PROP_FIELD
+};
+
+G_DEFINE_TYPE_WITH_PRIVATE(GArrowField,
+ garrow_field,
+ G_TYPE_OBJECT)
+
+#define GARROW_FIELD_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE((obj), \
+ GARROW_TYPE_FIELD, \
+ GArrowFieldPrivate))
+
+static void
+garrow_field_finalize(GObject *object)
+{
+ GArrowFieldPrivate *priv;
+
+ priv = GARROW_FIELD_GET_PRIVATE(object);
+
+ priv->field = nullptr;
+
+ G_OBJECT_CLASS(garrow_field_parent_class)->finalize(object);
+}
+
+static void
+garrow_field_set_property(GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ GArrowFieldPrivate *priv;
+
+ priv = GARROW_FIELD_GET_PRIVATE(object);
+
+ switch (prop_id) {
+ case PROP_FIELD:
+ priv->field =
+ *static_cast<std::shared_ptr<arrow::Field> *>(g_value_get_pointer(value));
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+ break;
+ }
+}
+
+static void
+garrow_field_get_property(GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ switch (prop_id) {
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+ break;
+ }
+}
+
+static void
+garrow_field_init(GArrowField *object)
+{
+}
+
+static void
+garrow_field_class_init(GArrowFieldClass *klass)
+{
+ GObjectClass *gobject_class;
+ GParamSpec *spec;
+
+ gobject_class = G_OBJECT_CLASS(klass);
+
+ gobject_class->finalize = garrow_field_finalize;
+ gobject_class->set_property = garrow_field_set_property;
+ gobject_class->get_property = garrow_field_get_property;
+
+ spec = g_param_spec_pointer("field",
+ "Field",
+ "The raw std::shared<arrow::Field> *",
+ static_cast<GParamFlags>(G_PARAM_WRITABLE |
+ G_PARAM_CONSTRUCT_ONLY));
+ g_object_class_install_property(gobject_class, PROP_FIELD, spec);
+}
+
+/**
+ * garrow_field_new:
+ * @name: The name of the field.
+ * @data_type: The data type of the field.
+ *
+ * Returns: A newly created #GArrowField.
+ */
+GArrowField *
+garrow_field_new(const gchar *name,
+ GArrowDataType *data_type)
+{
+ auto arrow_field =
+ std::make_shared<arrow::Field>(name,
+ garrow_data_type_get_raw(data_type));
+ return garrow_field_new_raw(&arrow_field);
+}
+
+/**
+ * garrow_field_new_full:
+ * @name: The name of the field.
+ * @data_type: The data type of the field.
+ * @nullable: Whether null may be included or not.
+ *
+ * Returns: A newly created #GArrowField.
+ */
+GArrowField *
+garrow_field_new_full(const gchar *name,
+ GArrowDataType *data_type,
+ gboolean nullable)
+{
+ auto arrow_field =
+ std::make_shared<arrow::Field>(name,
+ garrow_data_type_get_raw(data_type),
+ nullable);
+ return garrow_field_new_raw(&arrow_field);
+}
+
+/**
+ * garrow_field_get_name:
+ * @field: A #GArrowField.
+ *
+ * Returns: The name of the field.
+ */
+const gchar *
+garrow_field_get_name(GArrowField *field)
+{
+ const auto arrow_field = garrow_field_get_raw(field);
+ return arrow_field->name.c_str();
+}
+
+/**
+ * garrow_field_get_data_type:
+ * @field: A #GArrowField.
+ *
+ * Returns: (transfer full): The data type of the field.
+ */
+GArrowDataType *
+garrow_field_get_data_type(GArrowField *field)
+{
+ const auto arrow_field = garrow_field_get_raw(field);
+ return garrow_data_type_new_raw(&arrow_field->type);
+}
+
+/**
+ * garrow_field_is_nullable:
+ * @field: A #GArrowField.
+ *
+ * Returns: Whether the filed may include null or not.
+ */
+gboolean
+garrow_field_is_nullable(GArrowField *field)
+{
+ const auto arrow_field = garrow_field_get_raw(field);
+ return arrow_field->nullable;
+}
+
+/**
+ * garrow_field_equal:
+ * @field: A #GArrowField.
+ * @other_field: A #GArrowField.
+ *
+ * Returns: Whether they are equal or not.
+ */
+gboolean
+garrow_field_equal(GArrowField *field,
+ GArrowField *other_field)
+{
+ const auto arrow_field = garrow_field_get_raw(field);
+ const auto arrow_other_field = garrow_field_get_raw(other_field);
+ return arrow_field->Equals(arrow_other_field);
+}
+
+/**
+ * garrow_field_to_string:
+ * @field: A #GArrowField.
+ *
+ * Returns: The string representation of the field.
+ */
+gchar *
+garrow_field_to_string(GArrowField *field)
+{
+ const auto arrow_field = garrow_field_get_raw(field);
+ return g_strdup(arrow_field->ToString().c_str());
+}
+
+G_END_DECLS
+
+GArrowField *
+garrow_field_new_raw(std::shared_ptr<arrow::Field> *arrow_field)
+{
+ auto field = GARROW_FIELD(g_object_new(GARROW_TYPE_FIELD,
+ "field", arrow_field,
+ NULL));
+ return field;
+}
+
+std::shared_ptr<arrow::Field>
+garrow_field_get_raw(GArrowField *field)
+{
+ GArrowFieldPrivate *priv;
+
+ priv = GARROW_FIELD_GET_PRIVATE(field);
+ return priv->field;
+}
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/field.h
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/field.h b/c_glib/arrow-glib/field.h
new file mode 100644
index 0000000..e724dce
--- /dev/null
+++ b/c_glib/arrow-glib/field.h
@@ -0,0 +1,83 @@
+/*
+ * 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/data-type.h>
+
+G_BEGIN_DECLS
+
+#define GARROW_TYPE_FIELD \
+ (garrow_field_get_type())
+#define GARROW_FIELD(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj), \
+ GARROW_TYPE_FIELD, \
+ GArrowField))
+#define GARROW_FIELD_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST((klass), \
+ GARROW_TYPE_FIELD, \
+ GArrowFieldClass))
+#define GARROW_IS_FIELD(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj), \
+ GARROW_TYPE_FIELD))
+#define GARROW_IS_FIELD_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE((klass), \
+ GARROW_TYPE_FIELD))
+#define GARROW_FIELD_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS((obj), \
+ GARROW_TYPE_FIELD, \
+ GArrowFieldClass))
+
+typedef struct _GArrowField GArrowField;
+typedef struct _GArrowFieldClass GArrowFieldClass;
+
+/**
+ * GArrowField:
+ *
+ * It wraps `arrow::Field`.
+ */
+struct _GArrowField
+{
+ /*< private >*/
+ GObject parent_instance;
+};
+
+struct _GArrowFieldClass
+{
+ GObjectClass parent_class;
+};
+
+GType garrow_field_get_type (void) G_GNUC_CONST;
+
+GArrowField *garrow_field_new (const gchar *name,
+ GArrowDataType *data_type);
+GArrowField *garrow_field_new_full (const gchar *name,
+ GArrowDataType *data_type,
+ gboolean nullable);
+
+const gchar *garrow_field_get_name (GArrowField *field);
+GArrowDataType *garrow_field_get_data_type (GArrowField *field);
+gboolean garrow_field_is_nullable (GArrowField *field);
+
+gboolean garrow_field_equal (GArrowField *field,
+ GArrowField *other_field);
+
+gchar *garrow_field_to_string (GArrowField *field);
+
+G_END_DECLS
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/field.hpp
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/field.hpp b/c_glib/arrow-glib/field.hpp
new file mode 100644
index 0000000..e130ad5
--- /dev/null
+++ b/c_glib/arrow-glib/field.hpp
@@ -0,0 +1,27 @@
+/*
+ * 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/api.h>
+
+#include <arrow-glib/field.h>
+
+GArrowField *garrow_field_new_raw(std::shared_ptr<arrow::Field> *arrow_field);
+std::shared_ptr<arrow::Field> garrow_field_get_raw(GArrowField *field);
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/float-array-builder.cpp
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/float-array-builder.cpp b/c_glib/arrow-glib/float-array-builder.cpp
new file mode 100644
index 0000000..77a9a0b
--- /dev/null
+++ b/c_glib/arrow-glib/float-array-builder.cpp
@@ -0,0 +1,120 @@
+/*
+ * 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-builder.hpp>
+#include <arrow-glib/error.hpp>
+#include <arrow-glib/float-array-builder.h>
+
+G_BEGIN_DECLS
+
+/**
+ * SECTION: float-array-builder
+ * @short_description: 32-bit floating point array builder class
+ *
+ * #GArrowFloatArrayBuilder is the class to creating a new
+ * #GArrowFloatArray.
+ */
+
+G_DEFINE_TYPE(GArrowFloatArrayBuilder,
+ garrow_float_array_builder,
+ GARROW_TYPE_ARRAY_BUILDER)
+
+static void
+garrow_float_array_builder_init(GArrowFloatArrayBuilder *builder)
+{
+}
+
+static void
+garrow_float_array_builder_class_init(GArrowFloatArrayBuilderClass *klass)
+{
+}
+
+/**
+ * garrow_float_array_builder_new:
+ *
+ * Returns: A newly created #GArrowFloatArrayBuilder.
+ */
+GArrowFloatArrayBuilder *
+garrow_float_array_builder_new(void)
+{
+ auto memory_pool = arrow::default_memory_pool();
+ auto arrow_builder =
+ std::make_shared<arrow::FloatBuilder>(memory_pool, arrow::float32());
+ auto builder =
+ GARROW_FLOAT_ARRAY_BUILDER(g_object_new(GARROW_TYPE_FLOAT_ARRAY_BUILDER,
+ "array-builder", &arrow_builder,
+ NULL));
+ return builder;
+}
+
+/**
+ * garrow_float_array_builder_append:
+ * @builder: A #GArrowFloatArrayBuilder.
+ * @value: A float value.
+ * @error: (nullable): Return location for a #GError or %NULL.
+ *
+ * Returns: %TRUE on success, %FALSE if there was an error.
+ */
+gboolean
+garrow_float_array_builder_append(GArrowFloatArrayBuilder *builder,
+ gfloat value,
+ GError **error)
+{
+ auto arrow_builder =
+ static_cast<arrow::FloatBuilder *>(
+ garrow_array_builder_get_raw(GARROW_ARRAY_BUILDER(builder)).get());
+
+ auto status = arrow_builder->Append(value);
+ if (status.ok()) {
+ return TRUE;
+ } else {
+ garrow_error_set(error, status, "[float-array-builder][append]");
+ return FALSE;
+ }
+}
+
+/**
+ * garrow_float_array_builder_append_null:
+ * @builder: A #GArrowFloatArrayBuilder.
+ * @error: (nullable): Return location for a #GError or %NULL.
+ *
+ * Returns: %TRUE on success, %FALSE if there was an error.
+ */
+gboolean
+garrow_float_array_builder_append_null(GArrowFloatArrayBuilder *builder,
+ GError **error)
+{
+ auto arrow_builder =
+ static_cast<arrow::FloatBuilder *>(
+ garrow_array_builder_get_raw(GARROW_ARRAY_BUILDER(builder)).get());
+
+ auto status = arrow_builder->AppendNull();
+ if (status.ok()) {
+ return TRUE;
+ } else {
+ garrow_error_set(error, status, "[float-array-builder][append-null]");
+ return FALSE;
+ }
+}
+
+G_END_DECLS
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/float-array-builder.h
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/float-array-builder.h b/c_glib/arrow-glib/float-array-builder.h
new file mode 100644
index 0000000..0039003
--- /dev/null
+++ b/c_glib/arrow-glib/float-array-builder.h
@@ -0,0 +1,76 @@
+/*
+ * 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-builder.h>
+
+G_BEGIN_DECLS
+
+#define GARROW_TYPE_FLOAT_ARRAY_BUILDER \
+ (garrow_float_array_builder_get_type())
+#define GARROW_FLOAT_ARRAY_BUILDER(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj), \
+ GARROW_TYPE_FLOAT_ARRAY_BUILDER, \
+ GArrowFloatArrayBuilder))
+#define GARROW_FLOAT_ARRAY_BUILDER_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST((klass), \
+ GARROW_TYPE_FLOAT_ARRAY_BUILDER, \
+ GArrowFloatArrayBuilderClass))
+#define GARROW_IS_FLOAT_ARRAY_BUILDER(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj), \
+ GARROW_TYPE_FLOAT_ARRAY_BUILDER))
+#define GARROW_IS_FLOAT_ARRAY_BUILDER_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE((klass), \
+ GARROW_TYPE_FLOAT_ARRAY_BUILDER))
+#define GARROW_FLOAT_ARRAY_BUILDER_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS((obj), \
+ GARROW_TYPE_FLOAT_ARRAY_BUILDER, \
+ GArrowFloatArrayBuilderClass))
+
+typedef struct _GArrowFloatArrayBuilder GArrowFloatArrayBuilder;
+typedef struct _GArrowFloatArrayBuilderClass GArrowFloatArrayBuilderClass;
+
+/**
+ * GArrowFloatArrayBuilder:
+ *
+ * It wraps `arrow::FloatBuilder`.
+ */
+struct _GArrowFloatArrayBuilder
+{
+ /*< private >*/
+ GArrowArrayBuilder parent_instance;
+};
+
+struct _GArrowFloatArrayBuilderClass
+{
+ GArrowArrayBuilderClass parent_class;
+};
+
+GType garrow_float_array_builder_get_type(void) G_GNUC_CONST;
+
+GArrowFloatArrayBuilder *garrow_float_array_builder_new(void);
+
+gboolean garrow_float_array_builder_append(GArrowFloatArrayBuilder *builder,
+ gfloat value,
+ GError **error);
+gboolean garrow_float_array_builder_append_null(GArrowFloatArrayBuilder *builder,
+ GError **error);
+
+G_END_DECLS
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/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
new file mode 100644
index 0000000..28e8047
--- /dev/null
+++ b/c_glib/arrow-glib/float-array.cpp
@@ -0,0 +1,69 @@
+/*
+ * 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/39c7274f/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
new file mode 100644
index 0000000..d113f97
--- /dev/null
+++ b/c_glib/arrow-glib/float-array.h
@@ -0,0 +1,71 @@
+/*
+ * 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/39c7274f/c_glib/arrow-glib/float-data-type.cpp
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/float-data-type.cpp b/c_glib/arrow-glib/float-data-type.cpp
new file mode 100644
index 0000000..ce7f28a
--- /dev/null
+++ b/c_glib/arrow-glib/float-data-type.cpp
@@ -0,0 +1,68 @@
+/*
+ * 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/data-type.hpp>
+#include <arrow-glib/float-data-type.h>
+
+G_BEGIN_DECLS
+
+/**
+ * SECTION: float-data-type
+ * @short_description: 32-bit floating point data type
+ *
+ * #GArrowFloatDataType is a class for 32-bit floating point data
+ * type.
+ */
+
+G_DEFINE_TYPE(GArrowFloatDataType, \
+ garrow_float_data_type, \
+ GARROW_TYPE_DATA_TYPE)
+
+static void
+garrow_float_data_type_init(GArrowFloatDataType *object)
+{
+}
+
+static void
+garrow_float_data_type_class_init(GArrowFloatDataTypeClass *klass)
+{
+}
+
+/**
+ * garrow_float_data_type_new:
+ *
+ * Returns: The newly created float data type.
+ */
+GArrowFloatDataType *
+garrow_float_data_type_new(void)
+{
+ auto arrow_data_type = arrow::float32();
+
+ GArrowFloatDataType *data_type =
+ GARROW_FLOAT_DATA_TYPE(g_object_new(GARROW_TYPE_FLOAT_DATA_TYPE,
+ "data-type", &arrow_data_type,
+ NULL));
+ return data_type;
+}
+
+G_END_DECLS
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/float-data-type.h
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/float-data-type.h b/c_glib/arrow-glib/float-data-type.h
new file mode 100644
index 0000000..dcb6c2a
--- /dev/null
+++ b/c_glib/arrow-glib/float-data-type.h
@@ -0,0 +1,69 @@
+/*
+ * 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/data-type.h>
+
+G_BEGIN_DECLS
+
+#define GARROW_TYPE_FLOAT_DATA_TYPE \
+ (garrow_float_data_type_get_type())
+#define GARROW_FLOAT_DATA_TYPE(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj), \
+ GARROW_TYPE_FLOAT_DATA_TYPE, \
+ GArrowFloatDataType))
+#define GARROW_FLOAT_DATA_TYPE_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST((klass), \
+ GARROW_TYPE_FLOAT_DATA_TYPE, \
+ GArrowFloatDataTypeClass))
+#define GARROW_IS_FLOAT_DATA_TYPE(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj), \
+ GARROW_TYPE_FLOAT_DATA_TYPE))
+#define GARROW_IS_FLOAT_DATA_TYPE_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE((klass), \
+ GARROW_TYPE_FLOAT_DATA_TYPE))
+#define GARROW_FLOAT_DATA_TYPE_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS((obj), \
+ GARROW_TYPE_FLOAT_DATA_TYPE, \
+ GArrowFloatDataTypeClass))
+
+typedef struct _GArrowFloatDataType GArrowFloatDataType;
+typedef struct _GArrowFloatDataTypeClass GArrowFloatDataTypeClass;
+
+/**
+ * GArrowFloatDataType:
+ *
+ * It wraps `arrow::FloatType`.
+ */
+struct _GArrowFloatDataType
+{
+ /*< private >*/
+ GArrowDataType parent_instance;
+};
+
+struct _GArrowFloatDataTypeClass
+{
+ GArrowDataTypeClass parent_class;
+};
+
+GType garrow_float_data_type_get_type (void) G_GNUC_CONST;
+GArrowFloatDataType *garrow_float_data_type_new (void);
+
+G_END_DECLS
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/int16-array-builder.cpp
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/int16-array-builder.cpp b/c_glib/arrow-glib/int16-array-builder.cpp
new file mode 100644
index 0000000..fbf18ef
--- /dev/null
+++ b/c_glib/arrow-glib/int16-array-builder.cpp
@@ -0,0 +1,120 @@
+/*
+ * 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-builder.hpp>
+#include <arrow-glib/error.hpp>
+#include <arrow-glib/int16-array-builder.h>
+
+G_BEGIN_DECLS
+
+/**
+ * SECTION: int16-array-builder
+ * @short_description: 16-bit integer array builder class
+ *
+ * #GArrowInt16ArrayBuilder is the class to create a new
+ * #GArrowInt16Array.
+ */
+
+G_DEFINE_TYPE(GArrowInt16ArrayBuilder,
+ garrow_int16_array_builder,
+ GARROW_TYPE_ARRAY_BUILDER)
+
+static void
+garrow_int16_array_builder_init(GArrowInt16ArrayBuilder *builder)
+{
+}
+
+static void
+garrow_int16_array_builder_class_init(GArrowInt16ArrayBuilderClass *klass)
+{
+}
+
+/**
+ * garrow_int16_array_builder_new:
+ *
+ * Returns: A newly created #GArrowInt16ArrayBuilder.
+ */
+GArrowInt16ArrayBuilder *
+garrow_int16_array_builder_new(void)
+{
+ auto memory_pool = arrow::default_memory_pool();
+ auto arrow_builder =
+ std::make_shared<arrow::Int16Builder>(memory_pool, arrow::int16());
+ auto builder =
+ GARROW_INT16_ARRAY_BUILDER(g_object_new(GARROW_TYPE_INT16_ARRAY_BUILDER,
+ "array-builder", &arrow_builder,
+ NULL));
+ return builder;
+}
+
+/**
+ * garrow_int16_array_builder_append:
+ * @builder: A #GArrowInt16ArrayBuilder.
+ * @value: A int16 value.
+ * @error: (nullable): Return location for a #GError or %NULL.
+ *
+ * Returns: %TRUE on success, %FALSE if there was an error.
+ */
+gboolean
+garrow_int16_array_builder_append(GArrowInt16ArrayBuilder *builder,
+ gint16 value,
+ GError **error)
+{
+ auto arrow_builder =
+ static_cast<arrow::Int16Builder *>(
+ garrow_array_builder_get_raw(GARROW_ARRAY_BUILDER(builder)).get());
+
+ auto status = arrow_builder->Append(value);
+ if (status.ok()) {
+ return TRUE;
+ } else {
+ garrow_error_set(error, status, "[int16-array-builder][append]");
+ return FALSE;
+ }
+}
+
+/**
+ * garrow_int16_array_builder_append_null:
+ * @builder: A #GArrowInt16ArrayBuilder.
+ * @error: (nullable): Return location for a #GError or %NULL.
+ *
+ * Returns: %TRUE on success, %FALSE if there was an error.
+ */
+gboolean
+garrow_int16_array_builder_append_null(GArrowInt16ArrayBuilder *builder,
+ GError **error)
+{
+ auto arrow_builder =
+ static_cast<arrow::Int16Builder *>(
+ garrow_array_builder_get_raw(GARROW_ARRAY_BUILDER(builder)).get());
+
+ auto status = arrow_builder->AppendNull();
+ if (status.ok()) {
+ return TRUE;
+ } else {
+ garrow_error_set(error, status, "[int16-array-builder][append-null]");
+ return FALSE;
+ }
+}
+
+G_END_DECLS
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/int16-array-builder.h
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/int16-array-builder.h b/c_glib/arrow-glib/int16-array-builder.h
new file mode 100644
index 0000000..f222cfd
--- /dev/null
+++ b/c_glib/arrow-glib/int16-array-builder.h
@@ -0,0 +1,76 @@
+/*
+ * 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-builder.h>
+
+G_BEGIN_DECLS
+
+#define GARROW_TYPE_INT16_ARRAY_BUILDER \
+ (garrow_int16_array_builder_get_type())
+#define GARROW_INT16_ARRAY_BUILDER(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj), \
+ GARROW_TYPE_INT16_ARRAY_BUILDER, \
+ GArrowInt16ArrayBuilder))
+#define GARROW_INT16_ARRAY_BUILDER_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST((klass), \
+ GARROW_TYPE_INT16_ARRAY_BUILDER, \
+ GArrowInt16ArrayBuilderClass))
+#define GARROW_IS_INT16_ARRAY_BUILDER(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj), \
+ GARROW_TYPE_INT16_ARRAY_BUILDER))
+#define GARROW_IS_INT16_ARRAY_BUILDER_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE((klass), \
+ GARROW_TYPE_INT16_ARRAY_BUILDER))
+#define GARROW_INT16_ARRAY_BUILDER_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS((obj), \
+ GARROW_TYPE_INT16_ARRAY_BUILDER, \
+ GArrowInt16ArrayBuilderClass))
+
+typedef struct _GArrowInt16ArrayBuilder GArrowInt16ArrayBuilder;
+typedef struct _GArrowInt16ArrayBuilderClass GArrowInt16ArrayBuilderClass;
+
+/**
+ * GArrowInt16ArrayBuilder:
+ *
+ * It wraps `arrow::Int16Builder`.
+ */
+struct _GArrowInt16ArrayBuilder
+{
+ /*< private >*/
+ GArrowArrayBuilder parent_instance;
+};
+
+struct _GArrowInt16ArrayBuilderClass
+{
+ GArrowArrayBuilderClass parent_class;
+};
+
+GType garrow_int16_array_builder_get_type(void) G_GNUC_CONST;
+
+GArrowInt16ArrayBuilder *garrow_int16_array_builder_new(void);
+
+gboolean garrow_int16_array_builder_append(GArrowInt16ArrayBuilder *builder,
+ gint16 value,
+ GError **error);
+gboolean garrow_int16_array_builder_append_null(GArrowInt16ArrayBuilder *builder,
+ GError **error);
+
+G_END_DECLS
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/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
new file mode 100644
index 0000000..456d085
--- /dev/null
+++ b/c_glib/arrow-glib/int16-array.cpp
@@ -0,0 +1,69 @@
+/*
+ * 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/39c7274f/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
new file mode 100644
index 0000000..d37144c
--- /dev/null
+++ b/c_glib/arrow-glib/int16-array.h
@@ -0,0 +1,71 @@
+/*
+ * 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/39c7274f/c_glib/arrow-glib/int16-data-type.cpp
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/int16-data-type.cpp b/c_glib/arrow-glib/int16-data-type.cpp
new file mode 100644
index 0000000..45e109e
--- /dev/null
+++ b/c_glib/arrow-glib/int16-data-type.cpp
@@ -0,0 +1,67 @@
+/*
+ * 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/data-type.hpp>
+#include <arrow-glib/int16-data-type.h>
+
+G_BEGIN_DECLS
+
+/**
+ * SECTION: int16-data-type
+ * @short_description: 16-bit integer data type
+ *
+ * #GArrowInt16DataType is a class for 16-bit integer data type.
+ */
+
+G_DEFINE_TYPE(GArrowInt16DataType, \
+ garrow_int16_data_type, \
+ GARROW_TYPE_DATA_TYPE)
+
+static void
+garrow_int16_data_type_init(GArrowInt16DataType *object)
+{
+}
+
+static void
+garrow_int16_data_type_class_init(GArrowInt16DataTypeClass *klass)
+{
+}
+
+/**
+ * garrow_int16_data_type_new:
+ *
+ * Returns: The newly created 16-bit integer data type.
+ */
+GArrowInt16DataType *
+garrow_int16_data_type_new(void)
+{
+ auto arrow_data_type = arrow::int16();
+
+ GArrowInt16DataType *data_type =
+ GARROW_INT16_DATA_TYPE(g_object_new(GARROW_TYPE_INT16_DATA_TYPE,
+ "data-type", &arrow_data_type,
+ NULL));
+ return data_type;
+}
+
+G_END_DECLS
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/int16-data-type.h
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/int16-data-type.h b/c_glib/arrow-glib/int16-data-type.h
new file mode 100644
index 0000000..eaa199c
--- /dev/null
+++ b/c_glib/arrow-glib/int16-data-type.h
@@ -0,0 +1,69 @@
+/*
+ * 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/data-type.h>
+
+G_BEGIN_DECLS
+
+#define GARROW_TYPE_INT16_DATA_TYPE \
+ (garrow_int16_data_type_get_type())
+#define GARROW_INT16_DATA_TYPE(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj), \
+ GARROW_TYPE_INT16_DATA_TYPE, \
+ GArrowInt16DataType))
+#define GARROW_INT16_DATA_TYPE_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST((klass), \
+ GARROW_TYPE_INT16_DATA_TYPE, \
+ GArrowInt16DataTypeClass))
+#define GARROW_IS_INT16_DATA_TYPE(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj), \
+ GARROW_TYPE_INT16_DATA_TYPE))
+#define GARROW_IS_INT16_DATA_TYPE_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE((klass), \
+ GARROW_TYPE_INT16_DATA_TYPE))
+#define GARROW_INT16_DATA_TYPE_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS((obj), \
+ GARROW_TYPE_INT16_DATA_TYPE, \
+ GArrowInt16DataTypeClass))
+
+typedef struct _GArrowInt16DataType GArrowInt16DataType;
+typedef struct _GArrowInt16DataTypeClass GArrowInt16DataTypeClass;
+
+/**
+ * GArrowInt16DataType:
+ *
+ * It wraps `arrow::Int16Type`.
+ */
+struct _GArrowInt16DataType
+{
+ /*< private >*/
+ GArrowDataType parent_instance;
+};
+
+struct _GArrowInt16DataTypeClass
+{
+ GArrowDataTypeClass parent_class;
+};
+
+GType garrow_int16_data_type_get_type (void) G_GNUC_CONST;
+GArrowInt16DataType *garrow_int16_data_type_new (void);
+
+G_END_DECLS
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/int32-array-builder.cpp
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/int32-array-builder.cpp b/c_glib/arrow-glib/int32-array-builder.cpp
new file mode 100644
index 0000000..30cc470
--- /dev/null
+++ b/c_glib/arrow-glib/int32-array-builder.cpp
@@ -0,0 +1,120 @@
+/*
+ * 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-builder.hpp>
+#include <arrow-glib/error.hpp>
+#include <arrow-glib/int32-array-builder.h>
+
+G_BEGIN_DECLS
+
+/**
+ * SECTION: int32-array-builder
+ * @short_description: 32-bit integer array builder class
+ *
+ * #GArrowInt32ArrayBuilder is the class to create a new
+ * #GArrowInt32Array.
+ */
+
+G_DEFINE_TYPE(GArrowInt32ArrayBuilder,
+ garrow_int32_array_builder,
+ GARROW_TYPE_ARRAY_BUILDER)
+
+static void
+garrow_int32_array_builder_init(GArrowInt32ArrayBuilder *builder)
+{
+}
+
+static void
+garrow_int32_array_builder_class_init(GArrowInt32ArrayBuilderClass *klass)
+{
+}
+
+/**
+ * garrow_int32_array_builder_new:
+ *
+ * Returns: A newly created #GArrowInt32ArrayBuilder.
+ */
+GArrowInt32ArrayBuilder *
+garrow_int32_array_builder_new(void)
+{
+ auto memory_pool = arrow::default_memory_pool();
+ auto arrow_builder =
+ std::make_shared<arrow::Int32Builder>(memory_pool, arrow::int32());
+ auto builder =
+ GARROW_INT32_ARRAY_BUILDER(g_object_new(GARROW_TYPE_INT32_ARRAY_BUILDER,
+ "array-builder", &arrow_builder,
+ NULL));
+ return builder;
+}
+
+/**
+ * garrow_int32_array_builder_append:
+ * @builder: A #GArrowInt32ArrayBuilder.
+ * @value: A int32 value.
+ * @error: (nullable): Return location for a #GError or %NULL.
+ *
+ * Returns: %TRUE on success, %FALSE if there was an error.
+ */
+gboolean
+garrow_int32_array_builder_append(GArrowInt32ArrayBuilder *builder,
+ gint32 value,
+ GError **error)
+{
+ auto arrow_builder =
+ static_cast<arrow::Int32Builder *>(
+ garrow_array_builder_get_raw(GARROW_ARRAY_BUILDER(builder)).get());
+
+ auto status = arrow_builder->Append(value);
+ if (status.ok()) {
+ return TRUE;
+ } else {
+ garrow_error_set(error, status, "[int32-array-builder][append]");
+ return FALSE;
+ }
+}
+
+/**
+ * garrow_int32_array_builder_append_null:
+ * @builder: A #GArrowInt32ArrayBuilder.
+ * @error: (nullable): Return location for a #GError or %NULL.
+ *
+ * Returns: %TRUE on success, %FALSE if there was an error.
+ */
+gboolean
+garrow_int32_array_builder_append_null(GArrowInt32ArrayBuilder *builder,
+ GError **error)
+{
+ auto arrow_builder =
+ static_cast<arrow::Int32Builder *>(
+ garrow_array_builder_get_raw(GARROW_ARRAY_BUILDER(builder)).get());
+
+ auto status = arrow_builder->AppendNull();
+ if (status.ok()) {
+ return TRUE;
+ } else {
+ garrow_error_set(error, status, "[int32-array-builder][append-null]");
+ return FALSE;
+ }
+}
+
+G_END_DECLS
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/int32-array-builder.h
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/int32-array-builder.h b/c_glib/arrow-glib/int32-array-builder.h
new file mode 100644
index 0000000..bdb380d
--- /dev/null
+++ b/c_glib/arrow-glib/int32-array-builder.h
@@ -0,0 +1,76 @@
+/*
+ * 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-builder.h>
+
+G_BEGIN_DECLS
+
+#define GARROW_TYPE_INT32_ARRAY_BUILDER \
+ (garrow_int32_array_builder_get_type())
+#define GARROW_INT32_ARRAY_BUILDER(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj), \
+ GARROW_TYPE_INT32_ARRAY_BUILDER, \
+ GArrowInt32ArrayBuilder))
+#define GARROW_INT32_ARRAY_BUILDER_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST((klass), \
+ GARROW_TYPE_INT32_ARRAY_BUILDER, \
+ GArrowInt32ArrayBuilderClass))
+#define GARROW_IS_INT32_ARRAY_BUILDER(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj), \
+ GARROW_TYPE_INT32_ARRAY_BUILDER))
+#define GARROW_IS_INT32_ARRAY_BUILDER_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE((klass), \
+ GARROW_TYPE_INT32_ARRAY_BUILDER))
+#define GARROW_INT32_ARRAY_BUILDER_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS((obj), \
+ GARROW_TYPE_INT32_ARRAY_BUILDER, \
+ GArrowInt32ArrayBuilderClass))
+
+typedef struct _GArrowInt32ArrayBuilder GArrowInt32ArrayBuilder;
+typedef struct _GArrowInt32ArrayBuilderClass GArrowInt32ArrayBuilderClass;
+
+/**
+ * GArrowInt32ArrayBuilder:
+ *
+ * It wraps `arrow::Int32Builder`.
+ */
+struct _GArrowInt32ArrayBuilder
+{
+ /*< private >*/
+ GArrowArrayBuilder parent_instance;
+};
+
+struct _GArrowInt32ArrayBuilderClass
+{
+ GArrowArrayBuilderClass parent_class;
+};
+
+GType garrow_int32_array_builder_get_type(void) G_GNUC_CONST;
+
+GArrowInt32ArrayBuilder *garrow_int32_array_builder_new(void);
+
+gboolean garrow_int32_array_builder_append(GArrowInt32ArrayBuilder *builder,
+ gint32 value,
+ GError **error);
+gboolean garrow_int32_array_builder_append_null(GArrowInt32ArrayBuilder *builder,
+ GError **error);
+
+G_END_DECLS
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/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
new file mode 100644
index 0000000..8bd6f35
--- /dev/null
+++ b/c_glib/arrow-glib/int32-array.cpp
@@ -0,0 +1,69 @@
+/*
+ * 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/39c7274f/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
new file mode 100644
index 0000000..cce2b41
--- /dev/null
+++ b/c_glib/arrow-glib/int32-array.h
@@ -0,0 +1,71 @@
+/*
+ * 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/39c7274f/c_glib/arrow-glib/int32-data-type.cpp
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/int32-data-type.cpp b/c_glib/arrow-glib/int32-data-type.cpp
new file mode 100644
index 0000000..add2113
--- /dev/null
+++ b/c_glib/arrow-glib/int32-data-type.cpp
@@ -0,0 +1,67 @@
+/*
+ * 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/data-type.hpp>
+#include <arrow-glib/int32-data-type.h>
+
+G_BEGIN_DECLS
+
+/**
+ * SECTION: int32-data-type
+ * @short_description: 32-bit integer data type
+ *
+ * #GArrowInt32DataType is a class for 32-bit integer data type.
+ */
+
+G_DEFINE_TYPE(GArrowInt32DataType, \
+ garrow_int32_data_type, \
+ GARROW_TYPE_DATA_TYPE)
+
+static void
+garrow_int32_data_type_init(GArrowInt32DataType *object)
+{
+}
+
+static void
+garrow_int32_data_type_class_init(GArrowInt32DataTypeClass *klass)
+{
+}
+
+/**
+ * garrow_int32_data_type_new:
+ *
+ * Returns: The newly created 32-bit integer data type.
+ */
+GArrowInt32DataType *
+garrow_int32_data_type_new(void)
+{
+ auto arrow_data_type = arrow::int32();
+
+ GArrowInt32DataType *data_type =
+ GARROW_INT32_DATA_TYPE(g_object_new(GARROW_TYPE_INT32_DATA_TYPE,
+ "data-type", &arrow_data_type,
+ NULL));
+ return data_type;
+}
+
+G_END_DECLS
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/int32-data-type.h
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/int32-data-type.h b/c_glib/arrow-glib/int32-data-type.h
new file mode 100644
index 0000000..75cccbd
--- /dev/null
+++ b/c_glib/arrow-glib/int32-data-type.h
@@ -0,0 +1,69 @@
+/*
+ * 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/data-type.h>
+
+G_BEGIN_DECLS
+
+#define GARROW_TYPE_INT32_DATA_TYPE \
+ (garrow_int32_data_type_get_type())
+#define GARROW_INT32_DATA_TYPE(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj), \
+ GARROW_TYPE_INT32_DATA_TYPE, \
+ GArrowInt32DataType))
+#define GARROW_INT32_DATA_TYPE_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST((klass), \
+ GARROW_TYPE_INT32_DATA_TYPE, \
+ GArrowInt32DataTypeClass))
+#define GARROW_IS_INT32_DATA_TYPE(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj), \
+ GARROW_TYPE_INT32_DATA_TYPE))
+#define GARROW_IS_INT32_DATA_TYPE_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE((klass), \
+ GARROW_TYPE_INT32_DATA_TYPE))
+#define GARROW_INT32_DATA_TYPE_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS((obj), \
+ GARROW_TYPE_INT32_DATA_TYPE, \
+ GArrowInt32DataTypeClass))
+
+typedef struct _GArrowInt32DataType GArrowInt32DataType;
+typedef struct _GArrowInt32DataTypeClass GArrowInt32DataTypeClass;
+
+/**
+ * GArrowInt32DataType:
+ *
+ * It wraps `arrow::Int32Type`.
+ */
+struct _GArrowInt32DataType
+{
+ /*< private >*/
+ GArrowDataType parent_instance;
+};
+
+struct _GArrowInt32DataTypeClass
+{
+ GArrowDataTypeClass parent_class;
+};
+
+GType garrow_int32_data_type_get_type (void) G_GNUC_CONST;
+GArrowInt32DataType *garrow_int32_data_type_new (void);
+
+G_END_DECLS
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/int64-array-builder.cpp
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/int64-array-builder.cpp b/c_glib/arrow-glib/int64-array-builder.cpp
new file mode 100644
index 0000000..b5eff11
--- /dev/null
+++ b/c_glib/arrow-glib/int64-array-builder.cpp
@@ -0,0 +1,120 @@
+/*
+ * 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-builder.hpp>
+#include <arrow-glib/error.hpp>
+#include <arrow-glib/int64-array-builder.h>
+
+G_BEGIN_DECLS
+
+/**
+ * SECTION: int64-array-builder
+ * @short_description: 64-bit integer array builder class
+ *
+ * #GArrowInt64ArrayBuilder is the class to create a new
+ * #GArrowInt64Array.
+ */
+
+G_DEFINE_TYPE(GArrowInt64ArrayBuilder,
+ garrow_int64_array_builder,
+ GARROW_TYPE_ARRAY_BUILDER)
+
+static void
+garrow_int64_array_builder_init(GArrowInt64ArrayBuilder *builder)
+{
+}
+
+static void
+garrow_int64_array_builder_class_init(GArrowInt64ArrayBuilderClass *klass)
+{
+}
+
+/**
+ * garrow_int64_array_builder_new:
+ *
+ * Returns: A newly created #GArrowInt64ArrayBuilder.
+ */
+GArrowInt64ArrayBuilder *
+garrow_int64_array_builder_new(void)
+{
+ auto memory_pool = arrow::default_memory_pool();
+ auto arrow_builder =
+ std::make_shared<arrow::Int64Builder>(memory_pool, arrow::int64());
+ auto builder =
+ GARROW_INT64_ARRAY_BUILDER(g_object_new(GARROW_TYPE_INT64_ARRAY_BUILDER,
+ "array-builder", &arrow_builder,
+ NULL));
+ return builder;
+}
+
+/**
+ * garrow_int64_array_builder_append:
+ * @builder: A #GArrowInt64ArrayBuilder.
+ * @value: A int64 value.
+ * @error: (nullable): Return location for a #GError or %NULL.
+ *
+ * Returns: %TRUE on success, %FALSE if there was an error.
+ */
+gboolean
+garrow_int64_array_builder_append(GArrowInt64ArrayBuilder *builder,
+ gint64 value,
+ GError **error)
+{
+ auto arrow_builder =
+ static_cast<arrow::Int64Builder *>(
+ garrow_array_builder_get_raw(GARROW_ARRAY_BUILDER(builder)).get());
+
+ auto status = arrow_builder->Append(value);
+ if (status.ok()) {
+ return TRUE;
+ } else {
+ garrow_error_set(error, status, "[int64-array-builder][append]");
+ return FALSE;
+ }
+}
+
+/**
+ * garrow_int64_array_builder_append_null:
+ * @builder: A #GArrowInt64ArrayBuilder.
+ * @error: (nullable): Return location for a #GError or %NULL.
+ *
+ * Returns: %TRUE on success, %FALSE if there was an error.
+ */
+gboolean
+garrow_int64_array_builder_append_null(GArrowInt64ArrayBuilder *builder,
+ GError **error)
+{
+ auto arrow_builder =
+ static_cast<arrow::Int64Builder *>(
+ garrow_array_builder_get_raw(GARROW_ARRAY_BUILDER(builder)).get());
+
+ auto status = arrow_builder->AppendNull();
+ if (status.ok()) {
+ return TRUE;
+ } else {
+ garrow_error_set(error, status, "[int64-array-builder][append-null]");
+ return FALSE;
+ }
+}
+
+G_END_DECLS
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/int64-array-builder.h
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/int64-array-builder.h b/c_glib/arrow-glib/int64-array-builder.h
new file mode 100644
index 0000000..8f4947e
--- /dev/null
+++ b/c_glib/arrow-glib/int64-array-builder.h
@@ -0,0 +1,76 @@
+/*
+ * 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-builder.h>
+
+G_BEGIN_DECLS
+
+#define GARROW_TYPE_INT64_ARRAY_BUILDER \
+ (garrow_int64_array_builder_get_type())
+#define GARROW_INT64_ARRAY_BUILDER(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj), \
+ GARROW_TYPE_INT64_ARRAY_BUILDER, \
+ GArrowInt64ArrayBuilder))
+#define GARROW_INT64_ARRAY_BUILDER_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST((klass), \
+ GARROW_TYPE_INT64_ARRAY_BUILDER, \
+ GArrowInt64ArrayBuilderClass))
+#define GARROW_IS_INT64_ARRAY_BUILDER(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj), \
+ GARROW_TYPE_INT64_ARRAY_BUILDER))
+#define GARROW_IS_INT64_ARRAY_BUILDER_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE((klass), \
+ GARROW_TYPE_INT64_ARRAY_BUILDER))
+#define GARROW_INT64_ARRAY_BUILDER_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS((obj), \
+ GARROW_TYPE_INT64_ARRAY_BUILDER, \
+ GArrowInt64ArrayBuilderClass))
+
+typedef struct _GArrowInt64ArrayBuilder GArrowInt64ArrayBuilder;
+typedef struct _GArrowInt64ArrayBuilderClass GArrowInt64ArrayBuilderClass;
+
+/**
+ * GArrowInt64ArrayBuilder:
+ *
+ * It wraps `arrow::Int64Builder`.
+ */
+struct _GArrowInt64ArrayBuilder
+{
+ /*< private >*/
+ GArrowArrayBuilder parent_instance;
+};
+
+struct _GArrowInt64ArrayBuilderClass
+{
+ GArrowArrayBuilderClass parent_class;
+};
+
+GType garrow_int64_array_builder_get_type(void) G_GNUC_CONST;
+
+GArrowInt64ArrayBuilder *garrow_int64_array_builder_new(void);
+
+gboolean garrow_int64_array_builder_append(GArrowInt64ArrayBuilder *builder,
+ gint64 value,
+ GError **error);
+gboolean garrow_int64_array_builder_append_null(GArrowInt64ArrayBuilder *builder,
+ GError **error);
+
+G_END_DECLS
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/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
new file mode 100644
index 0000000..be49d5b
--- /dev/null
+++ b/c_glib/arrow-glib/int64-array.cpp
@@ -0,0 +1,69 @@
+/*
+ * 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
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/int64-array.h
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/int64-array.h b/c_glib/arrow-glib/int64-array.h
new file mode 100644
index 0000000..73d4c64
--- /dev/null
+++ b/c_glib/arrow-glib/int64-array.h
@@ -0,0 +1,71 @@
+/*
+ * 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_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);
+
+G_END_DECLS
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/int64-data-type.cpp
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/int64-data-type.cpp b/c_glib/arrow-glib/int64-data-type.cpp
new file mode 100644
index 0000000..8e85b9d
--- /dev/null
+++ b/c_glib/arrow-glib/int64-data-type.cpp
@@ -0,0 +1,67 @@
+/*
+ * 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/data-type.hpp>
+#include <arrow-glib/int64-data-type.h>
+
+G_BEGIN_DECLS
+
+/**
+ * SECTION: int64-data-type
+ * @short_description: 64-bit integer data type
+ *
+ * #GArrowInt64DataType is a class for 64-bit integer data type.
+ */
+
+G_DEFINE_TYPE(GArrowInt64DataType, \
+ garrow_int64_data_type, \
+ GARROW_TYPE_DATA_TYPE)
+
+static void
+garrow_int64_data_type_init(GArrowInt64DataType *object)
+{
+}
+
+static void
+garrow_int64_data_type_class_init(GArrowInt64DataTypeClass *klass)
+{
+}
+
+/**
+ * garrow_int64_data_type_new:
+ *
+ * Returns: The newly created 64-bit integer data type.
+ */
+GArrowInt64DataType *
+garrow_int64_data_type_new(void)
+{
+ auto arrow_data_type = arrow::int64();
+
+ GArrowInt64DataType *data_type =
+ GARROW_INT64_DATA_TYPE(g_object_new(GARROW_TYPE_INT64_DATA_TYPE,
+ "data-type", &arrow_data_type,
+ NULL));
+ return data_type;
+}
+
+G_END_DECLS
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/int64-data-type.h
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/int64-data-type.h b/c_glib/arrow-glib/int64-data-type.h
new file mode 100644
index 0000000..499e79f
--- /dev/null
+++ b/c_glib/arrow-glib/int64-data-type.h
@@ -0,0 +1,69 @@
+/*
+ * 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/data-type.h>
+
+G_BEGIN_DECLS
+
+#define GARROW_TYPE_INT64_DATA_TYPE \
+ (garrow_int64_data_type_get_type())
+#define GARROW_INT64_DATA_TYPE(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj), \
+ GARROW_TYPE_INT64_DATA_TYPE, \
+ GArrowInt64DataType))
+#define GARROW_INT64_DATA_TYPE_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST((klass), \
+ GARROW_TYPE_INT64_DATA_TYPE, \
+ GArrowInt64DataTypeClass))
+#define GARROW_IS_INT64_DATA_TYPE(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj), \
+ GARROW_TYPE_INT64_DATA_TYPE))
+#define GARROW_IS_INT64_DATA_TYPE_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE((klass), \
+ GARROW_TYPE_INT64_DATA_TYPE))
+#define GARROW_INT64_DATA_TYPE_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS((obj), \
+ GARROW_TYPE_INT64_DATA_TYPE, \
+ GArrowInt64DataTypeClass))
+
+typedef struct _GArrowInt64DataType GArrowInt64DataType;
+typedef struct _GArrowInt64DataTypeClass GArrowInt64DataTypeClass;
+
+/**
+ * GArrowInt64DataType:
+ *
+ * It wraps `arrow::Int64Type`.
+ */
+struct _GArrowInt64DataType
+{
+ /*< private >*/
+ GArrowDataType parent_instance;
+};
+
+struct _GArrowInt64DataTypeClass
+{
+ GArrowDataTypeClass parent_class;
+};
+
+GType garrow_int64_data_type_get_type (void) G_GNUC_CONST;
+GArrowInt64DataType *garrow_int64_data_type_new (void);
+
+G_END_DECLS
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/int8-array-builder.cpp
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/int8-array-builder.cpp b/c_glib/arrow-glib/int8-array-builder.cpp
new file mode 100644
index 0000000..5107a6f
--- /dev/null
+++ b/c_glib/arrow-glib/int8-array-builder.cpp
@@ -0,0 +1,120 @@
+/*
+ * 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-builder.hpp>
+#include <arrow-glib/error.hpp>
+#include <arrow-glib/int8-array-builder.h>
+
+G_BEGIN_DECLS
+
+/**
+ * SECTION: int8-array-builder
+ * @short_description: 8-bit integer array builder class
+ *
+ * #GArrowInt8ArrayBuilder is the class to create a new
+ * #GArrowInt8Array.
+ */
+
+G_DEFINE_TYPE(GArrowInt8ArrayBuilder,
+ garrow_int8_array_builder,
+ GARROW_TYPE_ARRAY_BUILDER)
+
+static void
+garrow_int8_array_builder_init(GArrowInt8ArrayBuilder *builder)
+{
+}
+
+static void
+garrow_int8_array_builder_class_init(GArrowInt8ArrayBuilderClass *klass)
+{
+}
+
+/**
+ * garrow_int8_array_builder_new:
+ *
+ * Returns: A newly created #GArrowInt8ArrayBuilder.
+ */
+GArrowInt8ArrayBuilder *
+garrow_int8_array_builder_new(void)
+{
+ auto memory_pool = arrow::default_memory_pool();
+ auto arrow_builder =
+ std::make_shared<arrow::Int8Builder>(memory_pool, arrow::int8());
+ auto builder =
+ GARROW_INT8_ARRAY_BUILDER(g_object_new(GARROW_TYPE_INT8_ARRAY_BUILDER,
+ "array-builder", &arrow_builder,
+ NULL));
+ return builder;
+}
+
+/**
+ * garrow_int8_array_builder_append:
+ * @builder: A #GArrowInt8ArrayBuilder.
+ * @value: A int8 value.
+ * @error: (nullable): Return location for a #GError or %NULL.
+ *
+ * Returns: %TRUE on success, %FALSE if there was an error.
+ */
+gboolean
+garrow_int8_array_builder_append(GArrowInt8ArrayBuilder *builder,
+ gint8 value,
+ GError **error)
+{
+ auto arrow_builder =
+ static_cast<arrow::Int8Builder *>(
+ garrow_array_builder_get_raw(GARROW_ARRAY_BUILDER(builder)).get());
+
+ auto status = arrow_builder->Append(value);
+ if (status.ok()) {
+ return TRUE;
+ } else {
+ garrow_error_set(error, status, "[int8-array-builder][append]");
+ return FALSE;
+ }
+}
+
+/**
+ * garrow_int8_array_builder_append_null:
+ * @builder: A #GArrowInt8ArrayBuilder.
+ * @error: (nullable): Return location for a #GError or %NULL.
+ *
+ * Returns: %TRUE on success, %FALSE if there was an error.
+ */
+gboolean
+garrow_int8_array_builder_append_null(GArrowInt8ArrayBuilder *builder,
+ GError **error)
+{
+ auto arrow_builder =
+ static_cast<arrow::Int8Builder *>(
+ garrow_array_builder_get_raw(GARROW_ARRAY_BUILDER(builder)).get());
+
+ auto status = arrow_builder->AppendNull();
+ if (status.ok()) {
+ return TRUE;
+ } else {
+ garrow_error_set(error, status, "[int8-array-builder][append-null]");
+ return FALSE;
+ }
+}
+
+G_END_DECLS
[4/9] arrow git commit: ARROW-631: [GLib] Import
Posted by we...@apache.org.
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/list-data-type.cpp
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/list-data-type.cpp b/c_glib/arrow-glib/list-data-type.cpp
new file mode 100644
index 0000000..e82e6fd
--- /dev/null
+++ b/c_glib/arrow-glib/list-data-type.cpp
@@ -0,0 +1,91 @@
+/*
+ * 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/data-type.hpp>
+#include <arrow-glib/field.hpp>
+#include <arrow-glib/list-data-type.h>
+
+G_BEGIN_DECLS
+
+/**
+ * SECTION: list-data-type
+ * @short_description: List data type
+ *
+ * #GArrowListDataType is a class for list data type.
+ */
+
+G_DEFINE_TYPE(GArrowListDataType, \
+ garrow_list_data_type, \
+ GARROW_TYPE_DATA_TYPE)
+
+static void
+garrow_list_data_type_init(GArrowListDataType *object)
+{
+}
+
+static void
+garrow_list_data_type_class_init(GArrowListDataTypeClass *klass)
+{
+}
+
+/**
+ * garrow_list_data_type_new:
+ * @field: The field of elements
+ *
+ * Returns: The newly created list data type.
+ */
+GArrowListDataType *
+garrow_list_data_type_new(GArrowField *field)
+{
+ auto arrow_field = garrow_field_get_raw(field);
+ auto arrow_data_type =
+ std::make_shared<arrow::ListType>(arrow_field);
+
+ GArrowListDataType *data_type =
+ GARROW_LIST_DATA_TYPE(g_object_new(GARROW_TYPE_LIST_DATA_TYPE,
+ "data-type", &arrow_data_type,
+ NULL));
+ return data_type;
+}
+
+/**
+ * garrow_list_data_type_get_value_field:
+ * @list_data_type: A #GArrowListDataType.
+ *
+ * Returns: (transfer full): The field of value.
+ */
+GArrowField *
+garrow_list_data_type_get_value_field(GArrowListDataType *list_data_type)
+{
+ auto arrow_data_type =
+ garrow_data_type_get_raw(GARROW_DATA_TYPE(list_data_type));
+ auto arrow_list_data_type =
+ static_cast<arrow::ListType *>(arrow_data_type.get());
+
+ auto arrow_field = arrow_list_data_type->value_field();
+ auto field = garrow_field_new_raw(&arrow_field);
+
+ return field;
+}
+
+G_END_DECLS
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/list-data-type.h
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/list-data-type.h b/c_glib/arrow-glib/list-data-type.h
new file mode 100644
index 0000000..bb406e2
--- /dev/null
+++ b/c_glib/arrow-glib/list-data-type.h
@@ -0,0 +1,73 @@
+/*
+ * 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/data-type.h>
+#include <arrow-glib/field.h>
+
+G_BEGIN_DECLS
+
+#define GARROW_TYPE_LIST_DATA_TYPE \
+ (garrow_list_data_type_get_type())
+#define GARROW_LIST_DATA_TYPE(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj), \
+ GARROW_TYPE_LIST_DATA_TYPE, \
+ GArrowListDataType))
+#define GARROW_LIST_DATA_TYPE_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST((klass), \
+ GARROW_TYPE_LIST_DATA_TYPE, \
+ GArrowListDataTypeClass))
+#define GARROW_IS_LIST_DATA_TYPE(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj), \
+ GARROW_TYPE_LIST_DATA_TYPE))
+#define GARROW_IS_LIST_DATA_TYPE_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE((klass), \
+ GARROW_TYPE_LIST_DATA_TYPE))
+#define GARROW_LIST_DATA_TYPE_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS((obj), \
+ GARROW_TYPE_LIST_DATA_TYPE, \
+ GArrowListDataTypeClass))
+
+typedef struct _GArrowListDataType GArrowListDataType;
+typedef struct _GArrowListDataTypeClass GArrowListDataTypeClass;
+
+/**
+ * GArrowListDataType:
+ *
+ * It wraps `arrow::ListType`.
+ */
+struct _GArrowListDataType
+{
+ /*< private >*/
+ GArrowDataType parent_instance;
+};
+
+struct _GArrowListDataTypeClass
+{
+ GArrowDataTypeClass parent_class;
+};
+
+GType garrow_list_data_type_get_type (void) G_GNUC_CONST;
+
+GArrowListDataType *garrow_list_data_type_new (GArrowField *field);
+
+GArrowField *garrow_list_data_type_get_value_field (GArrowListDataType *list_data_type);
+
+G_END_DECLS
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/null-array.cpp
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/null-array.cpp b/c_glib/arrow-glib/null-array.cpp
new file mode 100644
index 0000000..0e0ea51
--- /dev/null
+++ b/c_glib/arrow-glib/null-array.cpp
@@ -0,0 +1,69 @@
+/*
+ * 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/null-array.h>
+
+G_BEGIN_DECLS
+
+/**
+ * SECTION: null-array
+ * @short_description: Null array class
+ *
+ * #GArrowNullArray is a class for null array. It can store zero
+ * or more null values.
+ *
+ * #GArrowNullArray is immutable. You need to specify an array length
+ * to create a new 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_END_DECLS
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/null-array.h
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/null-array.h b/c_glib/arrow-glib/null-array.h
new file mode 100644
index 0000000..e25f305
--- /dev/null
+++ b/c_glib/arrow-glib/null-array.h
@@ -0,0 +1,70 @@
+/*
+ * 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_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);
+
+G_END_DECLS
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/null-data-type.cpp
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/null-data-type.cpp b/c_glib/arrow-glib/null-data-type.cpp
new file mode 100644
index 0000000..1f75d3b
--- /dev/null
+++ b/c_glib/arrow-glib/null-data-type.cpp
@@ -0,0 +1,67 @@
+/*
+ * 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/data-type.hpp>
+#include <arrow-glib/null-data-type.h>
+
+G_BEGIN_DECLS
+
+/**
+ * SECTION: null-data-type
+ * @short_description: Null data type
+ *
+ * #GArrowNullDataType is a class for null data type.
+ */
+
+G_DEFINE_TYPE(GArrowNullDataType, \
+ garrow_null_data_type, \
+ GARROW_TYPE_DATA_TYPE)
+
+static void
+garrow_null_data_type_init(GArrowNullDataType *object)
+{
+}
+
+static void
+garrow_null_data_type_class_init(GArrowNullDataTypeClass *klass)
+{
+}
+
+/**
+ * garrow_null_data_type_new:
+ *
+ * Returns: The newly created null data type.
+ */
+GArrowNullDataType *
+garrow_null_data_type_new(void)
+{
+ auto arrow_data_type = arrow::null();
+
+ GArrowNullDataType *data_type =
+ GARROW_NULL_DATA_TYPE(g_object_new(GARROW_TYPE_NULL_DATA_TYPE,
+ "data-type", &arrow_data_type,
+ NULL));
+ return data_type;
+}
+
+G_END_DECLS
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/null-data-type.h
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/null-data-type.h b/c_glib/arrow-glib/null-data-type.h
new file mode 100644
index 0000000..006b76c
--- /dev/null
+++ b/c_glib/arrow-glib/null-data-type.h
@@ -0,0 +1,69 @@
+/*
+ * 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/data-type.h>
+
+G_BEGIN_DECLS
+
+#define GARROW_TYPE_NULL_DATA_TYPE \
+ (garrow_null_data_type_get_type())
+#define GARROW_NULL_DATA_TYPE(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj), \
+ GARROW_TYPE_NULL_DATA_TYPE, \
+ GArrowNullDataType))
+#define GARROW_NULL_DATA_TYPE_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST((klass), \
+ GARROW_TYPE_NULL_DATA_TYPE, \
+ GArrowNullDataTypeClass))
+#define GARROW_IS_NULL_DATA_TYPE(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj), \
+ GARROW_TYPE_NULL_DATA_TYPE))
+#define GARROW_IS_NULL_DATA_TYPE_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE((klass), \
+ GARROW_TYPE_NULL_DATA_TYPE))
+#define GARROW_NULL_DATA_TYPE_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS((obj), \
+ GARROW_TYPE_NULL_DATA_TYPE, \
+ GArrowNullDataTypeClass))
+
+typedef struct _GArrowNullDataType GArrowNullDataType;
+typedef struct _GArrowNullDataTypeClass GArrowNullDataTypeClass;
+
+/**
+ * GArrowNullDataType:
+ *
+ * It wraps `arrow::NullType`.
+ */
+struct _GArrowNullDataType
+{
+ /*< private >*/
+ GArrowDataType parent_instance;
+};
+
+struct _GArrowNullDataTypeClass
+{
+ GArrowDataTypeClass parent_class;
+};
+
+GType garrow_null_data_type_get_type (void) G_GNUC_CONST;
+GArrowNullDataType *garrow_null_data_type_new (void);
+
+G_END_DECLS
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/record-batch.cpp
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/record-batch.cpp b/c_glib/arrow-glib/record-batch.cpp
new file mode 100644
index 0000000..8ac1791
--- /dev/null
+++ b/c_glib/arrow-glib/record-batch.cpp
@@ -0,0 +1,288 @@
+/*
+ * 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/record-batch.hpp>
+#include <arrow-glib/schema.hpp>
+
+G_BEGIN_DECLS
+
+/**
+ * SECTION: record-batch
+ * @short_description: Record batch class
+ *
+ * #GArrowRecordBatch is a class for record batch. Record batch is
+ * similar to #GArrowTable. Record batch also has also zero or more
+ * columns and zero or more records.
+ *
+ * Record batch is used for shared memory IPC.
+ */
+
+typedef struct GArrowRecordBatchPrivate_ {
+ std::shared_ptr<arrow::RecordBatch> record_batch;
+} GArrowRecordBatchPrivate;
+
+enum {
+ PROP_0,
+ PROP_RECORD_BATCH
+};
+
+G_DEFINE_TYPE_WITH_PRIVATE(GArrowRecordBatch,
+ garrow_record_batch,
+ G_TYPE_OBJECT)
+
+#define GARROW_RECORD_BATCH_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE((obj), \
+ GARROW_TYPE_RECORD_BATCH, \
+ GArrowRecordBatchPrivate))
+
+static void
+garrow_record_batch_finalize(GObject *object)
+{
+ GArrowRecordBatchPrivate *priv;
+
+ priv = GARROW_RECORD_BATCH_GET_PRIVATE(object);
+
+ priv->record_batch = nullptr;
+
+ G_OBJECT_CLASS(garrow_record_batch_parent_class)->finalize(object);
+}
+
+static void
+garrow_record_batch_set_property(GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ GArrowRecordBatchPrivate *priv;
+
+ priv = GARROW_RECORD_BATCH_GET_PRIVATE(object);
+
+ switch (prop_id) {
+ case PROP_RECORD_BATCH:
+ priv->record_batch =
+ *static_cast<std::shared_ptr<arrow::RecordBatch> *>(g_value_get_pointer(value));
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+ break;
+ }
+}
+
+static void
+garrow_record_batch_get_property(GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ switch (prop_id) {
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+ break;
+ }
+}
+
+static void
+garrow_record_batch_init(GArrowRecordBatch *object)
+{
+}
+
+static void
+garrow_record_batch_class_init(GArrowRecordBatchClass *klass)
+{
+ GObjectClass *gobject_class;
+ GParamSpec *spec;
+
+ gobject_class = G_OBJECT_CLASS(klass);
+
+ gobject_class->finalize = garrow_record_batch_finalize;
+ gobject_class->set_property = garrow_record_batch_set_property;
+ gobject_class->get_property = garrow_record_batch_get_property;
+
+ spec = g_param_spec_pointer("record-batch",
+ "RecordBatch",
+ "The raw std::shared<arrow::RecordBatch> *",
+ static_cast<GParamFlags>(G_PARAM_WRITABLE |
+ G_PARAM_CONSTRUCT_ONLY));
+ g_object_class_install_property(gobject_class, PROP_RECORD_BATCH, spec);
+}
+
+/**
+ * garrow_record_batch_new:
+ * @schema: The schema of the record batch.
+ * @n_rows: The number of the rows in the record batch.
+ * @columns: (element-type GArrowArray): The columns in the record batch.
+ *
+ * Returns: A newly created #GArrowRecordBatch.
+ */
+GArrowRecordBatch *
+garrow_record_batch_new(GArrowSchema *schema,
+ guint32 n_rows,
+ GList *columns)
+{
+ std::vector<std::shared_ptr<arrow::Array>> arrow_columns;
+ for (GList *node = columns; node; node = node->next) {
+ GArrowArray *column = GARROW_ARRAY(node->data);
+ arrow_columns.push_back(garrow_array_get_raw(column));
+ }
+
+ auto arrow_record_batch =
+ std::make_shared<arrow::RecordBatch>(garrow_schema_get_raw(schema),
+ n_rows,
+ arrow_columns);
+ return garrow_record_batch_new_raw(&arrow_record_batch);
+}
+
+/**
+ * garrow_record_batch_get_schema:
+ * @record_batch: A #GArrowRecordBatch.
+ *
+ * Returns: (transfer full): The schema of the record batch.
+ */
+GArrowSchema *
+garrow_record_batch_get_schema(GArrowRecordBatch *record_batch)
+{
+ const auto arrow_record_batch = garrow_record_batch_get_raw(record_batch);
+ auto arrow_schema = arrow_record_batch->schema();
+ return garrow_schema_new_raw(&arrow_schema);
+}
+
+/**
+ * garrow_record_batch_get_column:
+ * @record_batch: A #GArrowRecordBatch.
+ * @i: The index of the target column.
+ *
+ * Returns: (transfer full): The i-th column in the record batch.
+ */
+GArrowArray *
+garrow_record_batch_get_column(GArrowRecordBatch *record_batch,
+ guint i)
+{
+ const auto arrow_record_batch = garrow_record_batch_get_raw(record_batch);
+ auto arrow_column = arrow_record_batch->column(i);
+ return garrow_array_new_raw(&arrow_column);
+}
+
+/**
+ * garrow_record_batch_get_columns:
+ * @record_batch: A #GArrowRecordBatch.
+ *
+ * Returns: (element-type GArrowArray) (transfer full):
+ * The columns in the record batch.
+ */
+GList *
+garrow_record_batch_get_columns(GArrowRecordBatch *record_batch)
+{
+ const auto arrow_record_batch = garrow_record_batch_get_raw(record_batch);
+
+ GList *columns = NULL;
+ for (auto arrow_column : arrow_record_batch->columns()) {
+ GArrowArray *column = garrow_array_new_raw(&arrow_column);
+ columns = g_list_prepend(columns, column);
+ }
+
+ return g_list_reverse(columns);
+}
+
+/**
+ * garrow_record_batch_get_column_name:
+ * @record_batch: A #GArrowRecordBatch.
+ * @i: The index of the target column.
+ *
+ * Returns: The name of the i-th column in the record batch.
+ */
+const gchar *
+garrow_record_batch_get_column_name(GArrowRecordBatch *record_batch,
+ guint i)
+{
+ const auto arrow_record_batch = garrow_record_batch_get_raw(record_batch);
+ return arrow_record_batch->column_name(i).c_str();
+}
+
+/**
+ * garrow_record_batch_get_n_columns:
+ * @record_batch: A #GArrowRecordBatch.
+ *
+ * Returns: The number of columns in the record batch.
+ */
+guint
+garrow_record_batch_get_n_columns(GArrowRecordBatch *record_batch)
+{
+ const auto arrow_record_batch = garrow_record_batch_get_raw(record_batch);
+ return arrow_record_batch->num_columns();
+}
+
+/**
+ * garrow_record_batch_get_n_rows:
+ * @record_batch: A #GArrowRecordBatch.
+ *
+ * Returns: The number of rows in the record batch.
+ */
+gint64
+garrow_record_batch_get_n_rows(GArrowRecordBatch *record_batch)
+{
+ const auto arrow_record_batch = garrow_record_batch_get_raw(record_batch);
+ return arrow_record_batch->num_rows();
+}
+
+/**
+ * garrow_record_batch_slice:
+ * @record_batch: A #GArrowRecordBatch.
+ * @offset: The offset of sub #GArrowRecordBatch.
+ * @length: The length of sub #GArrowRecordBatch.
+ *
+ * Returns: (transfer full): The sub #GArrowRecordBatch. It covers
+ * only from `offset` to `offset + length` range. The sub
+ * #GArrowRecordBatch shares values with the base
+ * #GArrowRecordBatch.
+ */
+GArrowRecordBatch *
+garrow_record_batch_slice(GArrowRecordBatch *record_batch,
+ gint64 offset,
+ gint64 length)
+{
+ const auto arrow_record_batch = garrow_record_batch_get_raw(record_batch);
+ auto arrow_sub_record_batch = arrow_record_batch->Slice(offset, length);
+ return garrow_record_batch_new_raw(&arrow_sub_record_batch);
+}
+
+G_END_DECLS
+
+GArrowRecordBatch *
+garrow_record_batch_new_raw(std::shared_ptr<arrow::RecordBatch> *arrow_record_batch)
+{
+ auto record_batch =
+ GARROW_RECORD_BATCH(g_object_new(GARROW_TYPE_RECORD_BATCH,
+ "record-batch", arrow_record_batch,
+ NULL));
+ return record_batch;
+}
+
+std::shared_ptr<arrow::RecordBatch>
+garrow_record_batch_get_raw(GArrowRecordBatch *record_batch)
+{
+ GArrowRecordBatchPrivate *priv;
+
+ priv = GARROW_RECORD_BATCH_GET_PRIVATE(record_batch);
+ return priv->record_batch;
+}
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/record-batch.h
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/record-batch.h b/c_glib/arrow-glib/record-batch.h
new file mode 100644
index 0000000..92eee4d
--- /dev/null
+++ b/c_glib/arrow-glib/record-batch.h
@@ -0,0 +1,85 @@
+/*
+ * 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>
+#include <arrow-glib/schema.h>
+
+G_BEGIN_DECLS
+
+#define GARROW_TYPE_RECORD_BATCH \
+ (garrow_record_batch_get_type())
+#define GARROW_RECORD_BATCH(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj), \
+ GARROW_TYPE_RECORD_BATCH, \
+ GArrowRecordBatch))
+#define GARROW_RECORD_BATCH_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST((klass), \
+ GARROW_TYPE_RECORD_BATCH, \
+ GArrowRecordBatchClass))
+#define GARROW_IS_RECORD_BATCH(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj), \
+ GARROW_TYPE_RECORD_BATCH))
+#define GARROW_IS_RECORD_BATCH_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE((klass), \
+ GARROW_TYPE_RECORD_BATCH))
+#define GARROW_RECORD_BATCH_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS((obj), \
+ GARROW_TYPE_RECORD_BATCH, \
+ GArrowRecordBatchClass))
+
+typedef struct _GArrowRecordBatch GArrowRecordBatch;
+typedef struct _GArrowRecordBatchClass GArrowRecordBatchClass;
+
+/**
+ * GArrowRecordBatch:
+ *
+ * It wraps `arrow::RecordBatch`.
+ */
+struct _GArrowRecordBatch
+{
+ /*< private >*/
+ GObject parent_instance;
+};
+
+struct _GArrowRecordBatchClass
+{
+ GObjectClass parent_class;
+};
+
+GType garrow_record_batch_get_type(void) G_GNUC_CONST;
+
+GArrowRecordBatch *garrow_record_batch_new(GArrowSchema *schema,
+ guint32 n_rows,
+ GList *columns);
+
+GArrowSchema *garrow_record_batch_get_schema (GArrowRecordBatch *record_batch);
+GArrowArray *garrow_record_batch_get_column (GArrowRecordBatch *record_batch,
+ guint i);
+GList *garrow_record_batch_get_columns (GArrowRecordBatch *record_batch);
+const gchar *garrow_record_batch_get_column_name(GArrowRecordBatch *record_batch,
+ guint i);
+guint garrow_record_batch_get_n_columns (GArrowRecordBatch *record_batch);
+gint64 garrow_record_batch_get_n_rows (GArrowRecordBatch *record_batch);
+GArrowRecordBatch *garrow_record_batch_slice (GArrowRecordBatch *record_batch,
+ gint64 offset,
+ gint64 length);
+
+G_END_DECLS
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/record-batch.hpp
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/record-batch.hpp b/c_glib/arrow-glib/record-batch.hpp
new file mode 100644
index 0000000..2e4fe03
--- /dev/null
+++ b/c_glib/arrow-glib/record-batch.hpp
@@ -0,0 +1,27 @@
+/*
+ * 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/api.h>
+
+#include <arrow-glib/record-batch.h>
+
+GArrowRecordBatch *garrow_record_batch_new_raw(std::shared_ptr<arrow::RecordBatch> *arrow_record_batch);
+std::shared_ptr<arrow::RecordBatch> garrow_record_batch_get_raw(GArrowRecordBatch *record_batch);
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/schema.cpp
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/schema.cpp b/c_glib/arrow-glib/schema.cpp
new file mode 100644
index 0000000..4d5ae5a
--- /dev/null
+++ b/c_glib/arrow-glib/schema.cpp
@@ -0,0 +1,245 @@
+/*
+ * 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/field.hpp>
+#include <arrow-glib/schema.hpp>
+
+G_BEGIN_DECLS
+
+/**
+ * SECTION: schema
+ * @short_description: Schema class
+ *
+ * #GArrowSchema is a class for schema. Schema is metadata of a
+ * table. It has zero or more #GArrowFields.
+ */
+
+typedef struct GArrowSchemaPrivate_ {
+ std::shared_ptr<arrow::Schema> schema;
+} GArrowSchemaPrivate;
+
+enum {
+ PROP_0,
+ PROP_SCHEMA
+};
+
+G_DEFINE_TYPE_WITH_PRIVATE(GArrowSchema,
+ garrow_schema,
+ G_TYPE_OBJECT)
+
+#define GARROW_SCHEMA_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE((obj), \
+ GARROW_TYPE_SCHEMA, \
+ GArrowSchemaPrivate))
+
+static void
+garrow_schema_finalize(GObject *object)
+{
+ GArrowSchemaPrivate *priv;
+
+ priv = GARROW_SCHEMA_GET_PRIVATE(object);
+
+ priv->schema = nullptr;
+
+ G_OBJECT_CLASS(garrow_schema_parent_class)->finalize(object);
+}
+
+static void
+garrow_schema_set_property(GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ GArrowSchemaPrivate *priv;
+
+ priv = GARROW_SCHEMA_GET_PRIVATE(object);
+
+ switch (prop_id) {
+ case PROP_SCHEMA:
+ priv->schema =
+ *static_cast<std::shared_ptr<arrow::Schema> *>(g_value_get_pointer(value));
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+ break;
+ }
+}
+
+static void
+garrow_schema_get_property(GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ switch (prop_id) {
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+ break;
+ }
+}
+
+static void
+garrow_schema_init(GArrowSchema *object)
+{
+}
+
+static void
+garrow_schema_class_init(GArrowSchemaClass *klass)
+{
+ GObjectClass *gobject_class;
+ GParamSpec *spec;
+
+ gobject_class = G_OBJECT_CLASS(klass);
+
+ gobject_class->finalize = garrow_schema_finalize;
+ gobject_class->set_property = garrow_schema_set_property;
+ gobject_class->get_property = garrow_schema_get_property;
+
+ spec = g_param_spec_pointer("schema",
+ "Schema",
+ "The raw std::shared<arrow::Schema> *",
+ static_cast<GParamFlags>(G_PARAM_WRITABLE |
+ G_PARAM_CONSTRUCT_ONLY));
+ g_object_class_install_property(gobject_class, PROP_SCHEMA, spec);
+}
+
+/**
+ * garrow_schema_new:
+ * @fields: (element-type GArrowField): The fields of the schema.
+ *
+ * Returns: A newly created #GArrowSchema.
+ */
+GArrowSchema *
+garrow_schema_new(GList *fields)
+{
+ std::vector<std::shared_ptr<arrow::Field>> arrow_fields;
+ for (GList *node = fields; node; node = node->next) {
+ GArrowField *field = GARROW_FIELD(node->data);
+ arrow_fields.push_back(garrow_field_get_raw(field));
+ }
+
+ auto arrow_schema = std::make_shared<arrow::Schema>(arrow_fields);
+ return garrow_schema_new_raw(&arrow_schema);
+}
+
+/**
+ * garrow_schema_get_field:
+ * @schema: A #GArrowSchema.
+ * @i: The index of the target field.
+ *
+ * Returns: (transfer full): The i-th field of the schema.
+ */
+GArrowField *
+garrow_schema_get_field(GArrowSchema *schema, guint i)
+{
+ const auto arrow_schema = garrow_schema_get_raw(schema);
+ auto arrow_field = arrow_schema->field(i);
+ return garrow_field_new_raw(&arrow_field);
+}
+
+/**
+ * garrow_schema_get_field_by_name:
+ * @schema: A #GArrowSchema.
+ * @name: The name of the field to be found.
+ *
+ * Returns: (transfer full): The found field or %NULL.
+ */
+GArrowField *
+garrow_schema_get_field_by_name(GArrowSchema *schema,
+ const gchar *name)
+{
+ const auto arrow_schema = garrow_schema_get_raw(schema);
+ auto arrow_field = arrow_schema->GetFieldByName(std::string(name));
+ if (arrow_field == nullptr) {
+ return NULL;
+ } else {
+ return garrow_field_new_raw(&arrow_field);
+ }
+}
+
+/**
+ * garrow_schema_n_fields:
+ * @schema: A #GArrowSchema.
+ *
+ * Returns: The number of fields of the schema.
+ */
+guint
+garrow_schema_n_fields(GArrowSchema *schema)
+{
+ const auto arrow_schema = garrow_schema_get_raw(schema);
+ return arrow_schema->num_fields();
+}
+
+/**
+ * garrow_schema_get_fields:
+ * @schema: A #GArrowSchema.
+ *
+ * Returns: (element-type GArrowField) (transfer full):
+ * The fields of the schema.
+ */
+GList *
+garrow_schema_get_fields(GArrowSchema *schema)
+{
+ const auto arrow_schema = garrow_schema_get_raw(schema);
+
+ GList *fields = NULL;
+ for (auto arrow_field : arrow_schema->fields()) {
+ GArrowField *field = garrow_field_new_raw(&arrow_field);
+ fields = g_list_prepend(fields, field);
+ }
+
+ return g_list_reverse(fields);
+}
+
+/**
+ * garrow_schema_to_string:
+ * @schema: A #GArrowSchema.
+ *
+ * Returns: The string representation of the schema.
+ */
+gchar *
+garrow_schema_to_string(GArrowSchema *schema)
+{
+ const auto arrow_schema = garrow_schema_get_raw(schema);
+ return g_strdup(arrow_schema->ToString().c_str());
+}
+
+G_END_DECLS
+
+GArrowSchema *
+garrow_schema_new_raw(std::shared_ptr<arrow::Schema> *arrow_schema)
+{
+ auto schema = GARROW_SCHEMA(g_object_new(GARROW_TYPE_SCHEMA,
+ "schema", arrow_schema,
+ NULL));
+ return schema;
+}
+
+std::shared_ptr<arrow::Schema>
+garrow_schema_get_raw(GArrowSchema *schema)
+{
+ GArrowSchemaPrivate *priv;
+
+ priv = GARROW_SCHEMA_GET_PRIVATE(schema);
+ return priv->schema;
+}
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/schema.h
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/schema.h b/c_glib/arrow-glib/schema.h
new file mode 100644
index 0000000..7615634
--- /dev/null
+++ b/c_glib/arrow-glib/schema.h
@@ -0,0 +1,80 @@
+/*
+ * 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/field.h>
+
+G_BEGIN_DECLS
+
+#define GARROW_TYPE_SCHEMA \
+ (garrow_schema_get_type())
+#define GARROW_SCHEMA(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj), \
+ GARROW_TYPE_SCHEMA, \
+ GArrowSchema))
+#define GARROW_SCHEMA_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST((klass), \
+ GARROW_TYPE_SCHEMA, \
+ GArrowSchemaClass))
+#define GARROW_IS_SCHEMA(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj), \
+ GARROW_TYPE_SCHEMA))
+#define GARROW_IS_SCHEMA_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE((klass), \
+ GARROW_TYPE_SCHEMA))
+#define GARROW_SCHEMA_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS((obj), \
+ GARROW_TYPE_SCHEMA, \
+ GArrowSchemaClass))
+
+typedef struct _GArrowSchema GArrowSchema;
+typedef struct _GArrowSchemaClass GArrowSchemaClass;
+
+/**
+ * GArrowSchema:
+ *
+ * It wraps `arrow::Schema`.
+ */
+struct _GArrowSchema
+{
+ /*< private >*/
+ GObject parent_instance;
+};
+
+struct _GArrowSchemaClass
+{
+ GObjectClass parent_class;
+};
+
+GType garrow_schema_get_type (void) G_GNUC_CONST;
+
+GArrowSchema *garrow_schema_new (GList *fields);
+
+GArrowField *garrow_schema_get_field (GArrowSchema *schema,
+ guint i);
+GArrowField *garrow_schema_get_field_by_name(GArrowSchema *schema,
+ const gchar *name);
+
+guint garrow_schema_n_fields (GArrowSchema *schema);
+GList *garrow_schema_get_fields (GArrowSchema *schema);
+
+gchar *garrow_schema_to_string (GArrowSchema *schema);
+
+G_END_DECLS
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/schema.hpp
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/schema.hpp b/c_glib/arrow-glib/schema.hpp
new file mode 100644
index 0000000..0d02534
--- /dev/null
+++ b/c_glib/arrow-glib/schema.hpp
@@ -0,0 +1,27 @@
+/*
+ * 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/api.h>
+
+#include <arrow-glib/schema.h>
+
+GArrowSchema *garrow_schema_new_raw(std::shared_ptr<arrow::Schema> *arrow_schema);
+std::shared_ptr<arrow::Schema> garrow_schema_get_raw(GArrowSchema *schema);
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/string-array-builder.cpp
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/string-array-builder.cpp b/c_glib/arrow-glib/string-array-builder.cpp
new file mode 100644
index 0000000..ebad53a
--- /dev/null
+++ b/c_glib/arrow-glib/string-array-builder.cpp
@@ -0,0 +1,97 @@
+/*
+ * 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-builder.hpp>
+#include <arrow-glib/string-array-builder.h>
+#include <arrow-glib/error.hpp>
+
+G_BEGIN_DECLS
+
+/**
+ * SECTION: string-array-builder
+ * @short_description: UTF-8 encoded string array builder class
+ *
+ * #GArrowStringArrayBuilder is the class to create a new
+ * #GArrowStringArray.
+ */
+
+G_DEFINE_TYPE(GArrowStringArrayBuilder,
+ garrow_string_array_builder,
+ GARROW_TYPE_BINARY_ARRAY_BUILDER)
+
+static void
+garrow_string_array_builder_init(GArrowStringArrayBuilder *builder)
+{
+}
+
+static void
+garrow_string_array_builder_class_init(GArrowStringArrayBuilderClass *klass)
+{
+}
+
+/**
+ * garrow_string_array_builder_new:
+ *
+ * Returns: A newly created #GArrowStringArrayBuilder.
+ */
+GArrowStringArrayBuilder *
+garrow_string_array_builder_new(void)
+{
+ auto memory_pool = arrow::default_memory_pool();
+ auto arrow_builder =
+ std::make_shared<arrow::StringBuilder>(memory_pool);
+ auto builder =
+ GARROW_STRING_ARRAY_BUILDER(g_object_new(GARROW_TYPE_STRING_ARRAY_BUILDER,
+ "array-builder", &arrow_builder,
+ NULL));
+ return builder;
+}
+
+/**
+ * garrow_string_array_builder_append:
+ * @builder: A #GArrowStringArrayBuilder.
+ * @value: A string value.
+ * @error: (nullable): Return location for a #GError or %NULL.
+ *
+ * Returns: %TRUE on success, %FALSE if there was an error.
+ */
+gboolean
+garrow_string_array_builder_append(GArrowStringArrayBuilder *builder,
+ const gchar *value,
+ GError **error)
+{
+ auto arrow_builder =
+ static_cast<arrow::StringBuilder *>(
+ garrow_array_builder_get_raw(GARROW_ARRAY_BUILDER(builder)).get());
+
+ auto status = arrow_builder->Append(value,
+ static_cast<gint32>(strlen(value)));
+ if (status.ok()) {
+ return TRUE;
+ } else {
+ garrow_error_set(error, status, "[string-array-builder][append]");
+ return FALSE;
+ }
+}
+
+G_END_DECLS
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/string-array-builder.h
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/string-array-builder.h b/c_glib/arrow-glib/string-array-builder.h
new file mode 100644
index 0000000..f370ed9
--- /dev/null
+++ b/c_glib/arrow-glib/string-array-builder.h
@@ -0,0 +1,74 @@
+/*
+ * 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/binary-array-builder.h>
+
+G_BEGIN_DECLS
+
+#define GARROW_TYPE_STRING_ARRAY_BUILDER \
+ (garrow_string_array_builder_get_type())
+#define GARROW_STRING_ARRAY_BUILDER(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj), \
+ GARROW_TYPE_STRING_ARRAY_BUILDER, \
+ GArrowStringArrayBuilder))
+#define GARROW_STRING_ARRAY_BUILDER_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST((klass), \
+ GARROW_TYPE_STRING_ARRAY_BUILDER, \
+ GArrowStringArrayBuilderClass))
+#define GARROW_IS_STRING_ARRAY_BUILDER(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj), \
+ GARROW_TYPE_STRING_ARRAY_BUILDER))
+#define GARROW_IS_STRING_ARRAY_BUILDER_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE((klass), \
+ GARROW_TYPE_STRING_ARRAY_BUILDER))
+#define GARROW_STRING_ARRAY_BUILDER_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS((obj), \
+ GARROW_TYPE_STRING_ARRAY_BUILDER, \
+ GArrowStringArrayBuilderClass))
+
+typedef struct _GArrowStringArrayBuilder GArrowStringArrayBuilder;
+typedef struct _GArrowStringArrayBuilderClass GArrowStringArrayBuilderClass;
+
+/**
+ * GArrowStringArrayBuilder:
+ *
+ * It wraps `arrow::StringBuilder`.
+ */
+struct _GArrowStringArrayBuilder
+{
+ /*< private >*/
+ GArrowBinaryArrayBuilder parent_instance;
+};
+
+struct _GArrowStringArrayBuilderClass
+{
+ GArrowBinaryArrayBuilderClass parent_class;
+};
+
+GType garrow_string_array_builder_get_type(void) G_GNUC_CONST;
+
+GArrowStringArrayBuilder *garrow_string_array_builder_new(void);
+
+gboolean garrow_string_array_builder_append(GArrowStringArrayBuilder *builder,
+ const gchar *value,
+ GError **error);
+
+G_END_DECLS
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/string-array.cpp
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/string-array.cpp b/c_glib/arrow-glib/string-array.cpp
new file mode 100644
index 0000000..329c742
--- /dev/null
+++ b/c_glib/arrow-glib/string-array.cpp
@@ -0,0 +1,74 @@
+/*
+ * 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/string-array.h>
+
+G_BEGIN_DECLS
+
+/**
+ * SECTION: string-array
+ * @short_description: UTF-8 encoded string array class
+ *
+ * #GArrowStringArray is a class for UTF-8 encoded string array. It
+ * can store zero or more UTF-8 encoded string data.
+ *
+ * #GArrowStringArray is immutable. You need to use
+ * #GArrowStringArrayBuilder to create a new array.
+ */
+
+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_END_DECLS
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/string-array.h
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/string-array.h b/c_glib/arrow-glib/string-array.h
new file mode 100644
index 0000000..41a53cd
--- /dev/null
+++ b/c_glib/arrow-glib/string-array.h
@@ -0,0 +1,71 @@
+/*
+ * 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/binary-array.h>
+
+G_BEGIN_DECLS
+
+#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);
+
+G_END_DECLS
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/string-data-type.cpp
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/string-data-type.cpp b/c_glib/arrow-glib/string-data-type.cpp
new file mode 100644
index 0000000..96a31bf
--- /dev/null
+++ b/c_glib/arrow-glib/string-data-type.cpp
@@ -0,0 +1,68 @@
+/*
+ * 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/data-type.hpp>
+#include <arrow-glib/string-data-type.h>
+
+G_BEGIN_DECLS
+
+/**
+ * SECTION: string-data-type
+ * @short_description: UTF-8 encoded string data type
+ *
+ * #GArrowStringDataType is a class for UTF-8 encoded string data
+ * type.
+ */
+
+G_DEFINE_TYPE(GArrowStringDataType, \
+ garrow_string_data_type, \
+ GARROW_TYPE_DATA_TYPE)
+
+static void
+garrow_string_data_type_init(GArrowStringDataType *object)
+{
+}
+
+static void
+garrow_string_data_type_class_init(GArrowStringDataTypeClass *klass)
+{
+}
+
+/**
+ * garrow_string_data_type_new:
+ *
+ * Returns: The newly created UTF-8 encoded string data type.
+ */
+GArrowStringDataType *
+garrow_string_data_type_new(void)
+{
+ auto arrow_data_type = arrow::utf8();
+
+ GArrowStringDataType *data_type =
+ GARROW_STRING_DATA_TYPE(g_object_new(GARROW_TYPE_STRING_DATA_TYPE,
+ "data-type", &arrow_data_type,
+ NULL));
+ return data_type;
+}
+
+G_END_DECLS
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/string-data-type.h
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/string-data-type.h b/c_glib/arrow-glib/string-data-type.h
new file mode 100644
index 0000000..d10a325
--- /dev/null
+++ b/c_glib/arrow-glib/string-data-type.h
@@ -0,0 +1,69 @@
+/*
+ * 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/data-type.h>
+
+G_BEGIN_DECLS
+
+#define GARROW_TYPE_STRING_DATA_TYPE \
+ (garrow_string_data_type_get_type())
+#define GARROW_STRING_DATA_TYPE(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj), \
+ GARROW_TYPE_STRING_DATA_TYPE, \
+ GArrowStringDataType))
+#define GARROW_STRING_DATA_TYPE_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST((klass), \
+ GARROW_TYPE_STRING_DATA_TYPE, \
+ GArrowStringDataTypeClass))
+#define GARROW_IS_STRING_DATA_TYPE(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj), \
+ GARROW_TYPE_STRING_DATA_TYPE))
+#define GARROW_IS_STRING_DATA_TYPE_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE((klass), \
+ GARROW_TYPE_STRING_DATA_TYPE))
+#define GARROW_STRING_DATA_TYPE_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS((obj), \
+ GARROW_TYPE_STRING_DATA_TYPE, \
+ GArrowStringDataTypeClass))
+
+typedef struct _GArrowStringDataType GArrowStringDataType;
+typedef struct _GArrowStringDataTypeClass GArrowStringDataTypeClass;
+
+/**
+ * GArrowStringDataType:
+ *
+ * It wraps `arrow::StringType`.
+ */
+struct _GArrowStringDataType
+{
+ /*< private >*/
+ GArrowDataType parent_instance;
+};
+
+struct _GArrowStringDataTypeClass
+{
+ GArrowDataTypeClass parent_class;
+};
+
+GType garrow_string_data_type_get_type (void) G_GNUC_CONST;
+GArrowStringDataType *garrow_string_data_type_new (void);
+
+G_END_DECLS
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/struct-array-builder.cpp
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/struct-array-builder.cpp b/c_glib/arrow-glib/struct-array-builder.cpp
new file mode 100644
index 0000000..2453a5b
--- /dev/null
+++ b/c_glib/arrow-glib/struct-array-builder.cpp
@@ -0,0 +1,187 @@
+/*
+ * 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-builder.hpp>
+#include <arrow-glib/data-type.hpp>
+#include <arrow-glib/error.hpp>
+#include <arrow-glib/field.hpp>
+#include <arrow-glib/struct-array-builder.h>
+
+G_BEGIN_DECLS
+
+/**
+ * SECTION: struct-array-builder
+ * @short_description: Struct array builder class
+ * @include: arrow-glib/arrow-glib.h
+ *
+ * #GArrowStructArrayBuilder is the class to create a new
+ * #GArrowStructArray.
+ */
+
+G_DEFINE_TYPE(GArrowStructArrayBuilder,
+ garrow_struct_array_builder,
+ GARROW_TYPE_ARRAY_BUILDER)
+
+static void
+garrow_struct_array_builder_init(GArrowStructArrayBuilder *builder)
+{
+}
+
+static void
+garrow_struct_array_builder_class_init(GArrowStructArrayBuilderClass *klass)
+{
+}
+
+/**
+ * garrow_struct_array_builder_new:
+ * @data_type: #GArrowStructDataType for the struct.
+ * @field_builders: (element-type GArrowArray): #GArrowArrayBuilders
+ * for fields.
+ *
+ * Returns: A newly created #GArrowStructArrayBuilder.
+ */
+GArrowStructArrayBuilder *
+garrow_struct_array_builder_new(GArrowStructDataType *data_type,
+ GList *field_builders)
+{
+ auto memory_pool = arrow::default_memory_pool();
+ auto arrow_data_type = garrow_data_type_get_raw(GARROW_DATA_TYPE(data_type));
+ std::vector<std::shared_ptr<arrow::ArrayBuilder>> arrow_field_builders;
+ for (GList *node = field_builders; node; node = g_list_next(node)) {
+ auto field_builder = static_cast<GArrowArrayBuilder *>(node->data);
+ auto arrow_field_builder = garrow_array_builder_get_raw(field_builder);
+ arrow_field_builders.push_back(arrow_field_builder);
+ }
+
+ auto arrow_struct_builder =
+ std::make_shared<arrow::StructBuilder>(memory_pool,
+ arrow_data_type,
+ arrow_field_builders);
+ std::shared_ptr<arrow::ArrayBuilder> arrow_builder = arrow_struct_builder;
+ auto builder = garrow_array_builder_new_raw(&arrow_builder);
+ return GARROW_STRUCT_ARRAY_BUILDER(builder);
+}
+
+/**
+ * garrow_struct_array_builder_append:
+ * @builder: A #GArrowStructArrayBuilder.
+ * @error: (nullable): Return location for a #GError or %NULL.
+ *
+ * Returns: %TRUE on success, %FALSE if there was an error.
+ *
+ * It appends a new struct element. To append a new struct element,
+ * you need to call this function then append struct element field
+ * values to all `field_builder`s. `field_value`s are the
+ * #GArrowArrayBuilder specified to constructor. You can get
+ * `field_builder` by garrow_struct_array_builder_get_field_builder()
+ * or garrow_struct_array_builder_get_field_builders().
+ *
+ * |[<!-- language="C" -->
+ * // TODO
+ * ]|
+ */
+gboolean
+garrow_struct_array_builder_append(GArrowStructArrayBuilder *builder,
+ GError **error)
+{
+ auto arrow_builder =
+ static_cast<arrow::StructBuilder *>(
+ garrow_array_builder_get_raw(GARROW_ARRAY_BUILDER(builder)).get());
+
+ auto status = arrow_builder->Append();
+ if (status.ok()) {
+ return TRUE;
+ } else {
+ garrow_error_set(error, status, "[struct-array-builder][append]");
+ return FALSE;
+ }
+}
+
+/**
+ * garrow_struct_array_builder_append_null:
+ * @builder: A #GArrowStructArrayBuilder.
+ * @error: (nullable): Return location for a #GError or %NULL.
+ *
+ * Returns: %TRUE on success, %FALSE if there was an error.
+ *
+ * It appends a new NULL element.
+ */
+gboolean
+garrow_struct_array_builder_append_null(GArrowStructArrayBuilder *builder,
+ GError **error)
+{
+ auto arrow_builder =
+ static_cast<arrow::StructBuilder *>(
+ garrow_array_builder_get_raw(GARROW_ARRAY_BUILDER(builder)).get());
+
+ auto status = arrow_builder->AppendNull();
+ if (status.ok()) {
+ return TRUE;
+ } else {
+ garrow_error_set(error, status, "[struct-array-builder][append-null]");
+ return FALSE;
+ }
+}
+
+/**
+ * garrow_struct_array_builder_get_field_builder:
+ * @builder: A #GArrowStructArrayBuilder.
+ * @i: The index of the field in the struct.
+ *
+ * Returns: (transfer full): The #GArrowArrayBuilder for the i-th field.
+ */
+GArrowArrayBuilder *
+garrow_struct_array_builder_get_field_builder(GArrowStructArrayBuilder *builder,
+ gint i)
+{
+ auto arrow_builder =
+ static_cast<arrow::StructBuilder *>(
+ garrow_array_builder_get_raw(GARROW_ARRAY_BUILDER(builder)).get());
+ auto arrow_field_builder = arrow_builder->field_builder(i);
+ return garrow_array_builder_new_raw(&arrow_field_builder);
+}
+
+/**
+ * garrow_struct_array_builder_get_field_builders:
+ * @builder: A #GArrowStructArrayBuilder.
+ *
+ * Returns: (element-type GArrowArray) (transfer full):
+ * The #GArrowArrayBuilder for all fields.
+ */
+GList *
+garrow_struct_array_builder_get_field_builders(GArrowStructArrayBuilder *builder)
+{
+ auto arrow_struct_builder =
+ static_cast<arrow::StructBuilder *>(
+ garrow_array_builder_get_raw(GARROW_ARRAY_BUILDER(builder)).get());
+
+ GList *field_builders = NULL;
+ for (auto arrow_field_builder : arrow_struct_builder->field_builders()) {
+ auto field_builder = garrow_array_builder_new_raw(&arrow_field_builder);
+ field_builders = g_list_prepend(field_builders, field_builder);
+ }
+
+ return g_list_reverse(field_builders);
+}
+
+G_END_DECLS
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/struct-array-builder.h
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/struct-array-builder.h b/c_glib/arrow-glib/struct-array-builder.h
new file mode 100644
index 0000000..7dd8662
--- /dev/null
+++ b/c_glib/arrow-glib/struct-array-builder.h
@@ -0,0 +1,81 @@
+/*
+ * 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-builder.h>
+#include <arrow-glib/struct-data-type.h>
+
+G_BEGIN_DECLS
+
+#define GARROW_TYPE_STRUCT_ARRAY_BUILDER \
+ (garrow_struct_array_builder_get_type())
+#define GARROW_STRUCT_ARRAY_BUILDER(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj), \
+ GARROW_TYPE_STRUCT_ARRAY_BUILDER, \
+ GArrowStructArrayBuilder))
+#define GARROW_STRUCT_ARRAY_BUILDER_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST((klass), \
+ GARROW_TYPE_STRUCT_ARRAY_BUILDER, \
+ GArrowStructArrayBuilderClass))
+#define GARROW_IS_STRUCT_ARRAY_BUILDER(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj), \
+ GARROW_TYPE_STRUCT_ARRAY_BUILDER))
+#define GARROW_IS_STRUCT_ARRAY_BUILDER_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE((klass), \
+ GARROW_TYPE_STRUCT_ARRAY_BUILDER))
+#define GARROW_STRUCT_ARRAY_BUILDER_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS((obj), \
+ GARROW_TYPE_STRUCT_ARRAY_BUILDER, \
+ GArrowStructArrayBuilderClass))
+
+typedef struct _GArrowStructArrayBuilder GArrowStructArrayBuilder;
+typedef struct _GArrowStructArrayBuilderClass GArrowStructArrayBuilderClass;
+
+/**
+ * GArrowStructArrayBuilder:
+ *
+ * It wraps `arrow::StructBuilder`.
+ */
+struct _GArrowStructArrayBuilder
+{
+ /*< private >*/
+ GArrowArrayBuilder parent_instance;
+};
+
+struct _GArrowStructArrayBuilderClass
+{
+ GArrowArrayBuilderClass parent_class;
+};
+
+GType garrow_struct_array_builder_get_type(void) G_GNUC_CONST;
+
+GArrowStructArrayBuilder *garrow_struct_array_builder_new(GArrowStructDataType *data_type,
+ GList *field_builders);
+
+gboolean garrow_struct_array_builder_append(GArrowStructArrayBuilder *builder,
+ GError **error);
+gboolean garrow_struct_array_builder_append_null(GArrowStructArrayBuilder *builder,
+ GError **error);
+
+GArrowArrayBuilder *garrow_struct_array_builder_get_field_builder(GArrowStructArrayBuilder *builder,
+ gint i);
+GList *garrow_struct_array_builder_get_field_builders(GArrowStructArrayBuilder *builder);
+
+G_END_DECLS
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/struct-array.cpp
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/struct-array.cpp b/c_glib/arrow-glib/struct-array.cpp
new file mode 100644
index 0000000..14c2d17
--- /dev/null
+++ b/c_glib/arrow-glib/struct-array.cpp
@@ -0,0 +1,97 @@
+/*
+ * 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/data-type.hpp>
+#include <arrow-glib/struct-array.h>
+
+G_BEGIN_DECLS
+
+/**
+ * SECTION: struct-array
+ * @short_description: Struct array class
+ * @include: arrow-glib/arrow-glib.h
+ *
+ * #GArrowStructArray is a class for struct array. It can store zero
+ * or more structs. One struct has zero or more fields.
+ *
+ * #GArrowStructArray is immutable. You need to use
+ * #GArrowStructArrayBuilder to create a new array.
+ */
+
+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
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/struct-array.h
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/struct-array.h b/c_glib/arrow-glib/struct-array.h
new file mode 100644
index 0000000..f96e9d4
--- /dev/null
+++ b/c_glib/arrow-glib/struct-array.h
@@ -0,0 +1,73 @@
+/*
+ * 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>
+#include <arrow-glib/data-type.h>
+
+G_BEGIN_DECLS
+
+#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/39c7274f/c_glib/arrow-glib/struct-data-type.cpp
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/struct-data-type.cpp b/c_glib/arrow-glib/struct-data-type.cpp
new file mode 100644
index 0000000..9a4f2a2
--- /dev/null
+++ b/c_glib/arrow-glib/struct-data-type.cpp
@@ -0,0 +1,75 @@
+/*
+ * 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/data-type.hpp>
+#include <arrow-glib/field.hpp>
+#include <arrow-glib/struct-data-type.h>
+
+G_BEGIN_DECLS
+
+/**
+ * SECTION: struct-data-type
+ * @short_description: Struct data type
+ *
+ * #GArrowStructDataType is a class for struct data type.
+ */
+
+G_DEFINE_TYPE(GArrowStructDataType, \
+ garrow_struct_data_type, \
+ GARROW_TYPE_DATA_TYPE)
+
+static void
+garrow_struct_data_type_init(GArrowStructDataType *object)
+{
+}
+
+static void
+garrow_struct_data_type_class_init(GArrowStructDataTypeClass *klass)
+{
+}
+
+/**
+ * garrow_struct_data_type_new:
+ * @fields: (element-type GArrowField): The fields of the struct.
+ *
+ * Returns: The newly created struct data type.
+ */
+GArrowStructDataType *
+garrow_struct_data_type_new(GList *fields)
+{
+ std::vector<std::shared_ptr<arrow::Field>> arrow_fields;
+ for (GList *node = fields; node; node = g_list_next(node)) {
+ auto field = GARROW_FIELD(node->data);
+ auto arrow_field = garrow_field_get_raw(field);
+ arrow_fields.push_back(arrow_field);
+ }
+
+ auto arrow_data_type = std::make_shared<arrow::StructType>(arrow_fields);
+ GArrowStructDataType *data_type =
+ GARROW_STRUCT_DATA_TYPE(g_object_new(GARROW_TYPE_STRUCT_DATA_TYPE,
+ "data-type", &arrow_data_type,
+ NULL));
+ return data_type;
+}
+
+G_END_DECLS
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/struct-data-type.h
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/struct-data-type.h b/c_glib/arrow-glib/struct-data-type.h
new file mode 100644
index 0000000..0a2c743
--- /dev/null
+++ b/c_glib/arrow-glib/struct-data-type.h
@@ -0,0 +1,71 @@
+/*
+ * 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/data-type.h>
+#include <arrow-glib/field.h>
+
+G_BEGIN_DECLS
+
+#define GARROW_TYPE_STRUCT_DATA_TYPE \
+ (garrow_struct_data_type_get_type())
+#define GARROW_STRUCT_DATA_TYPE(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj), \
+ GARROW_TYPE_STRUCT_DATA_TYPE, \
+ GArrowStructDataType))
+#define GARROW_STRUCT_DATA_TYPE_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST((klass), \
+ GARROW_TYPE_STRUCT_DATA_TYPE, \
+ GArrowStructDataTypeClass))
+#define GARROW_IS_STRUCT_DATA_TYPE(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj), \
+ GARROW_TYPE_STRUCT_DATA_TYPE))
+#define GARROW_IS_STRUCT_DATA_TYPE_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE((klass), \
+ GARROW_TYPE_STRUCT_DATA_TYPE))
+#define GARROW_STRUCT_DATA_TYPE_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS((obj), \
+ GARROW_TYPE_STRUCT_DATA_TYPE, \
+ GArrowStructDataTypeClass))
+
+typedef struct _GArrowStructDataType GArrowStructDataType;
+typedef struct _GArrowStructDataTypeClass GArrowStructDataTypeClass;
+
+/**
+ * GArrowStructDataType:
+ *
+ * It wraps `arrow::StructType`.
+ */
+struct _GArrowStructDataType
+{
+ /*< private >*/
+ GArrowDataType parent_instance;
+};
+
+struct _GArrowStructDataTypeClass
+{
+ GArrowDataTypeClass parent_class;
+};
+
+GType garrow_struct_data_type_get_type (void) G_GNUC_CONST;
+
+GArrowStructDataType *garrow_struct_data_type_new(GList *fields);
+
+G_END_DECLS
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/table.cpp
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/table.cpp b/c_glib/arrow-glib/table.cpp
new file mode 100644
index 0000000..2410e76
--- /dev/null
+++ b/c_glib/arrow-glib/table.cpp
@@ -0,0 +1,240 @@
+/*
+ * 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/column.hpp>
+#include <arrow-glib/schema.hpp>
+#include <arrow-glib/table.hpp>
+
+G_BEGIN_DECLS
+
+/**
+ * SECTION: table
+ * @short_description: Table class
+ *
+ * #GArrowTable is a class for table. Table has zero or more
+ * #GArrowColumns and zero or more records.
+ */
+
+typedef struct GArrowTablePrivate_ {
+ std::shared_ptr<arrow::Table> table;
+} GArrowTablePrivate;
+
+enum {
+ PROP_0,
+ PROP_TABLE
+};
+
+G_DEFINE_TYPE_WITH_PRIVATE(GArrowTable,
+ garrow_table,
+ G_TYPE_OBJECT)
+
+#define GARROW_TABLE_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE((obj), \
+ GARROW_TYPE_TABLE, \
+ GArrowTablePrivate))
+
+static void
+garrow_table_dispose(GObject *object)
+{
+ GArrowTablePrivate *priv;
+
+ priv = GARROW_TABLE_GET_PRIVATE(object);
+
+ priv->table = nullptr;
+
+ G_OBJECT_CLASS(garrow_table_parent_class)->dispose(object);
+}
+
+static void
+garrow_table_set_property(GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ GArrowTablePrivate *priv;
+
+ priv = GARROW_TABLE_GET_PRIVATE(object);
+
+ switch (prop_id) {
+ case PROP_TABLE:
+ priv->table =
+ *static_cast<std::shared_ptr<arrow::Table> *>(g_value_get_pointer(value));
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+ break;
+ }
+}
+
+static void
+garrow_table_get_property(GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ switch (prop_id) {
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+ break;
+ }
+}
+
+static void
+garrow_table_init(GArrowTable *object)
+{
+}
+
+static void
+garrow_table_class_init(GArrowTableClass *klass)
+{
+ GObjectClass *gobject_class;
+ GParamSpec *spec;
+
+ gobject_class = G_OBJECT_CLASS(klass);
+
+ gobject_class->dispose = garrow_table_dispose;
+ gobject_class->set_property = garrow_table_set_property;
+ gobject_class->get_property = garrow_table_get_property;
+
+ spec = g_param_spec_pointer("table",
+ "Table",
+ "The raw std::shared<arrow::Table> *",
+ static_cast<GParamFlags>(G_PARAM_WRITABLE |
+ G_PARAM_CONSTRUCT_ONLY));
+ g_object_class_install_property(gobject_class, PROP_TABLE, spec);
+}
+
+/**
+ * garrow_table_new:
+ * @name: The name of the table.
+ * @schema: The schema of the table.
+ * @columns: (element-type GArrowColumn): The columns of the table.
+ *
+ * Returns: A newly created #GArrowTable.
+ */
+GArrowTable *
+garrow_table_new(const gchar *name,
+ GArrowSchema *schema,
+ GList *columns)
+{
+ std::vector<std::shared_ptr<arrow::Column>> arrow_columns;
+ for (GList *node = columns; node; node = node->next) {
+ GArrowColumn *column = GARROW_COLUMN(node->data);
+ arrow_columns.push_back(garrow_column_get_raw(column));
+ }
+
+ auto arrow_table =
+ std::make_shared<arrow::Table>(name,
+ garrow_schema_get_raw(schema),
+ arrow_columns);
+ return garrow_table_new_raw(&arrow_table);
+}
+
+/**
+ * garrow_table_get_name:
+ * @table: A #GArrowTable.
+ *
+ * Returns: The name of the table.
+ */
+const gchar *
+garrow_table_get_name(GArrowTable *table)
+{
+ const auto arrow_table = garrow_table_get_raw(table);
+ return arrow_table->name().c_str();
+}
+
+/**
+ * garrow_table_get_schema:
+ * @table: A #GArrowTable.
+ *
+ * Returns: (transfer full): The schema of the table.
+ */
+GArrowSchema *
+garrow_table_get_schema(GArrowTable *table)
+{
+ const auto arrow_table = garrow_table_get_raw(table);
+ auto arrow_schema = arrow_table->schema();
+ return garrow_schema_new_raw(&arrow_schema);
+}
+
+/**
+ * garrow_table_get_column:
+ * @table: A #GArrowTable.
+ * @i: The index of the target column.
+ *
+ * Returns: (transfer full): The i-th column in the table.
+ */
+GArrowColumn *
+garrow_table_get_column(GArrowTable *table,
+ guint i)
+{
+ const auto arrow_table = garrow_table_get_raw(table);
+ auto arrow_column = arrow_table->column(i);
+ return garrow_column_new_raw(&arrow_column);
+}
+
+/**
+ * garrow_table_get_n_columns:
+ * @table: A #GArrowTable.
+ *
+ * Returns: The number of columns in the table.
+ */
+guint
+garrow_table_get_n_columns(GArrowTable *table)
+{
+ const auto arrow_table = garrow_table_get_raw(table);
+ return arrow_table->num_columns();
+}
+
+/**
+ * garrow_table_get_n_rows:
+ * @table: A #GArrowTable.
+ *
+ * Returns: The number of rows in the table.
+ */
+guint64
+garrow_table_get_n_rows(GArrowTable *table)
+{
+ const auto arrow_table = garrow_table_get_raw(table);
+ return arrow_table->num_rows();
+}
+
+G_END_DECLS
+
+GArrowTable *
+garrow_table_new_raw(std::shared_ptr<arrow::Table> *arrow_table)
+{
+ auto table = GARROW_TABLE(g_object_new(GARROW_TYPE_TABLE,
+ "table", arrow_table,
+ NULL));
+ return table;
+}
+
+std::shared_ptr<arrow::Table>
+garrow_table_get_raw(GArrowTable *table)
+{
+ GArrowTablePrivate *priv;
+
+ priv = GARROW_TABLE_GET_PRIVATE(table);
+ return priv->table;
+}
[5/9] arrow git commit: ARROW-631: [GLib] Import
Posted by we...@apache.org.
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/io-writeable-file.cpp
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/io-writeable-file.cpp b/c_glib/arrow-glib/io-writeable-file.cpp
new file mode 100644
index 0000000..3de42dd
--- /dev/null
+++ b/c_glib/arrow-glib/io-writeable-file.cpp
@@ -0,0 +1,84 @@
+/*
+ * 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/api.h>
+
+#include <arrow-glib/error.hpp>
+#include <arrow-glib/io-writeable-file.hpp>
+
+G_BEGIN_DECLS
+
+/**
+ * SECTION: io-writeable-file
+ * @title: GArrowIOWriteableFile
+ * @short_description: File output interface
+ *
+ * #GArrowIOWriteableFile is an interface for file output.
+ */
+
+G_DEFINE_INTERFACE(GArrowIOWriteableFile,
+ garrow_io_writeable_file,
+ G_TYPE_OBJECT)
+
+static void
+garrow_io_writeable_file_default_init (GArrowIOWriteableFileInterface *iface)
+{
+}
+
+/**
+ * garrow_io_writeable_file_write_at:
+ * @writeable_file: A #GArrowIOWriteableFile.
+ * @position: The write start position.
+ * @data: (array length=n_bytes): The data to be written.
+ * @n_bytes: The number of bytes to be written.
+ * @error: (nullable): Return location for a #GError or %NULL.
+ *
+ * Returns: %TRUE on success, %FALSE if there was an error.
+ */
+gboolean
+garrow_io_writeable_file_write_at(GArrowIOWriteableFile *writeable_file,
+ gint64 position,
+ const guint8 *data,
+ gint64 n_bytes,
+ GError **error)
+{
+ const auto arrow_writeable_file =
+ garrow_io_writeable_file_get_raw(writeable_file);
+
+ auto status = arrow_writeable_file->WriteAt(position, data, n_bytes);
+ if (status.ok()) {
+ return TRUE;
+ } else {
+ garrow_error_set(error, status, "[io][writeable-file][write-at]");
+ return FALSE;
+ }
+}
+
+G_END_DECLS
+
+std::shared_ptr<arrow::io::WriteableFileInterface>
+garrow_io_writeable_file_get_raw(GArrowIOWriteableFile *writeable_file)
+{
+ auto *iface = GARROW_IO_WRITEABLE_FILE_GET_IFACE(writeable_file);
+ return iface->get_raw(writeable_file);
+}
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/io-writeable-file.h
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/io-writeable-file.h b/c_glib/arrow-glib/io-writeable-file.h
new file mode 100644
index 0000000..4a4dee5
--- /dev/null
+++ b/c_glib/arrow-glib/io-writeable-file.h
@@ -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.
+ */
+
+#pragma once
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+#define GARROW_IO_TYPE_WRITEABLE_FILE \
+ (garrow_io_writeable_file_get_type())
+#define GARROW_IO_WRITEABLE_FILE(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj), \
+ GARROW_IO_TYPE_WRITEABLE_FILE, \
+ GArrowIOWriteableFileInterface))
+#define GARROW_IO_IS_WRITEABLE_FILE(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj), \
+ GARROW_IO_TYPE_WRITEABLE_FILE))
+#define GARROW_IO_WRITEABLE_FILE_GET_IFACE(obj) \
+ (G_TYPE_INSTANCE_GET_INTERFACE((obj), \
+ GARROW_IO_TYPE_WRITEABLE_FILE, \
+ GArrowIOWriteableFileInterface))
+
+typedef struct _GArrowIOWriteableFile GArrowIOWriteableFile;
+typedef struct _GArrowIOWriteableFileInterface GArrowIOWriteableFileInterface;
+
+GType garrow_io_writeable_file_get_type(void) G_GNUC_CONST;
+
+gboolean garrow_io_writeable_file_write_at(GArrowIOWriteableFile *writeable_file,
+ gint64 position,
+ const guint8 *data,
+ gint64 n_bytes,
+ GError **error);
+
+G_END_DECLS
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/io-writeable-file.hpp
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/io-writeable-file.hpp b/c_glib/arrow-glib/io-writeable-file.hpp
new file mode 100644
index 0000000..2043007
--- /dev/null
+++ b/c_glib/arrow-glib/io-writeable-file.hpp
@@ -0,0 +1,38 @@
+/*
+ * 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/io/interfaces.h>
+
+#include <arrow-glib/io-writeable-file.h>
+
+/**
+ * GArrowIOWriteableFileInterface:
+ *
+ * It wraps `arrow::io::WriteableFileInterface`.
+ */
+struct _GArrowIOWriteableFileInterface
+{
+ GTypeInterface parent_iface;
+
+ std::shared_ptr<arrow::io::WriteableFileInterface> (*get_raw)(GArrowIOWriteableFile *file);
+};
+
+std::shared_ptr<arrow::io::WriteableFileInterface> garrow_io_writeable_file_get_raw(GArrowIOWriteableFile *writeable_file);
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/io-writeable.cpp
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/io-writeable.cpp b/c_glib/arrow-glib/io-writeable.cpp
new file mode 100644
index 0000000..9ea69e3
--- /dev/null
+++ b/c_glib/arrow-glib/io-writeable.cpp
@@ -0,0 +1,106 @@
+/*
+ * 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/api.h>
+
+#include <arrow-glib/error.hpp>
+#include <arrow-glib/io-writeable.hpp>
+
+G_BEGIN_DECLS
+
+/**
+ * SECTION: io-writeable
+ * @title: GArrowIOWriteable
+ * @short_description: Output interface
+ *
+ * #GArrowIOWriteable is an interface for output. Output must be
+ * writeable.
+ */
+
+G_DEFINE_INTERFACE(GArrowIOWriteable,
+ garrow_io_writeable,
+ G_TYPE_OBJECT)
+
+static void
+garrow_io_writeable_default_init (GArrowIOWriteableInterface *iface)
+{
+}
+
+/**
+ * garrow_io_writeable_write:
+ * @writeable: A #GArrowIOWriteable.
+ * @data: (array length=n_bytes): The data to be written.
+ * @n_bytes: The number of bytes to be written.
+ * @error: (nullable): Return location for a #GError or %NULL.
+ *
+ * Returns: %TRUE on success, %FALSE if there was an error.
+ */
+gboolean
+garrow_io_writeable_write(GArrowIOWriteable *writeable,
+ const guint8 *data,
+ gint64 n_bytes,
+ GError **error)
+{
+ const auto arrow_writeable = garrow_io_writeable_get_raw(writeable);
+
+ auto status = arrow_writeable->Write(data, n_bytes);
+ if (status.ok()) {
+ return TRUE;
+ } else {
+ garrow_error_set(error, status, "[io][writeable][write]");
+ return FALSE;
+ }
+}
+
+/**
+ * garrow_io_writeable_flush:
+ * @writeable: A #GArrowIOWriteable.
+ * @error: (nullable): Return location for a #GError or %NULL.
+ *
+ * It ensures writing all data on memory to storage.
+ *
+ * Returns: %TRUE on success, %FALSE if there was an error.
+ */
+gboolean
+garrow_io_writeable_flush(GArrowIOWriteable *writeable,
+ GError **error)
+{
+ const auto arrow_writeable = garrow_io_writeable_get_raw(writeable);
+
+ auto status = arrow_writeable->Flush();
+ if (status.ok()) {
+ return TRUE;
+ } else {
+ garrow_error_set(error, status, "[io][writeable][flush]");
+ return FALSE;
+ }
+}
+
+G_END_DECLS
+
+std::shared_ptr<arrow::io::Writeable>
+garrow_io_writeable_get_raw(GArrowIOWriteable *writeable)
+{
+ auto *iface = GARROW_IO_WRITEABLE_GET_IFACE(writeable);
+ return iface->get_raw(writeable);
+}
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/io-writeable.h
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/io-writeable.h b/c_glib/arrow-glib/io-writeable.h
new file mode 100644
index 0000000..f5c5e91
--- /dev/null
+++ b/c_glib/arrow-glib/io-writeable.h
@@ -0,0 +1,52 @@
+/*
+ * 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 <glib-object.h>
+
+G_BEGIN_DECLS
+
+#define GARROW_IO_TYPE_WRITEABLE \
+ (garrow_io_writeable_get_type())
+#define GARROW_IO_WRITEABLE(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj), \
+ GARROW_IO_TYPE_WRITEABLE, \
+ GArrowIOWriteableInterface))
+#define GARROW_IO_IS_WRITEABLE(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj), \
+ GARROW_IO_TYPE_WRITEABLE))
+#define GARROW_IO_WRITEABLE_GET_IFACE(obj) \
+ (G_TYPE_INSTANCE_GET_INTERFACE((obj), \
+ GARROW_IO_TYPE_WRITEABLE, \
+ GArrowIOWriteableInterface))
+
+typedef struct _GArrowIOWriteable GArrowIOWriteable;
+typedef struct _GArrowIOWriteableInterface GArrowIOWriteableInterface;
+
+GType garrow_io_writeable_get_type(void) G_GNUC_CONST;
+
+gboolean garrow_io_writeable_write(GArrowIOWriteable *writeable,
+ const guint8 *data,
+ gint64 n_bytes,
+ GError **error);
+gboolean garrow_io_writeable_flush(GArrowIOWriteable *writeable,
+ GError **error);
+
+G_END_DECLS
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/io-writeable.hpp
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/io-writeable.hpp b/c_glib/arrow-glib/io-writeable.hpp
new file mode 100644
index 0000000..f833924
--- /dev/null
+++ b/c_glib/arrow-glib/io-writeable.hpp
@@ -0,0 +1,38 @@
+/*
+ * 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/io/interfaces.h>
+
+#include <arrow-glib/io-writeable.h>
+
+/**
+ * GArrowIOWriteableInterface:
+ *
+ * It wraps `arrow::io::Writeable`.
+ */
+struct _GArrowIOWriteableInterface
+{
+ GTypeInterface parent_iface;
+
+ std::shared_ptr<arrow::io::Writeable> (*get_raw)(GArrowIOWriteable *file);
+};
+
+std::shared_ptr<arrow::io::Writeable> garrow_io_writeable_get_raw(GArrowIOWriteable *writeable);
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/ipc-enums.c.template
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/ipc-enums.c.template b/c_glib/arrow-glib/ipc-enums.c.template
new file mode 100644
index 0000000..c938f77
--- /dev/null
+++ b/c_glib/arrow-glib/ipc-enums.c.template
@@ -0,0 +1,56 @@
+/*** BEGIN file-header ***/
+/*
+ * 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/arrow-ipc-glib.h>
+/*** END file-header ***/
+
+/*** BEGIN file-production ***/
+
+/* enumerations from "@filename@" */
+/*** END file-production ***/
+
+/*** BEGIN value-header ***/
+GType
+@enum_name@_get_type(void)
+{
+ static GType etype = 0;
+ if (G_UNLIKELY(etype == 0)) {
+ static const G@Type@Value values[] = {
+/*** END value-header ***/
+
+/*** BEGIN value-production ***/
+ {@VALUENAME@, "@VALUENAME@", "@valuenick@"},
+/*** END value-production ***/
+
+/*** BEGIN value-tail ***/
+ {0, NULL, NULL}
+ };
+ etype = g_@type@_register_static(g_intern_static_string("@EnumName@"), values);
+ }
+ return etype;
+}
+/*** END value-tail ***/
+
+/*** BEGIN file-tail ***/
+/*** END file-tail ***/
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/ipc-enums.h.template
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/ipc-enums.h.template b/c_glib/arrow-glib/ipc-enums.h.template
new file mode 100644
index 0000000..e103c5b
--- /dev/null
+++ b/c_glib/arrow-glib/ipc-enums.h.template
@@ -0,0 +1,41 @@
+/*** BEGIN file-header ***/
+/*
+ * 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/ipc-metadata-version.h>
+
+G_BEGIN_DECLS
+/*** END file-header ***/
+
+/*** BEGIN file-production ***/
+
+/* enumerations from "@filename@" */
+/*** END file-production ***/
+
+/*** BEGIN value-header ***/
+GType @enum_name@_get_type(void) G_GNUC_CONST;
+#define @ENUMPREFIX@_TYPE_@ENUMSHORT@ (@enum_name@_get_type())
+/*** END value-header ***/
+
+/*** BEGIN file-tail ***/
+
+G_END_DECLS
+/*** END file-tail ***/
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/ipc-file-reader.cpp
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/ipc-file-reader.cpp b/c_glib/arrow-glib/ipc-file-reader.cpp
new file mode 100644
index 0000000..b9e408c
--- /dev/null
+++ b/c_glib/arrow-glib/ipc-file-reader.cpp
@@ -0,0 +1,247 @@
+/*
+ * 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/ipc/api.h>
+
+#include <arrow-glib/error.hpp>
+#include <arrow-glib/record-batch.hpp>
+#include <arrow-glib/schema.hpp>
+
+#include <arrow-glib/io-readable-file.hpp>
+
+#include <arrow-glib/ipc-file-reader.hpp>
+#include <arrow-glib/ipc-metadata-version.hpp>
+
+G_BEGIN_DECLS
+
+/**
+ * SECTION: ipc-file-reader
+ * @short_description: File reader class
+ *
+ * #GArrowIPCFileReader is a class for receiving data by file based IPC.
+ */
+
+typedef struct GArrowIPCFileReaderPrivate_ {
+ std::shared_ptr<arrow::ipc::FileReader> file_reader;
+} GArrowIPCFileReaderPrivate;
+
+enum {
+ PROP_0,
+ PROP_FILE_READER
+};
+
+G_DEFINE_TYPE_WITH_PRIVATE(GArrowIPCFileReader,
+ garrow_ipc_file_reader,
+ G_TYPE_OBJECT);
+
+#define GARROW_IPC_FILE_READER_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE((obj), \
+ GARROW_IPC_TYPE_FILE_READER, \
+ GArrowIPCFileReaderPrivate))
+
+static void
+garrow_ipc_file_reader_finalize(GObject *object)
+{
+ GArrowIPCFileReaderPrivate *priv;
+
+ priv = GARROW_IPC_FILE_READER_GET_PRIVATE(object);
+
+ priv->file_reader = nullptr;
+
+ G_OBJECT_CLASS(garrow_ipc_file_reader_parent_class)->finalize(object);
+}
+
+static void
+garrow_ipc_file_reader_set_property(GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ GArrowIPCFileReaderPrivate *priv;
+
+ priv = GARROW_IPC_FILE_READER_GET_PRIVATE(object);
+
+ switch (prop_id) {
+ case PROP_FILE_READER:
+ priv->file_reader =
+ *static_cast<std::shared_ptr<arrow::ipc::FileReader> *>(g_value_get_pointer(value));
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+ break;
+ }
+}
+
+static void
+garrow_ipc_file_reader_get_property(GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ switch (prop_id) {
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+ break;
+ }
+}
+
+static void
+garrow_ipc_file_reader_init(GArrowIPCFileReader *object)
+{
+}
+
+static void
+garrow_ipc_file_reader_class_init(GArrowIPCFileReaderClass *klass)
+{
+ GObjectClass *gobject_class;
+ GParamSpec *spec;
+
+ gobject_class = G_OBJECT_CLASS(klass);
+
+ gobject_class->finalize = garrow_ipc_file_reader_finalize;
+ gobject_class->set_property = garrow_ipc_file_reader_set_property;
+ gobject_class->get_property = garrow_ipc_file_reader_get_property;
+
+ spec = g_param_spec_pointer("file-reader",
+ "ipc::FileReader",
+ "The raw std::shared<arrow::ipc::FileReader> *",
+ static_cast<GParamFlags>(G_PARAM_WRITABLE |
+ G_PARAM_CONSTRUCT_ONLY));
+ g_object_class_install_property(gobject_class, PROP_FILE_READER, spec);
+}
+
+/**
+ * garrow_ipc_file_reader_open:
+ * @file: The file to be read.
+ * @error: (nullable): Return locatipcn for a #GError or %NULL.
+ *
+ * Returns: (nullable) (transfer full): A newly opened
+ * #GArrowIPCFileReader or %NULL on error.
+ */
+GArrowIPCFileReader *
+garrow_ipc_file_reader_open(GArrowIOReadableFile *file,
+ GError **error)
+{
+ std::shared_ptr<arrow::ipc::FileReader> arrow_file_reader;
+ auto status =
+ arrow::ipc::FileReader::Open(garrow_io_readable_file_get_raw(file),
+ &arrow_file_reader);
+ if (status.ok()) {
+ return garrow_ipc_file_reader_new_raw(&arrow_file_reader);
+ } else {
+ garrow_error_set(error, status, "[ipc][file-reader][open]");
+ return NULL;
+ }
+}
+
+/**
+ * garrow_ipc_file_reader_get_schema:
+ * @file_reader: A #GArrowIPCFileReader.
+ *
+ * Returns: (transfer full): The schema in the file.
+ */
+GArrowSchema *
+garrow_ipc_file_reader_get_schema(GArrowIPCFileReader *file_reader)
+{
+ auto arrow_file_reader =
+ garrow_ipc_file_reader_get_raw(file_reader);
+ auto arrow_schema = arrow_file_reader->schema();
+ return garrow_schema_new_raw(&arrow_schema);
+}
+
+/**
+ * garrow_ipc_file_reader_get_n_record_batches:
+ * @file_reader: A #GArrowIPCFileReader.
+ *
+ * Returns: The number of record batches in the file.
+ */
+guint
+garrow_ipc_file_reader_get_n_record_batches(GArrowIPCFileReader *file_reader)
+{
+ auto arrow_file_reader =
+ garrow_ipc_file_reader_get_raw(file_reader);
+ return arrow_file_reader->num_record_batches();
+}
+
+/**
+ * garrow_ipc_file_reader_get_version:
+ * @file_reader: A #GArrowIPCFileReader.
+ *
+ * Returns: The format version in the file.
+ */
+GArrowIPCMetadataVersion
+garrow_ipc_file_reader_get_version(GArrowIPCFileReader *file_reader)
+{
+ auto arrow_file_reader =
+ garrow_ipc_file_reader_get_raw(file_reader);
+ auto arrow_version = arrow_file_reader->version();
+ return garrow_ipc_metadata_version_from_raw(arrow_version);
+}
+
+/**
+ * garrow_ipc_file_reader_get_record_batch:
+ * @file_reader: A #GArrowIPCFileReader.
+ * @i: The index of the target record batch.
+ * @error: (nullable): Return locatipcn for a #GError or %NULL.
+ *
+ * Returns: (nullable) (transfer full):
+ * The i-th record batch in the file or %NULL on error.
+ */
+GArrowRecordBatch *
+garrow_ipc_file_reader_get_record_batch(GArrowIPCFileReader *file_reader,
+ guint i,
+ GError **error)
+{
+ auto arrow_file_reader =
+ garrow_ipc_file_reader_get_raw(file_reader);
+ std::shared_ptr<arrow::RecordBatch> arrow_record_batch;
+ auto status = arrow_file_reader->GetRecordBatch(i, &arrow_record_batch);
+
+ if (status.ok()) {
+ return garrow_record_batch_new_raw(&arrow_record_batch);
+ } else {
+ garrow_error_set(error, status, "[ipc][file-reader][get-record-batch]");
+ return NULL;
+ }
+}
+
+G_END_DECLS
+
+GArrowIPCFileReader *
+garrow_ipc_file_reader_new_raw(std::shared_ptr<arrow::ipc::FileReader> *arrow_file_reader)
+{
+ auto file_reader =
+ GARROW_IPC_FILE_READER(g_object_new(GARROW_IPC_TYPE_FILE_READER,
+ "file-reader", arrow_file_reader,
+ NULL));
+ return file_reader;
+}
+
+std::shared_ptr<arrow::ipc::FileReader>
+garrow_ipc_file_reader_get_raw(GArrowIPCFileReader *file_reader)
+{
+ GArrowIPCFileReaderPrivate *priv;
+
+ priv = GARROW_IPC_FILE_READER_GET_PRIVATE(file_reader);
+ return priv->file_reader;
+}
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/ipc-file-reader.h
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/ipc-file-reader.h b/c_glib/arrow-glib/ipc-file-reader.h
new file mode 100644
index 0000000..22915f8
--- /dev/null
+++ b/c_glib/arrow-glib/ipc-file-reader.h
@@ -0,0 +1,83 @@
+/*
+ * 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/record-batch.h>
+#include <arrow-glib/schema.h>
+
+#include <arrow-glib/io-readable-file.h>
+
+#include <arrow-glib/ipc-metadata-version.h>
+
+G_BEGIN_DECLS
+
+#define GARROW_IPC_TYPE_FILE_READER \
+ (garrow_ipc_file_reader_get_type())
+#define GARROW_IPC_FILE_READER(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj), \
+ GARROW_IPC_TYPE_FILE_READER, \
+ GArrowIPCFileReader))
+#define GARROW_IPC_FILE_READER_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST((klass), \
+ GARROW_IPC_TYPE_FILE_READER, \
+ GArrowIPCFileReaderClass))
+#define GARROW_IPC_IS_FILE_READER(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj), \
+ GARROW_IPC_TYPE_FILE_READER))
+#define GARROW_IPC_IS_FILE_READER_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE((klass), \
+ GARROW_IPC_TYPE_FILE_READER))
+#define GARROW_IPC_FILE_READER_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS((obj), \
+ GARROW_IPC_TYPE_FILE_READER, \
+ GArrowIPCFileReaderClass))
+
+typedef struct _GArrowIPCFileReader GArrowIPCFileReader;
+typedef struct _GArrowIPCFileReaderClass GArrowIPCFileReaderClass;
+
+/**
+ * GArrowIPCFileReader:
+ *
+ * It wraps `arrow::ipc::FileReader`.
+ */
+struct _GArrowIPCFileReader
+{
+ /*< private >*/
+ GObject parent_instance;
+};
+
+struct _GArrowIPCFileReaderClass
+{
+ GObjectClass parent_class;
+};
+
+GType garrow_ipc_file_reader_get_type(void) G_GNUC_CONST;
+
+GArrowIPCFileReader *garrow_ipc_file_reader_open(GArrowIOReadableFile *file,
+ GError **error);
+
+GArrowSchema *garrow_ipc_file_reader_get_schema(GArrowIPCFileReader *file_reader);
+guint garrow_ipc_file_reader_get_n_record_batches(GArrowIPCFileReader *file_reader);
+GArrowIPCMetadataVersion garrow_ipc_file_reader_get_version(GArrowIPCFileReader *file_reader);
+GArrowRecordBatch *garrow_ipc_file_reader_get_record_batch(GArrowIPCFileReader *file_reader,
+ guint i,
+ GError **error);
+
+G_END_DECLS
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/ipc-file-reader.hpp
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/ipc-file-reader.hpp b/c_glib/arrow-glib/ipc-file-reader.hpp
new file mode 100644
index 0000000..66cd45d
--- /dev/null
+++ b/c_glib/arrow-glib/ipc-file-reader.hpp
@@ -0,0 +1,28 @@
+/*
+ * 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/api.h>
+#include <arrow/ipc/api.h>
+
+#include <arrow-glib/ipc-file-reader.h>
+
+GArrowIPCFileReader *garrow_ipc_file_reader_new_raw(std::shared_ptr<arrow::ipc::FileReader> *arrow_file_reader);
+std::shared_ptr<arrow::ipc::FileReader> garrow_ipc_file_reader_get_raw(GArrowIPCFileReader *file_reader);
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/ipc-file-writer.cpp
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/ipc-file-writer.cpp b/c_glib/arrow-glib/ipc-file-writer.cpp
new file mode 100644
index 0000000..d8b3c2e
--- /dev/null
+++ b/c_glib/arrow-glib/ipc-file-writer.cpp
@@ -0,0 +1,158 @@
+/*
+ * 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/ipc/api.h>
+
+#include <arrow-glib/array.hpp>
+#include <arrow-glib/error.hpp>
+#include <arrow-glib/record-batch.hpp>
+#include <arrow-glib/schema.hpp>
+
+#include <arrow-glib/io-output-stream.hpp>
+
+#include <arrow-glib/ipc-stream-writer.hpp>
+#include <arrow-glib/ipc-file-writer.hpp>
+
+G_BEGIN_DECLS
+
+/**
+ * SECTION: ipc-file-writer
+ * @short_description: File writer class
+ *
+ * #GArrowIPCFileWriter is a class for sending data by file based IPC.
+ */
+
+G_DEFINE_TYPE(GArrowIPCFileWriter,
+ garrow_ipc_file_writer,
+ GARROW_IPC_TYPE_STREAM_WRITER);
+
+static void
+garrow_ipc_file_writer_init(GArrowIPCFileWriter *object)
+{
+}
+
+static void
+garrow_ipc_file_writer_class_init(GArrowIPCFileWriterClass *klass)
+{
+}
+
+/**
+ * garrow_ipc_file_writer_open:
+ * @sink: The output of the writer.
+ * @schema: The schema of the writer.
+ * @error: (nullable): Return locatipcn for a #GError or %NULL.
+ *
+ * Returns: (nullable) (transfer full): A newly opened
+ * #GArrowIPCFileWriter or %NULL on error.
+ */
+GArrowIPCFileWriter *
+garrow_ipc_file_writer_open(GArrowIOOutputStream *sink,
+ GArrowSchema *schema,
+ GError **error)
+{
+ std::shared_ptr<arrow::ipc::FileWriter> arrow_file_writer;
+ auto status =
+ arrow::ipc::FileWriter::Open(garrow_io_output_stream_get_raw(sink).get(),
+ garrow_schema_get_raw(schema),
+ &arrow_file_writer);
+ if (status.ok()) {
+ return garrow_ipc_file_writer_new_raw(&arrow_file_writer);
+ } else {
+ garrow_error_set(error, status, "[ipc][file-writer][open]");
+ return NULL;
+ }
+}
+
+/**
+ * garrow_ipc_file_writer_write_record_batch:
+ * @file_writer: A #GArrowIPCFileWriter.
+ * @record_batch: The record batch to be written.
+ * @error: (nullable): Return locatipcn for a #GError or %NULL.
+ *
+ * Returns: %TRUE on success, %FALSE if there was an error.
+ */
+gboolean
+garrow_ipc_file_writer_write_record_batch(GArrowIPCFileWriter *file_writer,
+ GArrowRecordBatch *record_batch,
+ GError **error)
+{
+ auto arrow_file_writer =
+ garrow_ipc_file_writer_get_raw(file_writer);
+ auto arrow_record_batch =
+ garrow_record_batch_get_raw(record_batch);
+ auto arrow_record_batch_raw =
+ arrow_record_batch.get();
+
+ auto status = arrow_file_writer->WriteRecordBatch(*arrow_record_batch_raw);
+ if (status.ok()) {
+ return TRUE;
+ } else {
+ garrow_error_set(error, status, "[ipc][file-writer][write-record-batch]");
+ return FALSE;
+ }
+}
+
+/**
+ * garrow_ipc_file_writer_close:
+ * @file_writer: A #GArrowIPCFileWriter.
+ * @error: (nullable): Return locatipcn for a #GError or %NULL.
+ *
+ * Returns: %TRUE on success, %FALSE if there was an error.
+ */
+gboolean
+garrow_ipc_file_writer_close(GArrowIPCFileWriter *file_writer,
+ GError **error)
+{
+ auto arrow_file_writer =
+ garrow_ipc_file_writer_get_raw(file_writer);
+
+ auto status = arrow_file_writer->Close();
+ if (status.ok()) {
+ return TRUE;
+ } else {
+ garrow_error_set(error, status, "[ipc][file-writer][close]");
+ return FALSE;
+ }
+}
+
+G_END_DECLS
+
+GArrowIPCFileWriter *
+garrow_ipc_file_writer_new_raw(std::shared_ptr<arrow::ipc::FileWriter> *arrow_file_writer)
+{
+ auto file_writer =
+ GARROW_IPC_FILE_WRITER(g_object_new(GARROW_IPC_TYPE_FILE_WRITER,
+ "stream-writer", arrow_file_writer,
+ NULL));
+ return file_writer;
+}
+
+arrow::ipc::FileWriter *
+garrow_ipc_file_writer_get_raw(GArrowIPCFileWriter *file_writer)
+{
+ auto arrow_stream_writer =
+ garrow_ipc_stream_writer_get_raw(GARROW_IPC_STREAM_WRITER(file_writer));
+ auto arrow_file_writer_raw =
+ dynamic_cast<arrow::ipc::FileWriter *>(arrow_stream_writer.get());
+ return arrow_file_writer_raw;
+}
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/ipc-file-writer.h
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/ipc-file-writer.h b/c_glib/arrow-glib/ipc-file-writer.h
new file mode 100644
index 0000000..732d942
--- /dev/null
+++ b/c_glib/arrow-glib/ipc-file-writer.h
@@ -0,0 +1,78 @@
+/*
+ * 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/ipc-stream-writer.h>
+
+G_BEGIN_DECLS
+
+#define GARROW_IPC_TYPE_FILE_WRITER \
+ (garrow_ipc_file_writer_get_type())
+#define GARROW_IPC_FILE_WRITER(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj), \
+ GARROW_IPC_TYPE_FILE_WRITER, \
+ GArrowIPCFileWriter))
+#define GARROW_IPC_FILE_WRITER_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST((klass), \
+ GARROW_IPC_TYPE_FILE_WRITER, \
+ GArrowIPCFileWriterClass))
+#define GARROW_IPC_IS_FILE_WRITER(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj), \
+ GARROW_IPC_TYPE_FILE_WRITER))
+#define GARROW_IPC_IS_FILE_WRITER_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE((klass), \
+ GARROW_IPC_TYPE_FILE_WRITER))
+#define GARROW_IPC_FILE_WRITER_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS((obj), \
+ GARROW_IPC_TYPE_FILE_WRITER, \
+ GArrowIPCFileWriterClass))
+
+typedef struct _GArrowIPCFileWriter GArrowIPCFileWriter;
+typedef struct _GArrowIPCFileWriterClass GArrowIPCFileWriterClass;
+
+/**
+ * GArrowIPCFileWriter:
+ *
+ * It wraps `arrow::ipc::FileWriter`.
+ */
+struct _GArrowIPCFileWriter
+{
+ /*< private >*/
+ GArrowIPCStreamWriter parent_instance;
+};
+
+struct _GArrowIPCFileWriterClass
+{
+ GObjectClass parent_class;
+};
+
+GType garrow_ipc_file_writer_get_type(void) G_GNUC_CONST;
+
+GArrowIPCFileWriter *garrow_ipc_file_writer_open(GArrowIOOutputStream *sink,
+ GArrowSchema *schema,
+ GError **error);
+
+gboolean garrow_ipc_file_writer_write_record_batch(GArrowIPCFileWriter *file_writer,
+ GArrowRecordBatch *record_batch,
+ GError **error);
+gboolean garrow_ipc_file_writer_close(GArrowIPCFileWriter *file_writer,
+ GError **error);
+
+G_END_DECLS
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/ipc-file-writer.hpp
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/ipc-file-writer.hpp b/c_glib/arrow-glib/ipc-file-writer.hpp
new file mode 100644
index 0000000..b8ae113
--- /dev/null
+++ b/c_glib/arrow-glib/ipc-file-writer.hpp
@@ -0,0 +1,28 @@
+/*
+ * 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/api.h>
+#include <arrow/ipc/api.h>
+
+#include <arrow-glib/ipc-file-writer.h>
+
+GArrowIPCFileWriter *garrow_ipc_file_writer_new_raw(std::shared_ptr<arrow::ipc::FileWriter> *arrow_file_writer);
+arrow::ipc::FileWriter *garrow_ipc_file_writer_get_raw(GArrowIPCFileWriter *file_writer);
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/ipc-metadata-version.cpp
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/ipc-metadata-version.cpp b/c_glib/arrow-glib/ipc-metadata-version.cpp
new file mode 100644
index 0000000..c5cc8d3
--- /dev/null
+++ b/c_glib/arrow-glib/ipc-metadata-version.cpp
@@ -0,0 +1,59 @@
+/*
+ * 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/ipc-metadata-version.hpp>
+
+/**
+ * SECTION: ipc-metadata-version
+ * @title: GArrowIPCMetadataVersion
+ * @short_description: Metadata version mapgging between Arrow and arrow-glib
+ *
+ * #GArrowIPCMetadataVersion provides metadata versions corresponding
+ * to `arrow::ipc::MetadataVersion::type` values.
+ */
+
+GArrowIPCMetadataVersion
+garrow_ipc_metadata_version_from_raw(arrow::ipc::MetadataVersion::type version)
+{
+ switch (version) {
+ case arrow::ipc::MetadataVersion::type::V1:
+ return GARROW_IPC_METADATA_VERSION_V1;
+ case arrow::ipc::MetadataVersion::type::V2:
+ return GARROW_IPC_METADATA_VERSION_V2;
+ default:
+ return GARROW_IPC_METADATA_VERSION_V2;
+ }
+}
+
+arrow::ipc::MetadataVersion::type
+garrow_ipc_metadata_version_to_raw(GArrowIPCMetadataVersion version)
+{
+ switch (version) {
+ case GARROW_IPC_METADATA_VERSION_V1:
+ return arrow::ipc::MetadataVersion::type::V1;
+ case GARROW_IPC_METADATA_VERSION_V2:
+ return arrow::ipc::MetadataVersion::type::V2;
+ default:
+ return arrow::ipc::MetadataVersion::type::V2;
+ }
+}
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/ipc-metadata-version.h
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/ipc-metadata-version.h b/c_glib/arrow-glib/ipc-metadata-version.h
new file mode 100644
index 0000000..ccfd52a
--- /dev/null
+++ b/c_glib/arrow-glib/ipc-metadata-version.h
@@ -0,0 +1,39 @@
+/*
+ * 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 <glib-object.h>
+
+G_BEGIN_DECLS
+
+/**
+ * GArrowIPCMetadataVersion:
+ * @GARROW_IPC_METADATA_VERSION_V1: Version 1.
+ * @GARROW_IPC_METADATA_VERSION_V2: Version 2.
+ *
+ * They are corresponding to `arrow::ipc::MetadataVersion::type`
+ * values.
+ */
+typedef enum {
+ GARROW_IPC_METADATA_VERSION_V1,
+ GARROW_IPC_METADATA_VERSION_V2
+} GArrowIPCMetadataVersion;
+
+G_END_DECLS
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/ipc-metadata-version.hpp
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/ipc-metadata-version.hpp b/c_glib/arrow-glib/ipc-metadata-version.hpp
new file mode 100644
index 0000000..2a7e8cf
--- /dev/null
+++ b/c_glib/arrow-glib/ipc-metadata-version.hpp
@@ -0,0 +1,27 @@
+/*
+ * 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/ipc/api.h>
+
+#include <arrow-glib/ipc-metadata-version.h>
+
+GArrowIPCMetadataVersion garrow_ipc_metadata_version_from_raw(arrow::ipc::MetadataVersion::type version);
+arrow::ipc::MetadataVersion::type garrow_ipc_metadata_version_to_raw(GArrowIPCMetadataVersion version);
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/ipc-stream-reader.cpp
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/ipc-stream-reader.cpp b/c_glib/arrow-glib/ipc-stream-reader.cpp
new file mode 100644
index 0000000..4804784
--- /dev/null
+++ b/c_glib/arrow-glib/ipc-stream-reader.cpp
@@ -0,0 +1,221 @@
+/*
+ * 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/ipc/api.h>
+
+#include <arrow-glib/error.hpp>
+#include <arrow-glib/record-batch.hpp>
+#include <arrow-glib/schema.hpp>
+
+#include <arrow-glib/io-input-stream.hpp>
+
+#include <arrow-glib/ipc-metadata-version.hpp>
+#include <arrow-glib/ipc-stream-reader.hpp>
+
+G_BEGIN_DECLS
+
+/**
+ * SECTION: ipc-stream-reader
+ * @short_description: Stream reader class
+ *
+ * #GArrowIPCStreamReader is a class for receiving data by stream
+ * based IPC.
+ */
+
+typedef struct GArrowIPCStreamReaderPrivate_ {
+ std::shared_ptr<arrow::ipc::StreamReader> stream_reader;
+} GArrowIPCStreamReaderPrivate;
+
+enum {
+ PROP_0,
+ PROP_STREAM_READER
+};
+
+G_DEFINE_TYPE_WITH_PRIVATE(GArrowIPCStreamReader,
+ garrow_ipc_stream_reader,
+ G_TYPE_OBJECT);
+
+#define GARROW_IPC_STREAM_READER_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE((obj), \
+ GARROW_IPC_TYPE_STREAM_READER, \
+ GArrowIPCStreamReaderPrivate))
+
+static void
+garrow_ipc_stream_reader_finalize(GObject *object)
+{
+ GArrowIPCStreamReaderPrivate *priv;
+
+ priv = GARROW_IPC_STREAM_READER_GET_PRIVATE(object);
+
+ priv->stream_reader = nullptr;
+
+ G_OBJECT_CLASS(garrow_ipc_stream_reader_parent_class)->finalize(object);
+}
+
+static void
+garrow_ipc_stream_reader_set_property(GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ GArrowIPCStreamReaderPrivate *priv;
+
+ priv = GARROW_IPC_STREAM_READER_GET_PRIVATE(object);
+
+ switch (prop_id) {
+ case PROP_STREAM_READER:
+ priv->stream_reader =
+ *static_cast<std::shared_ptr<arrow::ipc::StreamReader> *>(g_value_get_pointer(value));
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+ break;
+ }
+}
+
+static void
+garrow_ipc_stream_reader_get_property(GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ switch (prop_id) {
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+ break;
+ }
+}
+
+static void
+garrow_ipc_stream_reader_init(GArrowIPCStreamReader *object)
+{
+}
+
+static void
+garrow_ipc_stream_reader_class_init(GArrowIPCStreamReaderClass *klass)
+{
+ GObjectClass *gobject_class;
+ GParamSpec *spec;
+
+ gobject_class = G_OBJECT_CLASS(klass);
+
+ gobject_class->finalize = garrow_ipc_stream_reader_finalize;
+ gobject_class->set_property = garrow_ipc_stream_reader_set_property;
+ gobject_class->get_property = garrow_ipc_stream_reader_get_property;
+
+ spec = g_param_spec_pointer("stream-reader",
+ "ipc::StreamReader",
+ "The raw std::shared<arrow::ipc::StreamReader> *",
+ static_cast<GParamFlags>(G_PARAM_WRITABLE |
+ G_PARAM_CONSTRUCT_ONLY));
+ g_object_class_install_property(gobject_class, PROP_STREAM_READER, spec);
+}
+
+/**
+ * garrow_ipc_stream_reader_open:
+ * @stream: The stream to be read.
+ * @error: (nullable): Return locatipcn for a #GError or %NULL.
+ *
+ * Returns: (nullable) (transfer full): A newly opened
+ * #GArrowIPCStreamReader or %NULL on error.
+ */
+GArrowIPCStreamReader *
+garrow_ipc_stream_reader_open(GArrowIOInputStream *stream,
+ GError **error)
+{
+ std::shared_ptr<arrow::ipc::StreamReader> arrow_stream_reader;
+ auto status =
+ arrow::ipc::StreamReader::Open(garrow_io_input_stream_get_raw(stream),
+ &arrow_stream_reader);
+ if (status.ok()) {
+ return garrow_ipc_stream_reader_new_raw(&arrow_stream_reader);
+ } else {
+ garrow_error_set(error, status, "[ipc][stream-reader][open]");
+ return NULL;
+ }
+}
+
+/**
+ * garrow_ipc_stream_reader_get_schema:
+ * @stream_reader: A #GArrowIPCStreamReader.
+ *
+ * Returns: (transfer full): The schema in the stream.
+ */
+GArrowSchema *
+garrow_ipc_stream_reader_get_schema(GArrowIPCStreamReader *stream_reader)
+{
+ auto arrow_stream_reader =
+ garrow_ipc_stream_reader_get_raw(stream_reader);
+ auto arrow_schema = arrow_stream_reader->schema();
+ return garrow_schema_new_raw(&arrow_schema);
+}
+
+/**
+ * garrow_ipc_stream_reader_get_next_record_batch:
+ * @stream_reader: A #GArrowIPCStreamReader.
+ * @error: (nullable): Return locatipcn for a #GError or %NULL.
+ *
+ * Returns: (nullable) (transfer full):
+ * The next record batch in the stream or %NULL on end of stream.
+ */
+GArrowRecordBatch *
+garrow_ipc_stream_reader_get_next_record_batch(GArrowIPCStreamReader *stream_reader,
+ GError **error)
+{
+ auto arrow_stream_reader =
+ garrow_ipc_stream_reader_get_raw(stream_reader);
+ std::shared_ptr<arrow::RecordBatch> arrow_record_batch;
+ auto status = arrow_stream_reader->GetNextRecordBatch(&arrow_record_batch);
+
+ if (status.ok()) {
+ if (arrow_record_batch == nullptr) {
+ return NULL;
+ } else {
+ return garrow_record_batch_new_raw(&arrow_record_batch);
+ }
+ } else {
+ garrow_error_set(error, status, "[ipc][stream-reader][get-next-record-batch]");
+ return NULL;
+ }
+}
+
+G_END_DECLS
+
+GArrowIPCStreamReader *
+garrow_ipc_stream_reader_new_raw(std::shared_ptr<arrow::ipc::StreamReader> *arrow_stream_reader)
+{
+ auto stream_reader =
+ GARROW_IPC_STREAM_READER(g_object_new(GARROW_IPC_TYPE_STREAM_READER,
+ "stream-reader", arrow_stream_reader,
+ NULL));
+ return stream_reader;
+}
+
+std::shared_ptr<arrow::ipc::StreamReader>
+garrow_ipc_stream_reader_get_raw(GArrowIPCStreamReader *stream_reader)
+{
+ GArrowIPCStreamReaderPrivate *priv;
+
+ priv = GARROW_IPC_STREAM_READER_GET_PRIVATE(stream_reader);
+ return priv->stream_reader;
+}
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/ipc-stream-reader.h
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/ipc-stream-reader.h b/c_glib/arrow-glib/ipc-stream-reader.h
new file mode 100644
index 0000000..993cd85
--- /dev/null
+++ b/c_glib/arrow-glib/ipc-stream-reader.h
@@ -0,0 +1,80 @@
+/*
+ * 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/record-batch.h>
+#include <arrow-glib/schema.h>
+
+#include <arrow-glib/io-input-stream.h>
+
+#include <arrow-glib/ipc-metadata-version.h>
+
+G_BEGIN_DECLS
+
+#define GARROW_IPC_TYPE_STREAM_READER \
+ (garrow_ipc_stream_reader_get_type())
+#define GARROW_IPC_STREAM_READER(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj), \
+ GARROW_IPC_TYPE_STREAM_READER, \
+ GArrowIPCStreamReader))
+#define GARROW_IPC_STREAM_READER_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST((klass), \
+ GARROW_IPC_TYPE_STREAM_READER, \
+ GArrowIPCStreamReaderClass))
+#define GARROW_IPC_IS_STREAM_READER(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj), \
+ GARROW_IPC_TYPE_STREAM_READER))
+#define GARROW_IPC_IS_STREAM_READER_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE((klass), \
+ GARROW_IPC_TYPE_STREAM_READER))
+#define GARROW_IPC_STREAM_READER_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS((obj), \
+ GARROW_IPC_TYPE_STREAM_READER, \
+ GArrowIPCStreamReaderClass))
+
+typedef struct _GArrowIPCStreamReader GArrowIPCStreamReader;
+typedef struct _GArrowIPCStreamReaderClass GArrowIPCStreamReaderClass;
+
+/**
+ * GArrowIPCStreamReader:
+ *
+ * It wraps `arrow::ipc::StreamReader`.
+ */
+struct _GArrowIPCStreamReader
+{
+ /*< private >*/
+ GObject parent_instance;
+};
+
+struct _GArrowIPCStreamReaderClass
+{
+ GObjectClass parent_class;
+};
+
+GType garrow_ipc_stream_reader_get_type(void) G_GNUC_CONST;
+
+GArrowIPCStreamReader *garrow_ipc_stream_reader_open(GArrowIOInputStream *stream,
+ GError **error);
+
+GArrowSchema *garrow_ipc_stream_reader_get_schema(GArrowIPCStreamReader *stream_reader);
+GArrowRecordBatch *garrow_ipc_stream_reader_get_next_record_batch(GArrowIPCStreamReader *stream_reader,
+ GError **error);
+
+G_END_DECLS
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/ipc-stream-reader.hpp
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/ipc-stream-reader.hpp b/c_glib/arrow-glib/ipc-stream-reader.hpp
new file mode 100644
index 0000000..a35bdab
--- /dev/null
+++ b/c_glib/arrow-glib/ipc-stream-reader.hpp
@@ -0,0 +1,28 @@
+/*
+ * 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/api.h>
+#include <arrow/ipc/api.h>
+
+#include <arrow-glib/ipc-stream-reader.h>
+
+GArrowIPCStreamReader *garrow_ipc_stream_reader_new_raw(std::shared_ptr<arrow::ipc::StreamReader> *arrow_stream_reader);
+std::shared_ptr<arrow::ipc::StreamReader> garrow_ipc_stream_reader_get_raw(GArrowIPCStreamReader *stream_reader);
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/ipc-stream-writer.cpp
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/ipc-stream-writer.cpp b/c_glib/arrow-glib/ipc-stream-writer.cpp
new file mode 100644
index 0000000..e2455a4
--- /dev/null
+++ b/c_glib/arrow-glib/ipc-stream-writer.cpp
@@ -0,0 +1,232 @@
+/*
+ * 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/ipc/api.h>
+
+#include <arrow-glib/array.hpp>
+#include <arrow-glib/error.hpp>
+#include <arrow-glib/record-batch.hpp>
+#include <arrow-glib/schema.hpp>
+
+#include <arrow-glib/io-output-stream.hpp>
+
+#include <arrow-glib/ipc-stream-writer.hpp>
+
+G_BEGIN_DECLS
+
+/**
+ * SECTION: ipc-stream-writer
+ * @short_description: Stream writer class
+ *
+ * #GArrowIPCStreamWriter is a class for sending data by stream based
+ * IPC.
+ */
+
+typedef struct GArrowIPCStreamWriterPrivate_ {
+ std::shared_ptr<arrow::ipc::StreamWriter> stream_writer;
+} GArrowIPCStreamWriterPrivate;
+
+enum {
+ PROP_0,
+ PROP_STREAM_WRITER
+};
+
+G_DEFINE_TYPE_WITH_PRIVATE(GArrowIPCStreamWriter,
+ garrow_ipc_stream_writer,
+ G_TYPE_OBJECT);
+
+#define GARROW_IPC_STREAM_WRITER_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE((obj), \
+ GARROW_IPC_TYPE_STREAM_WRITER, \
+ GArrowIPCStreamWriterPrivate))
+
+static void
+garrow_ipc_stream_writer_finalize(GObject *object)
+{
+ GArrowIPCStreamWriterPrivate *priv;
+
+ priv = GARROW_IPC_STREAM_WRITER_GET_PRIVATE(object);
+
+ priv->stream_writer = nullptr;
+
+ G_OBJECT_CLASS(garrow_ipc_stream_writer_parent_class)->finalize(object);
+}
+
+static void
+garrow_ipc_stream_writer_set_property(GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ GArrowIPCStreamWriterPrivate *priv;
+
+ priv = GARROW_IPC_STREAM_WRITER_GET_PRIVATE(object);
+
+ switch (prop_id) {
+ case PROP_STREAM_WRITER:
+ priv->stream_writer =
+ *static_cast<std::shared_ptr<arrow::ipc::StreamWriter> *>(g_value_get_pointer(value));
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+ break;
+ }
+}
+
+static void
+garrow_ipc_stream_writer_get_property(GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ switch (prop_id) {
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+ break;
+ }
+}
+
+static void
+garrow_ipc_stream_writer_init(GArrowIPCStreamWriter *object)
+{
+}
+
+static void
+garrow_ipc_stream_writer_class_init(GArrowIPCStreamWriterClass *klass)
+{
+ GObjectClass *gobject_class;
+ GParamSpec *spec;
+
+ gobject_class = G_OBJECT_CLASS(klass);
+
+ gobject_class->finalize = garrow_ipc_stream_writer_finalize;
+ gobject_class->set_property = garrow_ipc_stream_writer_set_property;
+ gobject_class->get_property = garrow_ipc_stream_writer_get_property;
+
+ spec = g_param_spec_pointer("stream-writer",
+ "ipc::StreamWriter",
+ "The raw std::shared<arrow::ipc::StreamWriter> *",
+ static_cast<GParamFlags>(G_PARAM_WRITABLE |
+ G_PARAM_CONSTRUCT_ONLY));
+ g_object_class_install_property(gobject_class, PROP_STREAM_WRITER, spec);
+}
+
+/**
+ * garrow_ipc_stream_writer_open:
+ * @sink: The output of the writer.
+ * @schema: The schema of the writer.
+ * @error: (nullable): Return locatipcn for a #GError or %NULL.
+ *
+ * Returns: (nullable) (transfer full): A newly opened
+ * #GArrowIPCStreamWriter or %NULL on error.
+ */
+GArrowIPCStreamWriter *
+garrow_ipc_stream_writer_open(GArrowIOOutputStream *sink,
+ GArrowSchema *schema,
+ GError **error)
+{
+ std::shared_ptr<arrow::ipc::StreamWriter> arrow_stream_writer;
+ auto status =
+ arrow::ipc::StreamWriter::Open(garrow_io_output_stream_get_raw(sink).get(),
+ garrow_schema_get_raw(schema),
+ &arrow_stream_writer);
+ if (status.ok()) {
+ return garrow_ipc_stream_writer_new_raw(&arrow_stream_writer);
+ } else {
+ garrow_error_set(error, status, "[ipc][stream-writer][open]");
+ return NULL;
+ }
+}
+
+/**
+ * garrow_ipc_stream_writer_write_record_batch:
+ * @stream_writer: A #GArrowIPCStreamWriter.
+ * @record_batch: The record batch to be written.
+ * @error: (nullable): Return locatipcn for a #GError or %NULL.
+ *
+ * Returns: %TRUE on success, %FALSE if there was an error.
+ */
+gboolean
+garrow_ipc_stream_writer_write_record_batch(GArrowIPCStreamWriter *stream_writer,
+ GArrowRecordBatch *record_batch,
+ GError **error)
+{
+ auto arrow_stream_writer =
+ garrow_ipc_stream_writer_get_raw(stream_writer);
+ auto arrow_record_batch =
+ garrow_record_batch_get_raw(record_batch);
+ auto arrow_record_batch_raw =
+ arrow_record_batch.get();
+
+ auto status = arrow_stream_writer->WriteRecordBatch(*arrow_record_batch_raw);
+ if (status.ok()) {
+ return TRUE;
+ } else {
+ garrow_error_set(error, status, "[ipc][stream-writer][write-record-batch]");
+ return FALSE;
+ }
+}
+
+/**
+ * garrow_ipc_stream_writer_close:
+ * @stream_writer: A #GArrowIPCStreamWriter.
+ * @error: (nullable): Return locatipcn for a #GError or %NULL.
+ *
+ * Returns: %TRUE on success, %FALSE if there was an error.
+ */
+gboolean
+garrow_ipc_stream_writer_close(GArrowIPCStreamWriter *stream_writer,
+ GError **error)
+{
+ auto arrow_stream_writer =
+ garrow_ipc_stream_writer_get_raw(stream_writer);
+
+ auto status = arrow_stream_writer->Close();
+ if (status.ok()) {
+ return TRUE;
+ } else {
+ garrow_error_set(error, status, "[ipc][stream-writer][close]");
+ return FALSE;
+ }
+}
+
+G_END_DECLS
+
+GArrowIPCStreamWriter *
+garrow_ipc_stream_writer_new_raw(std::shared_ptr<arrow::ipc::StreamWriter> *arrow_stream_writer)
+{
+ auto stream_writer =
+ GARROW_IPC_STREAM_WRITER(g_object_new(GARROW_IPC_TYPE_STREAM_WRITER,
+ "stream-writer", arrow_stream_writer,
+ NULL));
+ return stream_writer;
+}
+
+std::shared_ptr<arrow::ipc::StreamWriter>
+garrow_ipc_stream_writer_get_raw(GArrowIPCStreamWriter *stream_writer)
+{
+ GArrowIPCStreamWriterPrivate *priv;
+
+ priv = GARROW_IPC_STREAM_WRITER_GET_PRIVATE(stream_writer);
+ return priv->stream_writer;
+}
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/ipc-stream-writer.h
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/ipc-stream-writer.h b/c_glib/arrow-glib/ipc-stream-writer.h
new file mode 100644
index 0000000..4488204
--- /dev/null
+++ b/c_glib/arrow-glib/ipc-stream-writer.h
@@ -0,0 +1,82 @@
+/*
+ * 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>
+#include <arrow-glib/record-batch.h>
+#include <arrow-glib/schema.h>
+
+#include <arrow-glib/io-output-stream.h>
+
+G_BEGIN_DECLS
+
+#define GARROW_IPC_TYPE_STREAM_WRITER \
+ (garrow_ipc_stream_writer_get_type())
+#define GARROW_IPC_STREAM_WRITER(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj), \
+ GARROW_IPC_TYPE_STREAM_WRITER, \
+ GArrowIPCStreamWriter))
+#define GARROW_IPC_STREAM_WRITER_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST((klass), \
+ GARROW_IPC_TYPE_STREAM_WRITER, \
+ GArrowIPCStreamWriterClass))
+#define GARROW_IPC_IS_STREAM_WRITER(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj), \
+ GARROW_IPC_TYPE_STREAM_WRITER))
+#define GARROW_IPC_IS_STREAM_WRITER_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE((klass), \
+ GARROW_IPC_TYPE_STREAM_WRITER))
+#define GARROW_IPC_STREAM_WRITER_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS((obj), \
+ GARROW_IPC_TYPE_STREAM_WRITER, \
+ GArrowIPCStreamWriterClass))
+
+typedef struct _GArrowIPCStreamWriter GArrowIPCStreamWriter;
+typedef struct _GArrowIPCStreamWriterClass GArrowIPCStreamWriterClass;
+
+/**
+ * GArrowIPCStreamWriter:
+ *
+ * It wraps `arrow::ipc::StreamWriter`.
+ */
+struct _GArrowIPCStreamWriter
+{
+ /*< private >*/
+ GObject parent_instance;
+};
+
+struct _GArrowIPCStreamWriterClass
+{
+ GObjectClass parent_class;
+};
+
+GType garrow_ipc_stream_writer_get_type(void) G_GNUC_CONST;
+
+GArrowIPCStreamWriter *garrow_ipc_stream_writer_open(GArrowIOOutputStream *sink,
+ GArrowSchema *schema,
+ GError **error);
+
+gboolean garrow_ipc_stream_writer_write_record_batch(GArrowIPCStreamWriter *stream_writer,
+ GArrowRecordBatch *record_batch,
+ GError **error);
+gboolean garrow_ipc_stream_writer_close(GArrowIPCStreamWriter *stream_writer,
+ GError **error);
+
+G_END_DECLS
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/ipc-stream-writer.hpp
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/ipc-stream-writer.hpp b/c_glib/arrow-glib/ipc-stream-writer.hpp
new file mode 100644
index 0000000..9d09740
--- /dev/null
+++ b/c_glib/arrow-glib/ipc-stream-writer.hpp
@@ -0,0 +1,28 @@
+/*
+ * 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/api.h>
+#include <arrow/ipc/api.h>
+
+#include <arrow-glib/ipc-stream-writer.h>
+
+GArrowIPCStreamWriter *garrow_ipc_stream_writer_new_raw(std::shared_ptr<arrow::ipc::StreamWriter> *arrow_stream_writer);
+std::shared_ptr<arrow::ipc::StreamWriter> garrow_ipc_stream_writer_get_raw(GArrowIPCStreamWriter *stream_writer);
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/list-array-builder.cpp
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/list-array-builder.cpp b/c_glib/arrow-glib/list-array-builder.cpp
new file mode 100644
index 0000000..6c8f53d
--- /dev/null
+++ b/c_glib/arrow-glib/list-array-builder.cpp
@@ -0,0 +1,173 @@
+/*
+ * 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-builder.hpp>
+#include <arrow-glib/list-array-builder.h>
+#include <arrow-glib/error.hpp>
+
+G_BEGIN_DECLS
+
+/**
+ * SECTION: list-array-builder
+ * @short_description: List array builder class
+ * @include: arrow-glib/arrow-glib.h
+ *
+ * #GArrowListArrayBuilder is the class to create a new
+ * #GArrowListArray.
+ */
+
+G_DEFINE_TYPE(GArrowListArrayBuilder,
+ garrow_list_array_builder,
+ GARROW_TYPE_ARRAY_BUILDER)
+
+static void
+garrow_list_array_builder_init(GArrowListArrayBuilder *builder)
+{
+}
+
+static void
+garrow_list_array_builder_class_init(GArrowListArrayBuilderClass *klass)
+{
+}
+
+/**
+ * garrow_list_array_builder_new:
+ * @value_builder: A #GArrowArrayBuilder for value array.
+ *
+ * Returns: A newly created #GArrowListArrayBuilder.
+ */
+GArrowListArrayBuilder *
+garrow_list_array_builder_new(GArrowArrayBuilder *value_builder)
+{
+ auto memory_pool = arrow::default_memory_pool();
+ auto arrow_value_builder = garrow_array_builder_get_raw(value_builder);
+ auto arrow_list_builder =
+ std::make_shared<arrow::ListBuilder>(memory_pool, arrow_value_builder);
+ std::shared_ptr<arrow::ArrayBuilder> arrow_builder = arrow_list_builder;
+ auto builder = garrow_array_builder_new_raw(&arrow_builder);
+ return GARROW_LIST_ARRAY_BUILDER(builder);
+}
+
+/**
+ * garrow_list_array_builder_append:
+ * @builder: A #GArrowListArrayBuilder.
+ * @error: (nullable): Return location for a #GError or %NULL.
+ *
+ * Returns: %TRUE on success, %FALSE if there was an error.
+ *
+ * It appends a new list element. To append a new list element, you
+ * need to call this function then append list element values to
+ * `value_builder`. `value_builder` is the #GArrowArrayBuilder
+ * specified to constructor. You can get `value_builder` by
+ * garrow_list_array_builder_get_value_builder().
+ *
+ * |[<!-- language="C" -->
+ * GArrowInt8ArrayBuilder *value_builder;
+ * GArrowListArrayBuilder *builder;
+ *
+ * value_builder = garrow_int8_array_builder_new();
+ * builder = garrow_list_array_builder_new(value_builder, NULL);
+ *
+ * // Start 0th list element: [1, 0, -1]
+ * garrow_list_array_builder_append(builder, NULL);
+ * garrow_int8_array_builder_append(value_builder, 1);
+ * garrow_int8_array_builder_append(value_builder, 0);
+ * garrow_int8_array_builder_append(value_builder, -1);
+ *
+ * // Start 1st list element: [-29, 29]
+ * garrow_list_array_builder_append(builder, NULL);
+ * garrow_int8_array_builder_append(value_builder, -29);
+ * garrow_int8_array_builder_append(value_builder, 29);
+ *
+ * {
+ * // [[1, 0, -1], [-29, 29]]
+ * GArrowArray *array = garrow_array_builder_finish(builder);
+ * // Now, builder is needless.
+ * g_object_unref(builder);
+ * g_object_unref(value_builder);
+ *
+ * // Use array...
+ * g_object_unref(array);
+ * }
+ * ]|
+ */
+gboolean
+garrow_list_array_builder_append(GArrowListArrayBuilder *builder,
+ GError **error)
+{
+ auto arrow_builder =
+ static_cast<arrow::ListBuilder *>(
+ garrow_array_builder_get_raw(GARROW_ARRAY_BUILDER(builder)).get());
+
+ auto status = arrow_builder->Append();
+ if (status.ok()) {
+ return TRUE;
+ } else {
+ garrow_error_set(error, status, "[list-array-builder][append]");
+ return FALSE;
+ }
+}
+
+/**
+ * garrow_list_array_builder_append_null:
+ * @builder: A #GArrowListArrayBuilder.
+ * @error: (nullable): Return location for a #GError or %NULL.
+ *
+ * Returns: %TRUE on success, %FALSE if there was an error.
+ *
+ * It appends a new NULL element.
+ */
+gboolean
+garrow_list_array_builder_append_null(GArrowListArrayBuilder *builder,
+ GError **error)
+{
+ auto arrow_builder =
+ static_cast<arrow::ListBuilder *>(
+ garrow_array_builder_get_raw(GARROW_ARRAY_BUILDER(builder)).get());
+
+ auto status = arrow_builder->AppendNull();
+ if (status.ok()) {
+ return TRUE;
+ } else {
+ garrow_error_set(error, status, "[list-array-builder][append-null]");
+ return FALSE;
+ }
+}
+
+/**
+ * garrow_list_array_builder_get_value_builder:
+ * @builder: A #GArrowListArrayBuilder.
+ *
+ * Returns: (transfer full): The #GArrowArrayBuilder for values.
+ */
+GArrowArrayBuilder *
+garrow_list_array_builder_get_value_builder(GArrowListArrayBuilder *builder)
+{
+ auto arrow_builder =
+ static_cast<arrow::ListBuilder *>(
+ garrow_array_builder_get_raw(GARROW_ARRAY_BUILDER(builder)).get());
+ auto arrow_value_builder = arrow_builder->value_builder();
+ return garrow_array_builder_new_raw(&arrow_value_builder);
+}
+
+G_END_DECLS
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/list-array-builder.h
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/list-array-builder.h b/c_glib/arrow-glib/list-array-builder.h
new file mode 100644
index 0000000..2c2e58e
--- /dev/null
+++ b/c_glib/arrow-glib/list-array-builder.h
@@ -0,0 +1,77 @@
+/*
+ * 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-builder.h>
+
+G_BEGIN_DECLS
+
+#define GARROW_TYPE_LIST_ARRAY_BUILDER \
+ (garrow_list_array_builder_get_type())
+#define GARROW_LIST_ARRAY_BUILDER(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj), \
+ GARROW_TYPE_LIST_ARRAY_BUILDER, \
+ GArrowListArrayBuilder))
+#define GARROW_LIST_ARRAY_BUILDER_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST((klass), \
+ GARROW_TYPE_LIST_ARRAY_BUILDER, \
+ GArrowListArrayBuilderClass))
+#define GARROW_IS_LIST_ARRAY_BUILDER(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj), \
+ GARROW_TYPE_LIST_ARRAY_BUILDER))
+#define GARROW_IS_LIST_ARRAY_BUILDER_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE((klass), \
+ GARROW_TYPE_LIST_ARRAY_BUILDER))
+#define GARROW_LIST_ARRAY_BUILDER_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS((obj), \
+ GARROW_TYPE_LIST_ARRAY_BUILDER, \
+ GArrowListArrayBuilderClass))
+
+typedef struct _GArrowListArrayBuilder GArrowListArrayBuilder;
+typedef struct _GArrowListArrayBuilderClass GArrowListArrayBuilderClass;
+
+/**
+ * GArrowListArrayBuilder:
+ *
+ * It wraps `arrow::ListBuilder`.
+ */
+struct _GArrowListArrayBuilder
+{
+ /*< private >*/
+ GArrowArrayBuilder parent_instance;
+};
+
+struct _GArrowListArrayBuilderClass
+{
+ GArrowArrayBuilderClass parent_class;
+};
+
+GType garrow_list_array_builder_get_type(void) G_GNUC_CONST;
+
+GArrowListArrayBuilder *garrow_list_array_builder_new(GArrowArrayBuilder *value_builder);
+
+gboolean garrow_list_array_builder_append(GArrowListArrayBuilder *builder,
+ GError **error);
+gboolean garrow_list_array_builder_append_null(GArrowListArrayBuilder *builder,
+ GError **error);
+
+GArrowArrayBuilder *garrow_list_array_builder_get_value_builder(GArrowListArrayBuilder *builder);
+
+G_END_DECLS
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/list-array.cpp
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/list-array.cpp b/c_glib/arrow-glib/list-array.cpp
new file mode 100644
index 0000000..2b3fb31
--- /dev/null
+++ b/c_glib/arrow-glib/list-array.cpp
@@ -0,0 +1,92 @@
+/*
+ * 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/data-type.hpp>
+#include <arrow-glib/list-array.h>
+
+G_BEGIN_DECLS
+
+/**
+ * SECTION: list-array
+ * @short_description: List array class
+ * @include: arrow-glib/arrow-glib.h
+ *
+ * #GArrowListArray is a class for list array. It can store zero
+ * or more list data.
+ *
+ * #GArrowListArray is immutable. You need to use
+ * #GArrowListArrayBuilder to create a new array.
+ */
+
+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_END_DECLS
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/list-array.h
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/list-array.h b/c_glib/arrow-glib/list-array.h
new file mode 100644
index 0000000..c49aed1
--- /dev/null
+++ b/c_glib/arrow-glib/list-array.h
@@ -0,0 +1,73 @@
+/*
+ * 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>
+#include <arrow-glib/data-type.h>
+
+G_BEGIN_DECLS
+
+#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);
+
+G_END_DECLS
[2/9] arrow git commit: ARROW-631: [GLib] Import
Posted by we...@apache.org.
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/doc/Makefile.am
----------------------------------------------------------------------
diff --git a/c_glib/doc/Makefile.am b/c_glib/doc/Makefile.am
new file mode 100644
index 0000000..85c1d51
--- /dev/null
+++ b/c_glib/doc/Makefile.am
@@ -0,0 +1,19 @@
+# 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.
+
+SUBDIRS = \
+ reference
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/doc/reference/Makefile.am
----------------------------------------------------------------------
diff --git a/c_glib/doc/reference/Makefile.am b/c_glib/doc/reference/Makefile.am
new file mode 100644
index 0000000..d1c8e01
--- /dev/null
+++ b/c_glib/doc/reference/Makefile.am
@@ -0,0 +1,63 @@
+# 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.
+
+DOC_MODULE = arrow-glib
+
+DOC_MAIN_SGML_FILE = $(DOC_MODULE)-docs.sgml
+
+DOC_SOURCE_DIR = \
+ $(top_srcdir)/arrow-glib
+
+SCAN_OPTIONS = \
+ --deprecated-guards="GARROW_DISABLE_DEPRECATED"
+
+MKDB_OPTIONS = \
+ --name-space=arrow \
+ --source-suffixes="c,cpp,h"
+
+HFILE_GLOB = \
+ $(top_srcdir)/arrow-glib/*.h
+
+IGNORE_HFILES = \
+ enums.h \
+ io-enums.h \
+ ipc-enums.h
+
+CFILE_GLOB = \
+ $(top_srcdir)/arrow-glib/*.cpp
+
+AM_CPPFLAGS = \
+ -I$(top_builddir) \
+ -I$(top_srcdir)
+
+AM_CFLAGS = \
+ $(GLIB_CFLAGS) \
+ $(ARROW_CFLAGS)
+
+GTKDOC_LIBS = \
+ $(top_builddir)/arrow-glib/libarrow-glib.la \
+ $(top_builddir)/arrow-glib/libarrow-io-glib.la \
+ $(top_builddir)/arrow-glib/libarrow-ipc-glib.la
+
+include $(srcdir)/gtk-doc.make
+
+CLEANFILES += \
+ $(DOC_MODULE)-decl-list.txt \
+ $(DOC_MODULE)-decl.txt \
+ $(DOC_MODULE)-overrides.txt \
+ $(DOC_MODULE)-sections.txt \
+ $(DOC_MODULE).types
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/doc/reference/arrow-glib-docs.sgml
----------------------------------------------------------------------
diff --git a/c_glib/doc/reference/arrow-glib-docs.sgml b/c_glib/doc/reference/arrow-glib-docs.sgml
new file mode 100644
index 0000000..9f504be
--- /dev/null
+++ b/c_glib/doc/reference/arrow-glib-docs.sgml
@@ -0,0 +1,171 @@
+<?xml version="1.0"?>
+<!--
+ Licensed 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. See accompanying LICENSE file.
+-->
+<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
+ "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd"
+[
+ <!ENTITY % local.common.attrib "xmlns:xi CDATA #FIXED 'http://www.w3.org/2003/XInclude'">
+ <!ENTITY % gtkdocentities SYSTEM "xml/gtkdocentities.ent">
+ %gtkdocentities;
+]>
+<book id="index">
+ <bookinfo>
+ <title>&package_name; Reference Manual</title>
+ <releaseinfo>
+ for &package_string;.
+ <!--
+ The latest version of this documentation can be found on-line at
+ <ulink role="online-location" url="http://[SERVER]/&package_name;/">http://[SERVER]/&package_name;/</ulink>.
+ -->
+ </releaseinfo>
+ </bookinfo>
+
+ <part id="arrow">
+ <title>GArrow</title>
+ <chapter id="array">
+ <title>Array</title>
+ <xi:include href="xml/array.xml"/>
+ <xi:include href="xml/null-array.xml"/>
+ <xi:include href="xml/boolean-array.xml"/>
+ <xi:include href="xml/int8-array.xml"/>
+ <xi:include href="xml/uint8-array.xml"/>
+ <xi:include href="xml/int16-array.xml"/>
+ <xi:include href="xml/uint16-array.xml"/>
+ <xi:include href="xml/int32-array.xml"/>
+ <xi:include href="xml/uint32-array.xml"/>
+ <xi:include href="xml/int64-array.xml"/>
+ <xi:include href="xml/uint64-array.xml"/>
+ <xi:include href="xml/float-array.xml"/>
+ <xi:include href="xml/double-array.xml"/>
+ <xi:include href="xml/binary-array.xml"/>
+ <xi:include href="xml/string-array.xml"/>
+ <xi:include href="xml/list-array.xml"/>
+ <xi:include href="xml/struct-array.xml"/>
+ </chapter>
+ <chapter id="array-builder">
+ <title>Array builder</title>
+ <xi:include href="xml/array-builder.xml"/>
+ <xi:include href="xml/boolean-array-builder.xml"/>
+ <xi:include href="xml/int8-array-builder.xml"/>
+ <xi:include href="xml/uint8-array-builder.xml"/>
+ <xi:include href="xml/int16-array-builder.xml"/>
+ <xi:include href="xml/uint16-array-builder.xml"/>
+ <xi:include href="xml/int32-array-builder.xml"/>
+ <xi:include href="xml/uint32-array-builder.xml"/>
+ <xi:include href="xml/int64-array-builder.xml"/>
+ <xi:include href="xml/uint64-array-builder.xml"/>
+ <xi:include href="xml/float-array-builder.xml"/>
+ <xi:include href="xml/double-array-builder.xml"/>
+ <xi:include href="xml/binary-array-builder.xml"/>
+ <xi:include href="xml/string-array-builder.xml"/>
+ <xi:include href="xml/list-array-builder.xml"/>
+ <xi:include href="xml/struct-array-builder.xml"/>
+ </chapter>
+ <chapter id="type">
+ <title>Type</title>
+ <xi:include href="xml/type.xml"/>
+ <xi:include href="xml/data-type.xml"/>
+ <xi:include href="xml/null-data-type.xml"/>
+ <xi:include href="xml/boolean-data-type.xml"/>
+ <xi:include href="xml/int8-data-type.xml"/>
+ <xi:include href="xml/uint8-data-type.xml"/>
+ <xi:include href="xml/int16-data-type.xml"/>
+ <xi:include href="xml/uint16-data-type.xml"/>
+ <xi:include href="xml/int32-data-type.xml"/>
+ <xi:include href="xml/uint32-data-type.xml"/>
+ <xi:include href="xml/int64-data-type.xml"/>
+ <xi:include href="xml/uint64-data-type.xml"/>
+ <xi:include href="xml/float-data-type.xml"/>
+ <xi:include href="xml/double-data-type.xml"/>
+ <xi:include href="xml/binary-data-type.xml"/>
+ <xi:include href="xml/string-data-type.xml"/>
+ <xi:include href="xml/list-data-type.xml"/>
+ <xi:include href="xml/struct-data-type.xml"/>
+ </chapter>
+ <chapter id="schema">
+ <title>Schema</title>
+ <xi:include href="xml/field.xml"/>
+ <xi:include href="xml/schema.xml"/>
+ </chapter>
+ <chapter id="table">
+ <title>Table</title>
+ <xi:include href="xml/table.xml"/>
+ <xi:include href="xml/record-batch.xml"/>
+ <xi:include href="xml/column.xml"/>
+ <xi:include href="xml/chunked-array.xml"/>
+ </chapter>
+ <chapter id="error">
+ <title>Error</title>
+ <xi:include href="xml/error.xml"/>
+ </chapter>
+ </part>
+
+ <part id="arrow-io">
+ <title>GArrowIO</title>
+ <chapter id="io-mode">
+ <title>Enums</title>
+ <xi:include href="xml/io-file-mode.xml"/>
+ </chapter>
+ <chapter id="io-input">
+ <title>Input</title>
+ <xi:include href="xml/io-readable.xml"/>
+ <xi:include href="xml/io-input-stream.xml"/>
+ <xi:include href="xml/io-readable-file.xml"/>
+ </chapter>
+ <chapter id="io-output">
+ <title>Output</title>
+ <xi:include href="xml/io-writeable.xml"/>
+ <xi:include href="xml/io-output-stream.xml"/>
+ <xi:include href="xml/io-writeable-file.xml"/>
+ <xi:include href="xml/io-file-output-stream.xml"/>
+ </chapter>
+ <chapter id="io-input-output">
+ <title>Input and output</title>
+ <xi:include href="xml/io-file.xml"/>
+ <xi:include href="xml/io-memory-mapped-file.xml"/>
+ </chapter>
+ </part>
+
+ <part id="arrow-ipc">
+ <title>GArrowIPC</title>
+ <chapter id="ipc-metadata">
+ <title>Enums</title>
+ <xi:include href="xml/ipc-metadata-version.xml"/>
+ </chapter>
+ <chapter id="ipc-reader">
+ <title>Reader</title>
+ <xi:include href="xml/ipc-file-reader.xml"/>
+ <xi:include href="xml/ipc-stream-reader.xml"/>
+ </chapter>
+ <chapter id="ipc-writer">
+ <title>Input</title>
+ <xi:include href="xml/ipc-file-writer.xml"/>
+ <xi:include href="xml/ipc-stream-writer.xml"/>
+ </chapter>
+ </part>
+
+ <chapter id="object-tree">
+ <title>Object Hierarchy</title>
+ <xi:include href="xml/tree_index.sgml"/>
+ </chapter>
+ <index id="api-index-full">
+ <title>API Index</title>
+ <xi:include href="xml/api-index-full.xml"><xi:fallback /></xi:include>
+ </index>
+ <index id="deprecated-api-index" role="deprecated">
+ <title>Index of deprecated API</title>
+ <xi:include href="xml/api-index-deprecated.xml"><xi:fallback /></xi:include>
+ </index>
+ <xi:include href="xml/annotation-glossary.xml"><xi:fallback /></xi:include>
+</book>
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/example/Makefile.am
----------------------------------------------------------------------
diff --git a/c_glib/example/Makefile.am b/c_glib/example/Makefile.am
new file mode 100644
index 0000000..3d456d7
--- /dev/null
+++ b/c_glib/example/Makefile.am
@@ -0,0 +1,34 @@
+# 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.
+
+AM_CPPFLAGS = \
+ -I$(top_builddir) \
+ -I$(top_srcdir)
+
+AM_CFLAGS = \
+ $(GLIB_CFLAGS) \
+ $(GARROW_CFLAGS)
+
+AM_LDFLAGS = \
+ $(GLIB_LIBS) \
+ $(builddir)/../arrow-glib/libarrow-glib.la
+
+noinst_PROGRAMS = \
+ build
+
+build_SOURCES = \
+ build.c
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/example/build.c
----------------------------------------------------------------------
diff --git a/c_glib/example/build.c b/c_glib/example/build.c
new file mode 100644
index 0000000..2722458
--- /dev/null
+++ b/c_glib/example/build.c
@@ -0,0 +1,71 @@
+/*
+ * 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.
+ */
+
+#include <stdlib.h>
+
+#include <arrow-glib/arrow-glib.h>
+
+int
+main(int argc, char **argv)
+{
+ GArrowArray *array;
+
+ {
+ GArrowInt32ArrayBuilder *builder;
+ gboolean success = TRUE;
+ GError *error = NULL;
+
+ builder = garrow_int32_array_builder_new();
+ if (success) {
+ success = garrow_int32_array_builder_append(builder, 29, &error);
+ }
+ if (success) {
+ success = garrow_int32_array_builder_append(builder, 2929, &error);
+ }
+ if (success) {
+ success = garrow_int32_array_builder_append(builder, 292929, &error);
+ }
+ if (!success) {
+ g_print("failed to append: %s\n", error->message);
+ g_error_free(error);
+ g_object_unref(builder);
+ return EXIT_FAILURE;
+ }
+ array = garrow_array_builder_finish(GARROW_ARRAY_BUILDER(builder));
+ g_object_unref(builder);
+ }
+
+ {
+ gint64 i, n;
+
+ n = garrow_array_get_length(array);
+ g_print("length: %" G_GINT64_FORMAT "\n", n);
+ for (i = 0; i < n; i++) {
+ gint32 value;
+
+ value = garrow_int32_array_get_value(GARROW_INT32_ARRAY(array), i);
+ g_print("array[%" G_GINT64_FORMAT "] = %d\n",
+ i, value);
+ }
+ }
+
+ g_object_unref(array);
+
+ return EXIT_SUCCESS;
+}
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/test/helper/buildable.rb
----------------------------------------------------------------------
diff --git a/c_glib/test/helper/buildable.rb b/c_glib/test/helper/buildable.rb
new file mode 100644
index 0000000..900e180
--- /dev/null
+++ b/c_glib/test/helper/buildable.rb
@@ -0,0 +1,77 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+module Helper
+ module Buildable
+ def build_boolean_array(values)
+ build_array(Arrow::BooleanArrayBuilder, values)
+ end
+
+ def build_int8_array(values)
+ build_array(Arrow::Int8ArrayBuilder, values)
+ end
+
+ def build_uint8_array(values)
+ build_array(Arrow::UInt8ArrayBuilder, values)
+ end
+
+ def build_int16_array(values)
+ build_array(Arrow::Int16ArrayBuilder, values)
+ end
+
+ def build_uint16_array(values)
+ build_array(Arrow::UInt16ArrayBuilder, values)
+ end
+
+ def build_int32_array(values)
+ build_array(Arrow::Int32ArrayBuilder, values)
+ end
+
+ def build_uint32_array(values)
+ build_array(Arrow::UInt32ArrayBuilder, values)
+ end
+
+ def build_int64_array(values)
+ build_array(Arrow::Int64ArrayBuilder, values)
+ end
+
+ def build_uint64_array(values)
+ build_array(Arrow::UInt64ArrayBuilder, values)
+ end
+
+ def build_float_array(values)
+ build_array(Arrow::FloatArrayBuilder, values)
+ end
+
+ def build_double_array(values)
+ build_array(Arrow::DoubleArrayBuilder, values)
+ end
+
+ private
+ def build_array(builder_class, values)
+ builder = builder_class.new
+ values.each do |value|
+ if value.nil?
+ builder.append_null
+ else
+ builder.append(value)
+ end
+ end
+ builder.finish
+ end
+ end
+end
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/test/run-test.rb
----------------------------------------------------------------------
diff --git a/c_glib/test/run-test.rb b/c_glib/test/run-test.rb
new file mode 100755
index 0000000..32ceb4a
--- /dev/null
+++ b/c_glib/test/run-test.rb
@@ -0,0 +1,41 @@
+#!/usr/bin/env ruby
+#
+# 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.
+
+require "pathname"
+require "test-unit"
+
+base_dir = Pathname(__dir__).parent
+typelib_dir = base_dir + "arrow-glib"
+test_dir = base_dir + "test"
+
+ENV["GI_TYPELIB_PATH"] = [
+ typelib_dir.to_s,
+ ENV["GI_TYPELIB_PATH"],
+].compact.join(File::PATH_SEPARATOR)
+
+require "gi"
+
+Arrow = GI.load("Arrow")
+ArrowIO = GI.load("ArrowIO")
+ArrowIPC = GI.load("ArrowIPC")
+
+require "tempfile"
+require_relative "helper/buildable"
+
+exit(Test::Unit::AutoRunner.run(true, test_dir.to_s))
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/test/run-test.sh
----------------------------------------------------------------------
diff --git a/c_glib/test/run-test.sh b/c_glib/test/run-test.sh
new file mode 100755
index 0000000..9b0ec8e
--- /dev/null
+++ b/c_glib/test/run-test.sh
@@ -0,0 +1,29 @@
+#!/bin/sh
+#
+# 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.
+
+base_dir="$(cd .; pwd)"
+lib_dir="${base_dir}/arrow-glib/.libs"
+
+LD_LIBRARY_PATH="${lib_dir}:${LD_LIBRARY_PATH}"
+
+if [ "${NO_MAKE}" != "yes" ]; then
+ make -j8 > /dev/null || exit $?
+fi
+
+${GDB} ruby ${base_dir}/test/run-test.rb "$@"
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/test/test-array.rb
----------------------------------------------------------------------
diff --git a/c_glib/test/test-array.rb b/c_glib/test/test-array.rb
new file mode 100644
index 0000000..d68827c
--- /dev/null
+++ b/c_glib/test/test-array.rb
@@ -0,0 +1,44 @@
+# 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 TestArray < Test::Unit::TestCase
+ def test_length
+ builder = Arrow::BooleanArrayBuilder.new
+ builder.append(true)
+ array = builder.finish
+ assert_equal(1, array.length)
+ end
+
+ def test_n_nulls
+ builder = Arrow::BooleanArrayBuilder.new
+ builder.append_null
+ builder.append_null
+ array = builder.finish
+ assert_equal(2, array.n_nulls)
+ end
+
+ def test_slice
+ builder = Arrow::BooleanArrayBuilder.new
+ builder.append(true)
+ builder.append(false)
+ builder.append(true)
+ array = builder.finish
+ sub_array = array.slice(1, 2)
+ assert_equal([false, true],
+ sub_array.length.times.collect {|i| sub_array.get_value(i)})
+ end
+end
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/test/test-binary-array.rb
----------------------------------------------------------------------
diff --git a/c_glib/test/test-binary-array.rb b/c_glib/test/test-binary-array.rb
new file mode 100644
index 0000000..82a537e
--- /dev/null
+++ b/c_glib/test/test-binary-array.rb
@@ -0,0 +1,25 @@
+# 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 TestBinaryArray < Test::Unit::TestCase
+ def test_value
+ builder = Arrow::BinaryArrayBuilder.new
+ builder.append("\x00\x01\x02")
+ array = builder.finish
+ assert_equal([0, 1, 2], array.get_value(0))
+ end
+end
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/test/test-binary-data-type.rb
----------------------------------------------------------------------
diff --git a/c_glib/test/test-binary-data-type.rb b/c_glib/test/test-binary-data-type.rb
new file mode 100644
index 0000000..3d4095c
--- /dev/null
+++ b/c_glib/test/test-binary-data-type.rb
@@ -0,0 +1,28 @@
+# 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 TestBinaryDataType < Test::Unit::TestCase
+ def test_type
+ data_type = Arrow::BinaryDataType.new
+ assert_equal(Arrow::Type::BINARY, data_type.type)
+ end
+
+ def test_to_s
+ data_type = Arrow::BinaryDataType.new
+ assert_equal("binary", data_type.to_s)
+ end
+end
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/test/test-boolean-array.rb
----------------------------------------------------------------------
diff --git a/c_glib/test/test-boolean-array.rb b/c_glib/test/test-boolean-array.rb
new file mode 100644
index 0000000..9cc3c94
--- /dev/null
+++ b/c_glib/test/test-boolean-array.rb
@@ -0,0 +1,25 @@
+# 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 TestBooleanArray < Test::Unit::TestCase
+ def test_value
+ builder = Arrow::BooleanArrayBuilder.new
+ builder.append(true)
+ array = builder.finish
+ assert_equal(true, array.get_value(0))
+ end
+end
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/test/test-boolean-data-type.rb
----------------------------------------------------------------------
diff --git a/c_glib/test/test-boolean-data-type.rb b/c_glib/test/test-boolean-data-type.rb
new file mode 100644
index 0000000..ac56671
--- /dev/null
+++ b/c_glib/test/test-boolean-data-type.rb
@@ -0,0 +1,28 @@
+# 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 TestBooleanDataType < Test::Unit::TestCase
+ def test_type
+ data_type = Arrow::BooleanDataType.new
+ assert_equal(Arrow::Type::BOOL, data_type.type)
+ end
+
+ def test_to_s
+ data_type = Arrow::BooleanDataType.new
+ assert_equal("bool", data_type.to_s)
+ end
+end
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/test/test-chunked-array.rb
----------------------------------------------------------------------
diff --git a/c_glib/test/test-chunked-array.rb b/c_glib/test/test-chunked-array.rb
new file mode 100644
index 0000000..167d5d1
--- /dev/null
+++ b/c_glib/test/test-chunked-array.rb
@@ -0,0 +1,67 @@
+# 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 TestChunkedArray < Test::Unit::TestCase
+ include Helper::Buildable
+
+ def test_length
+ chunks = [
+ build_boolean_array([true, false]),
+ build_boolean_array([true]),
+ ]
+ chunked_array = Arrow::ChunkedArray.new(chunks)
+ assert_equal(3, chunked_array.length)
+ end
+
+ def test_n_nulls
+ chunks = [
+ build_boolean_array([true, nil, false]),
+ build_boolean_array([nil, nil, true]),
+ ]
+ chunked_array = Arrow::ChunkedArray.new(chunks)
+ assert_equal(3, chunked_array.n_nulls)
+ end
+
+
+ def test_n_chunks
+ chunks = [
+ build_boolean_array([true]),
+ build_boolean_array([false]),
+ ]
+ chunked_array = Arrow::ChunkedArray.new(chunks)
+ assert_equal(2, chunked_array.n_chunks)
+ end
+
+ def test_chunk
+ chunks = [
+ build_boolean_array([true, false]),
+ build_boolean_array([false]),
+ ]
+ chunked_array = Arrow::ChunkedArray.new(chunks)
+ assert_equal(2, chunked_array.get_chunk(0).length)
+ end
+
+ def test_chunks
+ chunks = [
+ build_boolean_array([true, false]),
+ build_boolean_array([false]),
+ ]
+ chunked_array = Arrow::ChunkedArray.new(chunks)
+ assert_equal([2, 1],
+ chunked_array.chunks.collect(&:length))
+ end
+end
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/test/test-column.rb
----------------------------------------------------------------------
diff --git a/c_glib/test/test-column.rb b/c_glib/test/test-column.rb
new file mode 100644
index 0000000..ec75194
--- /dev/null
+++ b/c_glib/test/test-column.rb
@@ -0,0 +1,86 @@
+# 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 TestColumn < Test::Unit::TestCase
+ include Helper::Buildable
+
+ sub_test_case(".new") do
+ def test_array
+ field = Arrow::Field.new("enabled", Arrow::BooleanDataType.new)
+ array = build_boolean_array([true])
+ column = Arrow::Column.new(field, array)
+ assert_equal(1, column.length)
+ end
+
+ def test_chunked_array
+ field = Arrow::Field.new("enabled", Arrow::BooleanDataType.new)
+ chunks = [
+ build_boolean_array([true]),
+ build_boolean_array([false, true]),
+ ]
+ chunked_array = Arrow::ChunkedArray.new(chunks)
+ column = Arrow::Column.new(field, chunked_array)
+ assert_equal(3, column.length)
+ end
+ end
+
+ def test_length
+ field = Arrow::Field.new("enabled", Arrow::BooleanDataType.new)
+ array = build_boolean_array([true, false])
+ column = Arrow::Column.new(field, array)
+ assert_equal(2, column.length)
+ end
+
+ def test_n_nulls
+ field = Arrow::Field.new("enabled", Arrow::BooleanDataType.new)
+ array = build_boolean_array([true, nil, nil])
+ column = Arrow::Column.new(field, array)
+ assert_equal(2, column.n_nulls)
+ end
+
+ def test_field
+ field = Arrow::Field.new("enabled", Arrow::BooleanDataType.new)
+ array = build_boolean_array([true])
+ column = Arrow::Column.new(field, array)
+ assert_equal("enabled", column.field.name)
+ end
+
+ def test_name
+ field = Arrow::Field.new("enabled", Arrow::BooleanDataType.new)
+ array = build_boolean_array([true])
+ column = Arrow::Column.new(field, array)
+ assert_equal("enabled", column.name)
+ end
+
+ def test_data_type
+ field = Arrow::Field.new("enabled", Arrow::BooleanDataType.new)
+ array = build_boolean_array([true])
+ column = Arrow::Column.new(field, array)
+ assert_equal("bool", column.data_type.to_s)
+ end
+
+ def test_data
+ field = Arrow::Field.new("enabled", Arrow::BooleanDataType.new)
+ chunks = [
+ build_boolean_array([true]),
+ build_boolean_array([false, true]),
+ ]
+ chunked_array = Arrow::ChunkedArray.new(chunks)
+ column = Arrow::Column.new(field, chunked_array)
+ assert_equal(3, column.data.length)
+ end
+end
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/test/test-double-array.rb
----------------------------------------------------------------------
diff --git a/c_glib/test/test-double-array.rb b/c_glib/test/test-double-array.rb
new file mode 100644
index 0000000..f9c000d
--- /dev/null
+++ b/c_glib/test/test-double-array.rb
@@ -0,0 +1,25 @@
+# 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 TestDoubleArray < Test::Unit::TestCase
+ def test_value
+ builder = Arrow::DoubleArrayBuilder.new
+ builder.append(1.5)
+ array = builder.finish
+ assert_in_delta(1.5, array.get_value(0))
+ end
+end
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/test/test-double-data-type.rb
----------------------------------------------------------------------
diff --git a/c_glib/test/test-double-data-type.rb b/c_glib/test/test-double-data-type.rb
new file mode 100644
index 0000000..18c870c
--- /dev/null
+++ b/c_glib/test/test-double-data-type.rb
@@ -0,0 +1,28 @@
+# 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 TestDoubleDataType < Test::Unit::TestCase
+ def test_type
+ data_type = Arrow::DoubleDataType.new
+ assert_equal(Arrow::Type::DOUBLE, data_type.type)
+ end
+
+ def test_to_s
+ data_type = Arrow::DoubleDataType.new
+ assert_equal("double", data_type.to_s)
+ end
+end
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/test/test-field.rb
----------------------------------------------------------------------
diff --git a/c_glib/test/test-field.rb b/c_glib/test/test-field.rb
new file mode 100644
index 0000000..a20802c
--- /dev/null
+++ b/c_glib/test/test-field.rb
@@ -0,0 +1,41 @@
+# 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 TestField < Test::Unit::TestCase
+ def test_name
+ field = Arrow::Field.new("enabled", Arrow::BooleanDataType.new)
+ assert_equal("enabled", field.name)
+ end
+
+ def test_data_type
+ data_type = Arrow::BooleanDataType.new
+ field = Arrow::Field.new("enabled", data_type)
+ assert_equal(data_type.to_s, field.data_type.to_s)
+ end
+
+ def test_nullable?
+ field = Arrow::Field.new("enabled", Arrow::BooleanDataType.new)
+ assert do
+ field.nullable?
+ end
+ end
+
+ def test_to_s
+ field = Arrow::Field.new("enabled", Arrow::BooleanDataType.new)
+ assert_equal("enabled: bool", field.to_s)
+ end
+end
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/test/test-float-array.rb
----------------------------------------------------------------------
diff --git a/c_glib/test/test-float-array.rb b/c_glib/test/test-float-array.rb
new file mode 100644
index 0000000..020c705
--- /dev/null
+++ b/c_glib/test/test-float-array.rb
@@ -0,0 +1,25 @@
+# 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 TestFloatArray < Test::Unit::TestCase
+ def test_value
+ builder = Arrow::FloatArrayBuilder.new
+ builder.append(1.5)
+ array = builder.finish
+ assert_in_delta(1.5, array.get_value(0))
+ end
+end
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/test/test-float-data-type.rb
----------------------------------------------------------------------
diff --git a/c_glib/test/test-float-data-type.rb b/c_glib/test/test-float-data-type.rb
new file mode 100644
index 0000000..ab315fd
--- /dev/null
+++ b/c_glib/test/test-float-data-type.rb
@@ -0,0 +1,28 @@
+# 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 TestFloatDataType < Test::Unit::TestCase
+ def test_type
+ data_type = Arrow::FloatDataType.new
+ assert_equal(Arrow::Type::FLOAT, data_type.type)
+ end
+
+ def test_to_s
+ data_type = Arrow::FloatDataType.new
+ assert_equal("float", data_type.to_s)
+ end
+end
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/test/test-int16-array.rb
----------------------------------------------------------------------
diff --git a/c_glib/test/test-int16-array.rb b/c_glib/test/test-int16-array.rb
new file mode 100644
index 0000000..2aa5b0c
--- /dev/null
+++ b/c_glib/test/test-int16-array.rb
@@ -0,0 +1,25 @@
+# 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 TestInt16Array < Test::Unit::TestCase
+ def test_value
+ builder = Arrow::Int16ArrayBuilder.new
+ builder.append(-1)
+ array = builder.finish
+ assert_equal(-1, array.get_value(0))
+ end
+end
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/test/test-int16-data-type.rb
----------------------------------------------------------------------
diff --git a/c_glib/test/test-int16-data-type.rb b/c_glib/test/test-int16-data-type.rb
new file mode 100644
index 0000000..273ec80
--- /dev/null
+++ b/c_glib/test/test-int16-data-type.rb
@@ -0,0 +1,28 @@
+# 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 TestInt16DataType < Test::Unit::TestCase
+ def test_type
+ data_type = Arrow::Int16DataType.new
+ assert_equal(Arrow::Type::INT16, data_type.type)
+ end
+
+ def test_to_s
+ data_type = Arrow::Int16DataType.new
+ assert_equal("int16", data_type.to_s)
+ end
+end
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/test/test-int32-array.rb
----------------------------------------------------------------------
diff --git a/c_glib/test/test-int32-array.rb b/c_glib/test/test-int32-array.rb
new file mode 100644
index 0000000..9dd6b3a
--- /dev/null
+++ b/c_glib/test/test-int32-array.rb
@@ -0,0 +1,25 @@
+# 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 TestInt32Array < Test::Unit::TestCase
+ def test_value
+ builder = Arrow::Int32ArrayBuilder.new
+ builder.append(-1)
+ array = builder.finish
+ assert_equal(-1, array.get_value(0))
+ end
+end
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/test/test-int32-data-type.rb
----------------------------------------------------------------------
diff --git a/c_glib/test/test-int32-data-type.rb b/c_glib/test/test-int32-data-type.rb
new file mode 100644
index 0000000..f6b9b34
--- /dev/null
+++ b/c_glib/test/test-int32-data-type.rb
@@ -0,0 +1,28 @@
+# 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 TestInt32DataType < Test::Unit::TestCase
+ def test_type
+ data_type = Arrow::Int32DataType.new
+ assert_equal(Arrow::Type::INT32, data_type.type)
+ end
+
+ def test_to_s
+ data_type = Arrow::Int32DataType.new
+ assert_equal("int32", data_type.to_s)
+ end
+end
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/test/test-int64-array.rb
----------------------------------------------------------------------
diff --git a/c_glib/test/test-int64-array.rb b/c_glib/test/test-int64-array.rb
new file mode 100644
index 0000000..612a8b4
--- /dev/null
+++ b/c_glib/test/test-int64-array.rb
@@ -0,0 +1,25 @@
+# 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 TestInt64Array < Test::Unit::TestCase
+ def test_value
+ builder = Arrow::Int64ArrayBuilder.new
+ builder.append(-1)
+ array = builder.finish
+ assert_equal(-1, array.get_value(0))
+ end
+end
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/test/test-int64-data-type.rb
----------------------------------------------------------------------
diff --git a/c_glib/test/test-int64-data-type.rb b/c_glib/test/test-int64-data-type.rb
new file mode 100644
index 0000000..032b24d
--- /dev/null
+++ b/c_glib/test/test-int64-data-type.rb
@@ -0,0 +1,28 @@
+# 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 TestInt64DataType < Test::Unit::TestCase
+ def test_type
+ data_type = Arrow::Int64DataType.new
+ assert_equal(Arrow::Type::INT64, data_type.type)
+ end
+
+ def test_to_s
+ data_type = Arrow::Int64DataType.new
+ assert_equal("int64", data_type.to_s)
+ end
+end
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/test/test-int8-array.rb
----------------------------------------------------------------------
diff --git a/c_glib/test/test-int8-array.rb b/c_glib/test/test-int8-array.rb
new file mode 100644
index 0000000..ab00996
--- /dev/null
+++ b/c_glib/test/test-int8-array.rb
@@ -0,0 +1,25 @@
+# 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 TestInt8Array < Test::Unit::TestCase
+ def test_value
+ builder = Arrow::Int8ArrayBuilder.new
+ builder.append(-1)
+ array = builder.finish
+ assert_equal(-1, array.get_value(0))
+ end
+end
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/test/test-int8-data-type.rb
----------------------------------------------------------------------
diff --git a/c_glib/test/test-int8-data-type.rb b/c_glib/test/test-int8-data-type.rb
new file mode 100644
index 0000000..d339456
--- /dev/null
+++ b/c_glib/test/test-int8-data-type.rb
@@ -0,0 +1,28 @@
+# 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 TestInt8DataType < Test::Unit::TestCase
+ def test_type
+ data_type = Arrow::Int8DataType.new
+ assert_equal(Arrow::Type::INT8, data_type.type)
+ end
+
+ def test_to_s
+ data_type = Arrow::Int8DataType.new
+ assert_equal("int8", data_type.to_s)
+ end
+end
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/test/test-io-file-output-stream.rb
----------------------------------------------------------------------
diff --git a/c_glib/test/test-io-file-output-stream.rb b/c_glib/test/test-io-file-output-stream.rb
new file mode 100644
index 0000000..1f2ae5f
--- /dev/null
+++ b/c_glib/test/test-io-file-output-stream.rb
@@ -0,0 +1,38 @@
+# 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 TestIOFileOutputStream < Test::Unit::TestCase
+ sub_test_case(".open") do
+ def test_create
+ tempfile = Tempfile.open("arrow-io-file-output-stream")
+ tempfile.write("Hello")
+ tempfile.close
+ file = ArrowIO::FileOutputStream.open(tempfile.path, false)
+ file.close
+ assert_equal("", File.read(tempfile.path))
+ end
+
+ def test_append
+ tempfile = Tempfile.open("arrow-io-file-output-stream")
+ tempfile.write("Hello")
+ tempfile.close
+ file = ArrowIO::FileOutputStream.open(tempfile.path, true)
+ file.close
+ assert_equal("Hello", File.read(tempfile.path))
+ end
+ end
+end
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/test/test-io-memory-mapped-file.rb
----------------------------------------------------------------------
diff --git a/c_glib/test/test-io-memory-mapped-file.rb b/c_glib/test/test-io-memory-mapped-file.rb
new file mode 100644
index 0000000..6098198
--- /dev/null
+++ b/c_glib/test/test-io-memory-mapped-file.rb
@@ -0,0 +1,138 @@
+# 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 TestIOMemoryMappedFile < Test::Unit::TestCase
+ def test_open
+ tempfile = Tempfile.open("arrow-io-memory-mapped-file")
+ tempfile.write("Hello")
+ tempfile.close
+ file = ArrowIO::MemoryMappedFile.open(tempfile.path, :read)
+ begin
+ buffer = " " * 5
+ file.read(buffer)
+ assert_equal("Hello", buffer)
+ ensure
+ file.close
+ end
+ end
+
+ def test_size
+ tempfile = Tempfile.open("arrow-io-memory-mapped-file")
+ tempfile.write("Hello")
+ tempfile.close
+ file = ArrowIO::MemoryMappedFile.open(tempfile.path, :read)
+ begin
+ assert_equal(5, file.size)
+ ensure
+ file.close
+ end
+ end
+
+ def test_read
+ tempfile = Tempfile.open("arrow-io-memory-mapped-file")
+ tempfile.write("Hello World")
+ tempfile.close
+ file = ArrowIO::MemoryMappedFile.open(tempfile.path, :read)
+ begin
+ buffer = " " * 5
+ _success, n_read_bytes = file.read(buffer)
+ assert_equal("Hello", buffer.byteslice(0, n_read_bytes))
+ ensure
+ file.close
+ end
+ end
+
+ def test_read_at
+ tempfile = Tempfile.open("arrow-io-memory-mapped-file")
+ tempfile.write("Hello World")
+ tempfile.close
+ file = ArrowIO::MemoryMappedFile.open(tempfile.path, :read)
+ begin
+ buffer = " " * 5
+ _success, n_read_bytes = file.read_at(6, buffer)
+ assert_equal("World", buffer.byteslice(0, n_read_bytes))
+ ensure
+ file.close
+ end
+ end
+
+ def test_write
+ tempfile = Tempfile.open("arrow-io-memory-mapped-file")
+ tempfile.write("Hello")
+ tempfile.close
+ file = ArrowIO::MemoryMappedFile.open(tempfile.path, :readwrite)
+ begin
+ file.write("World")
+ ensure
+ file.close
+ end
+ assert_equal("World", File.read(tempfile.path))
+ end
+
+ def test_write_at
+ tempfile = Tempfile.open("arrow-io-memory-mapped-file")
+ tempfile.write("Hello")
+ tempfile.close
+ file = ArrowIO::MemoryMappedFile.open(tempfile.path, :readwrite)
+ begin
+ file.write_at(2, "rld")
+ ensure
+ file.close
+ end
+ assert_equal("Herld", File.read(tempfile.path))
+ end
+
+ def test_flush
+ tempfile = Tempfile.open("arrow-io-memory-mapped-file")
+ tempfile.write("Hello")
+ tempfile.close
+ file = ArrowIO::MemoryMappedFile.open(tempfile.path, :readwrite)
+ begin
+ file.write("World")
+ file.flush
+ assert_equal("World", File.read(tempfile.path))
+ ensure
+ file.close
+ end
+ end
+
+ def test_tell
+ tempfile = Tempfile.open("arrow-io-memory-mapped-file")
+ tempfile.write("Hello World")
+ tempfile.close
+ file = ArrowIO::MemoryMappedFile.open(tempfile.path, :read)
+ begin
+ buffer = " " * 5
+ file.read(buffer)
+ assert_equal(5, file.tell)
+ ensure
+ file.close
+ end
+ end
+
+ def test_mode
+ tempfile = Tempfile.open("arrow-io-memory-mapped-file")
+ tempfile.write("Hello World")
+ tempfile.close
+ file = ArrowIO::MemoryMappedFile.open(tempfile.path, :readwrite)
+ begin
+ assert_equal(ArrowIO::FileMode::READWRITE, file.mode)
+ ensure
+ file.close
+ end
+ end
+end
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/test/test-ipc-file-writer.rb
----------------------------------------------------------------------
diff --git a/c_glib/test/test-ipc-file-writer.rb b/c_glib/test/test-ipc-file-writer.rb
new file mode 100644
index 0000000..369bff3
--- /dev/null
+++ b/c_glib/test/test-ipc-file-writer.rb
@@ -0,0 +1,45 @@
+# 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 TestIPCFileWriter < Test::Unit::TestCase
+ def test_write_record_batch
+ tempfile = Tempfile.open("arrow-ipc-file-writer")
+ output = ArrowIO::FileOutputStream.open(tempfile.path, false)
+ begin
+ field = Arrow::Field.new("enabled", Arrow::BooleanDataType.new)
+ schema = Arrow::Schema.new([field])
+ file_writer = ArrowIPC::FileWriter.open(output, schema)
+ begin
+ record_batch = Arrow::RecordBatch.new(schema, 0, [])
+ file_writer.write_record_batch(record_batch)
+ ensure
+ file_writer.close
+ end
+ ensure
+ output.close
+ end
+
+ input = ArrowIO::MemoryMappedFile.open(tempfile.path, :read)
+ begin
+ file_reader = ArrowIPC::FileReader.open(input)
+ assert_equal(["enabled"],
+ file_reader.schema.fields.collect(&:name))
+ ensure
+ input.close
+ end
+ end
+end
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/test/test-ipc-stream-writer.rb
----------------------------------------------------------------------
diff --git a/c_glib/test/test-ipc-stream-writer.rb b/c_glib/test/test-ipc-stream-writer.rb
new file mode 100644
index 0000000..62ac45d
--- /dev/null
+++ b/c_glib/test/test-ipc-stream-writer.rb
@@ -0,0 +1,53 @@
+# 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 TestIPCStreamWriter < Test::Unit::TestCase
+ include Helper::Buildable
+
+ def test_write_record_batch
+ tempfile = Tempfile.open("arrow-ipc-stream-writer")
+ output = ArrowIO::FileOutputStream.open(tempfile.path, false)
+ begin
+ field = Arrow::Field.new("enabled", Arrow::BooleanDataType.new)
+ schema = Arrow::Schema.new([field])
+ stream_writer = ArrowIPC::StreamWriter.open(output, schema)
+ begin
+ columns = [
+ build_boolean_array([true]),
+ ]
+ record_batch = Arrow::RecordBatch.new(schema, 1, columns)
+ stream_writer.write_record_batch(record_batch)
+ ensure
+ stream_writer.close
+ end
+ ensure
+ output.close
+ end
+
+ input = ArrowIO::MemoryMappedFile.open(tempfile.path, :read)
+ begin
+ stream_reader = ArrowIPC::StreamReader.open(input)
+ assert_equal(["enabled"],
+ stream_reader.schema.fields.collect(&:name))
+ assert_equal(true,
+ stream_reader.next_record_batch.get_column(0).get_value(0))
+ assert_nil(stream_reader.next_record_batch)
+ ensure
+ input.close
+ end
+ end
+end
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/test/test-list-array.rb
----------------------------------------------------------------------
diff --git a/c_glib/test/test-list-array.rb b/c_glib/test/test-list-array.rb
new file mode 100644
index 0000000..34177de
--- /dev/null
+++ b/c_glib/test/test-list-array.rb
@@ -0,0 +1,43 @@
+# 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 TestListArray < Test::Unit::TestCase
+ def test_value
+ builder = Arrow::ListArrayBuilder.new(Arrow::Int8ArrayBuilder.new)
+ value_builder = builder.value_builder
+
+ builder.append
+ value_builder.append(-29)
+ value_builder.append(29)
+
+ builder.append
+ value_builder.append(-1)
+ value_builder.append(0)
+ value_builder.append(1)
+
+ array = builder.finish
+ value = array.get_value(1)
+ assert_equal([-1, 0, 1],
+ value.length.times.collect {|i| value.get_value(i)})
+ end
+
+ def test_value_type
+ builder = Arrow::ListArrayBuilder.new(Arrow::Int8ArrayBuilder.new)
+ array = builder.finish
+ assert_equal(Arrow::Int8DataType.new, array.value_type)
+ end
+end
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/test/test-list-data-type.rb
----------------------------------------------------------------------
diff --git a/c_glib/test/test-list-data-type.rb b/c_glib/test/test-list-data-type.rb
new file mode 100644
index 0000000..6fde203
--- /dev/null
+++ b/c_glib/test/test-list-data-type.rb
@@ -0,0 +1,36 @@
+# 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 TestListDataType < Test::Unit::TestCase
+ def test_type
+ field = Arrow::Field.new("enabled", Arrow::BooleanDataType.new)
+ data_type = Arrow::ListDataType.new(field)
+ assert_equal(Arrow::Type::LIST, data_type.type)
+ end
+
+ def test_to_s
+ field = Arrow::Field.new("enabled", Arrow::BooleanDataType.new)
+ data_type = Arrow::ListDataType.new(field)
+ assert_equal("list<enabled: bool>", data_type.to_s)
+ end
+
+ def test_value_field
+ field = Arrow::Field.new("enabled", Arrow::BooleanDataType.new)
+ data_type = Arrow::ListDataType.new(field)
+ assert_equal(field, data_type.value_field)
+ end
+end
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/test/test-null-array.rb
----------------------------------------------------------------------
diff --git a/c_glib/test/test-null-array.rb b/c_glib/test/test-null-array.rb
new file mode 100644
index 0000000..6aa8c03
--- /dev/null
+++ b/c_glib/test/test-null-array.rb
@@ -0,0 +1,33 @@
+# 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 TestNullArray < Test::Unit::TestCase
+ def test_length
+ array = Arrow::NullArray.new(3)
+ assert_equal(3, array.length)
+ end
+
+ def test_n_nulls
+ array = Arrow::NullArray.new(3)
+ assert_equal(3, array.n_nulls)
+ end
+
+ def test_slice
+ array = Arrow::NullArray.new(3)
+ assert_equal(2, array.slice(1, 2).length)
+ end
+end
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/test/test-null-data-type.rb
----------------------------------------------------------------------
diff --git a/c_glib/test/test-null-data-type.rb b/c_glib/test/test-null-data-type.rb
new file mode 100644
index 0000000..95e5483
--- /dev/null
+++ b/c_glib/test/test-null-data-type.rb
@@ -0,0 +1,28 @@
+# 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 TestNullDataType < Test::Unit::TestCase
+ def test_type
+ data_type = Arrow::NullDataType.new
+ assert_equal(Arrow::Type::NA, data_type.type)
+ end
+
+ def test_to_s
+ data_type = Arrow::NullDataType.new
+ assert_equal("null", data_type.to_s)
+ end
+end
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/test/test-record-batch.rb
----------------------------------------------------------------------
diff --git a/c_glib/test/test-record-batch.rb b/c_glib/test/test-record-batch.rb
new file mode 100644
index 0000000..941ff35
--- /dev/null
+++ b/c_glib/test/test-record-batch.rb
@@ -0,0 +1,80 @@
+# 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 TestTable < Test::Unit::TestCase
+ include Helper::Buildable
+
+ def test_new
+ fields = [
+ Arrow::Field.new("visible", Arrow::BooleanDataType.new),
+ Arrow::Field.new("valid", Arrow::BooleanDataType.new),
+ ]
+ schema = Arrow::Schema.new(fields)
+ columns = [
+ build_boolean_array([true]),
+ build_boolean_array([false]),
+ ]
+ record_batch = Arrow::RecordBatch.new(schema, 1, columns)
+ assert_equal(1, record_batch.n_rows)
+ end
+
+ sub_test_case("instance methods") do
+ def setup
+ fields = [
+ Arrow::Field.new("visible", Arrow::BooleanDataType.new),
+ Arrow::Field.new("valid", Arrow::BooleanDataType.new),
+ ]
+ schema = Arrow::Schema.new(fields)
+ columns = [
+ build_boolean_array([true, false, true, false, true, false]),
+ build_boolean_array([false, true, false, true, false]),
+ ]
+ @record_batch = Arrow::RecordBatch.new(schema, 5, columns)
+ end
+
+ def test_schema
+ assert_equal(["visible", "valid"],
+ @record_batch.schema.fields.collect(&:name))
+ end
+
+ def test_column
+ assert_equal(5, @record_batch.get_column(1).length)
+ end
+
+ def test_columns
+ assert_equal([6, 5],
+ @record_batch.columns.collect(&:length))
+ end
+
+ def test_n_columns
+ assert_equal(2, @record_batch.n_columns)
+ end
+
+ def test_n_rows
+ assert_equal(5, @record_batch.n_rows)
+ end
+
+ def test_slice
+ sub_record_batch = @record_batch.slice(3, 2)
+ sub_visible_values = sub_record_batch.n_rows.times.collect do |i|
+ sub_record_batch.get_column(0).get_value(i)
+ end
+ assert_equal([false, true],
+ sub_visible_values)
+ end
+ end
+end
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/test/test-schema.rb
----------------------------------------------------------------------
diff --git a/c_glib/test/test-schema.rb b/c_glib/test/test-schema.rb
new file mode 100644
index 0000000..c9cbb75
--- /dev/null
+++ b/c_glib/test/test-schema.rb
@@ -0,0 +1,69 @@
+# 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 TestSchema < Test::Unit::TestCase
+ def test_field
+ field = Arrow::Field.new("enabled", Arrow::BooleanDataType.new)
+ schema = Arrow::Schema.new([field])
+ assert_equal("enabled", schema.get_field(0).name)
+ end
+
+ sub_test_case("#get_field_by_name") do
+ def test_found
+ field = Arrow::Field.new("enabled", Arrow::BooleanDataType.new)
+ schema = Arrow::Schema.new([field])
+ assert_equal("enabled", schema.get_field_by_name("enabled").name)
+ end
+
+ def test_not_found
+ field = Arrow::Field.new("enabled", Arrow::BooleanDataType.new)
+ schema = Arrow::Schema.new([field])
+ assert_nil(schema.get_field_by_name("nonexistent"))
+ end
+ end
+
+ def test_n_fields
+ fields = [
+ Arrow::Field.new("enabled", Arrow::BooleanDataType.new),
+ Arrow::Field.new("required", Arrow::BooleanDataType.new),
+ ]
+ schema = Arrow::Schema.new(fields)
+ assert_equal(2, schema.n_fields)
+ end
+
+ def test_fields
+ fields = [
+ Arrow::Field.new("enabled", Arrow::BooleanDataType.new),
+ Arrow::Field.new("required", Arrow::BooleanDataType.new),
+ ]
+ schema = Arrow::Schema.new(fields)
+ assert_equal(["enabled", "required"],
+ schema.fields.collect(&:name))
+ end
+
+ def test_to_s
+ fields = [
+ Arrow::Field.new("enabled", Arrow::BooleanDataType.new),
+ Arrow::Field.new("required", Arrow::BooleanDataType.new),
+ ]
+ schema = Arrow::Schema.new(fields)
+ assert_equal(<<-SCHEMA.chomp, schema.to_s)
+enabled: bool
+required: bool
+ SCHEMA
+ end
+end
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/test/test-string-array.rb
----------------------------------------------------------------------
diff --git a/c_glib/test/test-string-array.rb b/c_glib/test/test-string-array.rb
new file mode 100644
index 0000000..a0f5a7b
--- /dev/null
+++ b/c_glib/test/test-string-array.rb
@@ -0,0 +1,25 @@
+# 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 TestStringArray < Test::Unit::TestCase
+ def test_value
+ builder = Arrow::StringArrayBuilder.new
+ builder.append("Hello")
+ array = builder.finish
+ assert_equal("Hello", array.get_string(0))
+ end
+end
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/test/test-string-data-type.rb
----------------------------------------------------------------------
diff --git a/c_glib/test/test-string-data-type.rb b/c_glib/test/test-string-data-type.rb
new file mode 100644
index 0000000..daba7fd
--- /dev/null
+++ b/c_glib/test/test-string-data-type.rb
@@ -0,0 +1,28 @@
+# 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 TestStringDataType < Test::Unit::TestCase
+ def test_type
+ data_type = Arrow::StringDataType.new
+ assert_equal(Arrow::Type::STRING, data_type.type)
+ end
+
+ def test_to_s
+ data_type = Arrow::StringDataType.new
+ assert_equal("string", data_type.to_s)
+ end
+end
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/test/test-struct-array.rb
----------------------------------------------------------------------
diff --git a/c_glib/test/test-struct-array.rb b/c_glib/test/test-struct-array.rb
new file mode 100644
index 0000000..cf450f5
--- /dev/null
+++ b/c_glib/test/test-struct-array.rb
@@ -0,0 +1,58 @@
+# 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 TestStructArray < Test::Unit::TestCase
+ def test_fields
+ fields = [
+ Arrow::Field.new("score", Arrow::Int8DataType.new),
+ Arrow::Field.new("enabled", Arrow::BooleanDataType.new),
+ ]
+ data_type = Arrow::StructDataType.new(fields)
+ field_builders = [
+ Arrow::Int8ArrayBuilder.new,
+ Arrow::BooleanArrayBuilder.new,
+ ]
+ builder = Arrow::StructArrayBuilder.new(data_type, field_builders)
+
+ builder.append
+ builder.get_field_builder(0).append(-29)
+ builder.get_field_builder(1).append(true)
+
+ builder.append
+ builder.field_builders[0].append(2)
+ builder.field_builders[1].append(false)
+
+ array = builder.finish
+ values = array.length.times.collect do |i|
+ if i.zero?
+ [
+ array.get_field(0).get_value(i),
+ array.get_field(1).get_value(i),
+ ]
+ else
+ array.fields.collect do |field|
+ field.get_value(i)
+ end
+ end
+ end
+ assert_equal([
+ [-29, true],
+ [2, false],
+ ],
+ values)
+ end
+end
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/test/test-table.rb
----------------------------------------------------------------------
diff --git a/c_glib/test/test-table.rb b/c_glib/test/test-table.rb
new file mode 100644
index 0000000..1687d2f
--- /dev/null
+++ b/c_glib/test/test-table.rb
@@ -0,0 +1,72 @@
+# 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 TestTable < Test::Unit::TestCase
+ include Helper::Buildable
+
+ sub_test_case(".new") do
+ def test_columns
+ fields = [
+ Arrow::Field.new("visible", Arrow::BooleanDataType.new),
+ Arrow::Field.new("valid", Arrow::BooleanDataType.new),
+ ]
+ schema = Arrow::Schema.new(fields)
+ columns = [
+ Arrow::Column.new(fields[0], build_boolean_array([true])),
+ Arrow::Column.new(fields[1], build_boolean_array([false])),
+ ]
+ table = Arrow::Table.new("memos", schema, columns)
+ assert_equal("memos", table.name)
+ end
+ end
+
+ sub_test_case("instance methods") do
+ def setup
+ fields = [
+ Arrow::Field.new("visible", Arrow::BooleanDataType.new),
+ Arrow::Field.new("valid", Arrow::BooleanDataType.new),
+ ]
+ schema = Arrow::Schema.new(fields)
+ columns = [
+ Arrow::Column.new(fields[0], build_boolean_array([true])),
+ Arrow::Column.new(fields[1], build_boolean_array([false])),
+ ]
+ @table = Arrow::Table.new("memos", schema, columns)
+ end
+
+ def test_name
+ assert_equal("memos", @table.name)
+ end
+
+ def test_schema
+ assert_equal(["visible", "valid"],
+ @table.schema.fields.collect(&:name))
+ end
+
+ def test_column
+ assert_equal("valid", @table.get_column(1).name)
+ end
+
+ def test_n_columns
+ assert_equal(2, @table.n_columns)
+ end
+
+ def test_n_rows
+ assert_equal(1, @table.n_rows)
+ end
+ end
+end
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/test/test-uint16-array.rb
----------------------------------------------------------------------
diff --git a/c_glib/test/test-uint16-array.rb b/c_glib/test/test-uint16-array.rb
new file mode 100644
index 0000000..ad85f09
--- /dev/null
+++ b/c_glib/test/test-uint16-array.rb
@@ -0,0 +1,25 @@
+# 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 TestUInt16Array < Test::Unit::TestCase
+ def test_value
+ builder = Arrow::UInt16ArrayBuilder.new
+ builder.append(1)
+ array = builder.finish
+ assert_equal(1, array.get_value(0))
+ end
+end
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/test/test-uint16-data-type.rb
----------------------------------------------------------------------
diff --git a/c_glib/test/test-uint16-data-type.rb b/c_glib/test/test-uint16-data-type.rb
new file mode 100644
index 0000000..f5a6cc0
--- /dev/null
+++ b/c_glib/test/test-uint16-data-type.rb
@@ -0,0 +1,28 @@
+# 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 TestUInt16DataType < Test::Unit::TestCase
+ def test_type
+ data_type = Arrow::UInt16DataType.new
+ assert_equal(Arrow::Type::UINT16, data_type.type)
+ end
+
+ def test_to_s
+ data_type = Arrow::UInt16DataType.new
+ assert_equal("uint16", data_type.to_s)
+ end
+end
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/test/test-uint32-array.rb
----------------------------------------------------------------------
diff --git a/c_glib/test/test-uint32-array.rb b/c_glib/test/test-uint32-array.rb
new file mode 100644
index 0000000..59e19f3
--- /dev/null
+++ b/c_glib/test/test-uint32-array.rb
@@ -0,0 +1,25 @@
+# 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 TestUInt32Array < Test::Unit::TestCase
+ def test_value
+ builder = Arrow::UInt32ArrayBuilder.new
+ builder.append(1)
+ array = builder.finish
+ assert_equal(1, array.get_value(0))
+ end
+end
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/test/test-uint32-data-type.rb
----------------------------------------------------------------------
diff --git a/c_glib/test/test-uint32-data-type.rb b/c_glib/test/test-uint32-data-type.rb
new file mode 100644
index 0000000..7a50257
--- /dev/null
+++ b/c_glib/test/test-uint32-data-type.rb
@@ -0,0 +1,28 @@
+# 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 TestUInt32DataType < Test::Unit::TestCase
+ def test_type
+ data_type = Arrow::UInt32DataType.new
+ assert_equal(Arrow::Type::UINT32, data_type.type)
+ end
+
+ def test_to_s
+ data_type = Arrow::UInt32DataType.new
+ assert_equal("uint32", data_type.to_s)
+ end
+end
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/test/test-uint64-array.rb
----------------------------------------------------------------------
diff --git a/c_glib/test/test-uint64-array.rb b/c_glib/test/test-uint64-array.rb
new file mode 100644
index 0000000..e0195c1
--- /dev/null
+++ b/c_glib/test/test-uint64-array.rb
@@ -0,0 +1,25 @@
+# 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 TestUInt64Array < Test::Unit::TestCase
+ def test_value
+ builder = Arrow::UInt64ArrayBuilder.new
+ builder.append(1)
+ array = builder.finish
+ assert_equal(1, array.get_value(0))
+ end
+end
[9/9] arrow git commit: ARROW-631: [GLib] Import
Posted by we...@apache.org.
ARROW-631: [GLib] Import
See also https://issues.apache.org/jira/browse/ARROW-631 and `glib/README.md` in this change.
Author: Kouhei Sutou <ko...@clear-code.com>
Closes #382 from kou/glib-import and squashes the following commits:
67a5d24 [Kouhei Sutou] [GLib] Rename directory to c_glib/ from glib/
24cd605 [Kouhei Sutou] [GLib] Import
Project: http://git-wip-us.apache.org/repos/asf/arrow/repo
Commit: http://git-wip-us.apache.org/repos/asf/arrow/commit/39c7274f
Tree: http://git-wip-us.apache.org/repos/asf/arrow/tree/39c7274f
Diff: http://git-wip-us.apache.org/repos/asf/arrow/diff/39c7274f
Branch: refs/heads/master
Commit: 39c7274fc36b5f405f1dbfa48067dde52abec5ce
Parents: c13d671
Author: Kouhei Sutou <ko...@clear-code.com>
Authored: Thu Mar 16 21:09:38 2017 -0400
Committer: Wes McKinney <we...@twosigma.com>
Committed: Thu Mar 16 21:09:38 2017 -0400
----------------------------------------------------------------------
.travis.yml | 5 +
c_glib/.gitignore | 44 ++
c_glib/Makefile.am | 26 ++
c_glib/README.md | 114 ++++++
c_glib/arrow-glib/Makefile.am | 494 +++++++++++++++++++++++
c_glib/arrow-glib/array-builder.cpp | 229 +++++++++++
c_glib/arrow-glib/array-builder.h | 70 ++++
c_glib/arrow-glib/array-builder.hpp | 26 ++
c_glib/arrow-glib/array.cpp | 268 ++++++++++++
c_glib/arrow-glib/array.h | 67 +++
c_glib/arrow-glib/array.hpp | 27 ++
c_glib/arrow-glib/arrow-glib.h | 80 ++++
c_glib/arrow-glib/arrow-glib.hpp | 37 ++
c_glib/arrow-glib/arrow-glib.pc.in | 28 ++
c_glib/arrow-glib/arrow-io-glib.h | 32 ++
c_glib/arrow-glib/arrow-io-glib.hpp | 30 ++
c_glib/arrow-glib/arrow-io-glib.pc.in | 28 ++
c_glib/arrow-glib/arrow-ipc-glib.h | 27 ++
c_glib/arrow-glib/arrow-ipc-glib.hpp | 30 ++
c_glib/arrow-glib/arrow-ipc-glib.pc.in | 28 ++
c_glib/arrow-glib/binary-array-builder.cpp | 122 ++++++
c_glib/arrow-glib/binary-array-builder.h | 77 ++++
c_glib/arrow-glib/binary-array.cpp | 73 ++++
c_glib/arrow-glib/binary-array.h | 72 ++++
c_glib/arrow-glib/binary-data-type.cpp | 67 +++
c_glib/arrow-glib/binary-data-type.h | 69 ++++
c_glib/arrow-glib/boolean-array-builder.cpp | 120 ++++++
c_glib/arrow-glib/boolean-array-builder.h | 76 ++++
c_glib/arrow-glib/boolean-array.cpp | 69 ++++
c_glib/arrow-glib/boolean-array.h | 70 ++++
c_glib/arrow-glib/boolean-data-type.cpp | 67 +++
c_glib/arrow-glib/boolean-data-type.h | 69 ++++
c_glib/arrow-glib/chunked-array.cpp | 241 +++++++++++
c_glib/arrow-glib/chunked-array.h | 78 ++++
c_glib/arrow-glib/chunked-array.hpp | 27 ++
c_glib/arrow-glib/column.cpp | 262 ++++++++++++
c_glib/arrow-glib/column.h | 82 ++++
c_glib/arrow-glib/column.hpp | 27 ++
c_glib/arrow-glib/data-type.cpp | 260 ++++++++++++
c_glib/arrow-glib/data-type.h | 72 ++++
c_glib/arrow-glib/data-type.hpp | 27 ++
c_glib/arrow-glib/double-array-builder.cpp | 120 ++++++
c_glib/arrow-glib/double-array-builder.h | 76 ++++
c_glib/arrow-glib/double-array.cpp | 69 ++++
c_glib/arrow-glib/double-array.h | 71 ++++
c_glib/arrow-glib/double-data-type.cpp | 68 ++++
c_glib/arrow-glib/double-data-type.h | 70 ++++
c_glib/arrow-glib/enums.c.template | 56 +++
c_glib/arrow-glib/enums.h.template | 41 ++
c_glib/arrow-glib/error.cpp | 81 ++++
c_glib/arrow-glib/error.h | 54 +++
c_glib/arrow-glib/error.hpp | 28 ++
c_glib/arrow-glib/field.cpp | 250 ++++++++++++
c_glib/arrow-glib/field.h | 83 ++++
c_glib/arrow-glib/field.hpp | 27 ++
c_glib/arrow-glib/float-array-builder.cpp | 120 ++++++
c_glib/arrow-glib/float-array-builder.h | 76 ++++
c_glib/arrow-glib/float-array.cpp | 69 ++++
c_glib/arrow-glib/float-array.h | 71 ++++
c_glib/arrow-glib/float-data-type.cpp | 68 ++++
c_glib/arrow-glib/float-data-type.h | 69 ++++
c_glib/arrow-glib/int16-array-builder.cpp | 120 ++++++
c_glib/arrow-glib/int16-array-builder.h | 76 ++++
c_glib/arrow-glib/int16-array.cpp | 69 ++++
c_glib/arrow-glib/int16-array.h | 71 ++++
c_glib/arrow-glib/int16-data-type.cpp | 67 +++
c_glib/arrow-glib/int16-data-type.h | 69 ++++
c_glib/arrow-glib/int32-array-builder.cpp | 120 ++++++
c_glib/arrow-glib/int32-array-builder.h | 76 ++++
c_glib/arrow-glib/int32-array.cpp | 69 ++++
c_glib/arrow-glib/int32-array.h | 71 ++++
c_glib/arrow-glib/int32-data-type.cpp | 67 +++
c_glib/arrow-glib/int32-data-type.h | 69 ++++
c_glib/arrow-glib/int64-array-builder.cpp | 120 ++++++
c_glib/arrow-glib/int64-array-builder.h | 76 ++++
c_glib/arrow-glib/int64-array.cpp | 69 ++++
c_glib/arrow-glib/int64-array.h | 71 ++++
c_glib/arrow-glib/int64-data-type.cpp | 67 +++
c_glib/arrow-glib/int64-data-type.h | 69 ++++
c_glib/arrow-glib/int8-array-builder.cpp | 120 ++++++
c_glib/arrow-glib/int8-array-builder.h | 76 ++++
c_glib/arrow-glib/int8-array.cpp | 69 ++++
c_glib/arrow-glib/int8-array.h | 71 ++++
c_glib/arrow-glib/int8-data-type.cpp | 67 +++
c_glib/arrow-glib/int8-data-type.h | 69 ++++
c_glib/arrow-glib/io-enums.c.template | 56 +++
c_glib/arrow-glib/io-enums.h.template | 41 ++
c_glib/arrow-glib/io-file-mode.cpp | 63 +++
c_glib/arrow-glib/io-file-mode.h | 40 ++
c_glib/arrow-glib/io-file-mode.hpp | 27 ++
c_glib/arrow-glib/io-file-output-stream.cpp | 231 +++++++++++
c_glib/arrow-glib/io-file-output-stream.h | 72 ++++
c_glib/arrow-glib/io-file-output-stream.hpp | 28 ++
c_glib/arrow-glib/io-file.cpp | 116 ++++++
c_glib/arrow-glib/io-file.h | 51 +++
c_glib/arrow-glib/io-file.hpp | 38 ++
c_glib/arrow-glib/io-input-stream.cpp | 56 +++
c_glib/arrow-glib/io-input-stream.h | 45 +++
c_glib/arrow-glib/io-input-stream.hpp | 38 ++
c_glib/arrow-glib/io-memory-mapped-file.cpp | 287 +++++++++++++
c_glib/arrow-glib/io-memory-mapped-file.h | 72 ++++
c_glib/arrow-glib/io-memory-mapped-file.hpp | 28 ++
c_glib/arrow-glib/io-output-stream.cpp | 56 +++
c_glib/arrow-glib/io-output-stream.h | 45 +++
c_glib/arrow-glib/io-output-stream.hpp | 38 ++
c_glib/arrow-glib/io-readable-file.cpp | 127 ++++++
c_glib/arrow-glib/io-readable-file.h | 55 +++
c_glib/arrow-glib/io-readable-file.hpp | 38 ++
c_glib/arrow-glib/io-readable.cpp | 84 ++++
c_glib/arrow-glib/io-readable.h | 51 +++
c_glib/arrow-glib/io-readable.hpp | 38 ++
c_glib/arrow-glib/io-writeable-file.cpp | 84 ++++
c_glib/arrow-glib/io-writeable-file.h | 51 +++
c_glib/arrow-glib/io-writeable-file.hpp | 38 ++
c_glib/arrow-glib/io-writeable.cpp | 106 +++++
c_glib/arrow-glib/io-writeable.h | 52 +++
c_glib/arrow-glib/io-writeable.hpp | 38 ++
c_glib/arrow-glib/ipc-enums.c.template | 56 +++
c_glib/arrow-glib/ipc-enums.h.template | 41 ++
c_glib/arrow-glib/ipc-file-reader.cpp | 247 ++++++++++++
c_glib/arrow-glib/ipc-file-reader.h | 83 ++++
c_glib/arrow-glib/ipc-file-reader.hpp | 28 ++
c_glib/arrow-glib/ipc-file-writer.cpp | 158 ++++++++
c_glib/arrow-glib/ipc-file-writer.h | 78 ++++
c_glib/arrow-glib/ipc-file-writer.hpp | 28 ++
c_glib/arrow-glib/ipc-metadata-version.cpp | 59 +++
c_glib/arrow-glib/ipc-metadata-version.h | 39 ++
c_glib/arrow-glib/ipc-metadata-version.hpp | 27 ++
c_glib/arrow-glib/ipc-stream-reader.cpp | 221 ++++++++++
c_glib/arrow-glib/ipc-stream-reader.h | 80 ++++
c_glib/arrow-glib/ipc-stream-reader.hpp | 28 ++
c_glib/arrow-glib/ipc-stream-writer.cpp | 232 +++++++++++
c_glib/arrow-glib/ipc-stream-writer.h | 82 ++++
c_glib/arrow-glib/ipc-stream-writer.hpp | 28 ++
c_glib/arrow-glib/list-array-builder.cpp | 173 ++++++++
c_glib/arrow-glib/list-array-builder.h | 77 ++++
c_glib/arrow-glib/list-array.cpp | 92 +++++
c_glib/arrow-glib/list-array.h | 73 ++++
c_glib/arrow-glib/list-data-type.cpp | 91 +++++
c_glib/arrow-glib/list-data-type.h | 73 ++++
c_glib/arrow-glib/null-array.cpp | 69 ++++
c_glib/arrow-glib/null-array.h | 70 ++++
c_glib/arrow-glib/null-data-type.cpp | 67 +++
c_glib/arrow-glib/null-data-type.h | 69 ++++
c_glib/arrow-glib/record-batch.cpp | 288 +++++++++++++
c_glib/arrow-glib/record-batch.h | 85 ++++
c_glib/arrow-glib/record-batch.hpp | 27 ++
c_glib/arrow-glib/schema.cpp | 245 +++++++++++
c_glib/arrow-glib/schema.h | 80 ++++
c_glib/arrow-glib/schema.hpp | 27 ++
c_glib/arrow-glib/string-array-builder.cpp | 97 +++++
c_glib/arrow-glib/string-array-builder.h | 74 ++++
c_glib/arrow-glib/string-array.cpp | 74 ++++
c_glib/arrow-glib/string-array.h | 71 ++++
c_glib/arrow-glib/string-data-type.cpp | 68 ++++
c_glib/arrow-glib/string-data-type.h | 69 ++++
c_glib/arrow-glib/struct-array-builder.cpp | 187 +++++++++
c_glib/arrow-glib/struct-array-builder.h | 81 ++++
c_glib/arrow-glib/struct-array.cpp | 97 +++++
c_glib/arrow-glib/struct-array.h | 73 ++++
c_glib/arrow-glib/struct-data-type.cpp | 75 ++++
c_glib/arrow-glib/struct-data-type.h | 71 ++++
c_glib/arrow-glib/table.cpp | 240 +++++++++++
c_glib/arrow-glib/table.h | 80 ++++
c_glib/arrow-glib/table.hpp | 27 ++
c_glib/arrow-glib/type.cpp | 90 +++++
c_glib/arrow-glib/type.h | 84 ++++
c_glib/arrow-glib/type.hpp | 26 ++
c_glib/arrow-glib/uint16-array-builder.cpp | 120 ++++++
c_glib/arrow-glib/uint16-array-builder.h | 76 ++++
c_glib/arrow-glib/uint16-array.cpp | 69 ++++
c_glib/arrow-glib/uint16-array.h | 71 ++++
c_glib/arrow-glib/uint16-data-type.cpp | 67 +++
c_glib/arrow-glib/uint16-data-type.h | 69 ++++
c_glib/arrow-glib/uint32-array-builder.cpp | 120 ++++++
c_glib/arrow-glib/uint32-array-builder.h | 76 ++++
c_glib/arrow-glib/uint32-array.cpp | 69 ++++
c_glib/arrow-glib/uint32-array.h | 71 ++++
c_glib/arrow-glib/uint32-data-type.cpp | 67 +++
c_glib/arrow-glib/uint32-data-type.h | 69 ++++
c_glib/arrow-glib/uint64-array-builder.cpp | 120 ++++++
c_glib/arrow-glib/uint64-array-builder.h | 76 ++++
c_glib/arrow-glib/uint64-array.cpp | 69 ++++
c_glib/arrow-glib/uint64-array.h | 71 ++++
c_glib/arrow-glib/uint64-data-type.cpp | 67 +++
c_glib/arrow-glib/uint64-data-type.h | 69 ++++
c_glib/arrow-glib/uint8-array-builder.cpp | 120 ++++++
c_glib/arrow-glib/uint8-array-builder.h | 76 ++++
c_glib/arrow-glib/uint8-array.cpp | 69 ++++
c_glib/arrow-glib/uint8-array.h | 71 ++++
c_glib/arrow-glib/uint8-data-type.cpp | 67 +++
c_glib/arrow-glib/uint8-data-type.h | 69 ++++
c_glib/autogen.sh | 31 ++
c_glib/configure.ac | 76 ++++
c_glib/doc/Makefile.am | 19 +
c_glib/doc/reference/Makefile.am | 63 +++
c_glib/doc/reference/arrow-glib-docs.sgml | 171 ++++++++
c_glib/example/Makefile.am | 34 ++
c_glib/example/build.c | 71 ++++
c_glib/test/helper/buildable.rb | 77 ++++
c_glib/test/run-test.rb | 41 ++
c_glib/test/run-test.sh | 29 ++
c_glib/test/test-array.rb | 44 ++
c_glib/test/test-binary-array.rb | 25 ++
c_glib/test/test-binary-data-type.rb | 28 ++
c_glib/test/test-boolean-array.rb | 25 ++
c_glib/test/test-boolean-data-type.rb | 28 ++
c_glib/test/test-chunked-array.rb | 67 +++
c_glib/test/test-column.rb | 86 ++++
c_glib/test/test-double-array.rb | 25 ++
c_glib/test/test-double-data-type.rb | 28 ++
c_glib/test/test-field.rb | 41 ++
c_glib/test/test-float-array.rb | 25 ++
c_glib/test/test-float-data-type.rb | 28 ++
c_glib/test/test-int16-array.rb | 25 ++
c_glib/test/test-int16-data-type.rb | 28 ++
c_glib/test/test-int32-array.rb | 25 ++
c_glib/test/test-int32-data-type.rb | 28 ++
c_glib/test/test-int64-array.rb | 25 ++
c_glib/test/test-int64-data-type.rb | 28 ++
c_glib/test/test-int8-array.rb | 25 ++
c_glib/test/test-int8-data-type.rb | 28 ++
c_glib/test/test-io-file-output-stream.rb | 38 ++
c_glib/test/test-io-memory-mapped-file.rb | 138 +++++++
c_glib/test/test-ipc-file-writer.rb | 45 +++
c_glib/test/test-ipc-stream-writer.rb | 53 +++
c_glib/test/test-list-array.rb | 43 ++
c_glib/test/test-list-data-type.rb | 36 ++
c_glib/test/test-null-array.rb | 33 ++
c_glib/test/test-null-data-type.rb | 28 ++
c_glib/test/test-record-batch.rb | 80 ++++
c_glib/test/test-schema.rb | 69 ++++
c_glib/test/test-string-array.rb | 25 ++
c_glib/test/test-string-data-type.rb | 28 ++
c_glib/test/test-struct-array.rb | 58 +++
c_glib/test/test-table.rb | 72 ++++
c_glib/test/test-uint16-array.rb | 25 ++
c_glib/test/test-uint16-data-type.rb | 28 ++
c_glib/test/test-uint32-array.rb | 25 ++
c_glib/test/test-uint32-data-type.rb | 28 ++
c_glib/test/test-uint64-array.rb | 25 ++
c_glib/test/test-uint64-data-type.rb | 28 ++
c_glib/test/test-uint8-array.rb | 25 ++
c_glib/test/test-uint8-data-type.rb | 28 ++
ci/travis_before_script_c_glib.sh | 40 ++
ci/travis_script_c_glib.sh | 24 ++
246 files changed, 18251 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/.travis.yml
----------------------------------------------------------------------
diff --git a/.travis.yml b/.travis.yml
index e8d9104..b219b03 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -16,6 +16,9 @@ addons:
- libboost-filesystem-dev
- libboost-system-dev
- libjemalloc-dev
+ - gtk-doc-tools
+ - autoconf-archive
+ - libgirepository1.0-dev
matrix:
fast_finish: true
@@ -30,9 +33,11 @@ matrix:
- export CC="gcc-4.9"
- export CXX="g++-4.9"
- $TRAVIS_BUILD_DIR/ci/travis_before_script_cpp.sh
+ - $TRAVIS_BUILD_DIR/ci/travis_before_script_c_glib.sh
script:
- $TRAVIS_BUILD_DIR/ci/travis_script_cpp.sh
- $TRAVIS_BUILD_DIR/ci/travis_script_python.sh
+ - $TRAVIS_BUILD_DIR/ci/travis_script_c_glib.sh
- compiler: clang
osx_image: xcode6.4
os: osx
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/.gitignore
----------------------------------------------------------------------
diff --git a/c_glib/.gitignore b/c_glib/.gitignore
new file mode 100644
index 0000000..38e33a2
--- /dev/null
+++ b/c_glib/.gitignore
@@ -0,0 +1,44 @@
+Makefile
+Makefile.in
+.deps/
+.libs/
+*.gir
+*.typelib
+*.o
+*.lo
+*.la
+*~
+/*.tar.gz
+/aclocal.m4
+/autom4te.cache/
+/config.h
+/config.h.in
+/config.log
+/config.status
+/config/
+/configure
+/doc/reference/*.txt
+/doc/reference/*.txt.bak
+/doc/reference/*.args
+/doc/reference/*.hierarchy
+/doc/reference/*.interfaces
+/doc/reference/*.prerequisites
+/doc/reference/*.signals
+/doc/reference/*.types
+/doc/reference/gtk-doc.make
+/doc/reference/*.stamp
+/doc/reference/html/
+/doc/reference/xml/
+/libtool
+/m4/
+/stamp-h1
+/version
+/arrow-glib/enums.c
+/arrow-glib/enums.h
+/arrow-glib/io-enums.c
+/arrow-glib/io-enums.h
+/arrow-glib/ipc-enums.c
+/arrow-glib/ipc-enums.h
+/arrow-glib/stamp-*
+/arrow-glib/*.pc
+/example/build
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/Makefile.am
----------------------------------------------------------------------
diff --git a/c_glib/Makefile.am b/c_glib/Makefile.am
new file mode 100644
index 0000000..076f9be
--- /dev/null
+++ b/c_glib/Makefile.am
@@ -0,0 +1,26 @@
+# 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.
+
+ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS}
+
+SUBDIRS = \
+ arrow-glib \
+ doc \
+ example
+
+EXTRA_DIST = \
+ version
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/README.md
----------------------------------------------------------------------
diff --git a/c_glib/README.md b/c_glib/README.md
new file mode 100644
index 0000000..4008015
--- /dev/null
+++ b/c_glib/README.md
@@ -0,0 +1,114 @@
+<!---
+ Licensed 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. See accompanying LICENSE file.
+-->
+
+# Arrow GLib
+
+Arrow GLib is a wrapper library for Arrow C++. Arrow GLib provides C
+API.
+
+Arrow GLib supports
+[GObject Introspection](https://wiki.gnome.org/action/show/Projects/GObjectIntrospection).
+It means that you can create language bindings at runtime or compile time.
+
+For example, you can use Apache Arrow from Ruby by Arrow GLib and
+[gobject-introspection gem](https://rubygems.org/gems/gobject-introspection)
+with the following code:
+
+```ruby
+# Generate bindings at runtime
+require "gi"
+Arrow = GI.load("Arrow")
+
+# Now, you can access arrow::BooleanArray in Arrow C++ by
+# Arrow::BooleanArray
+p Arrow::BooleanArray
+```
+
+In Ruby case, you should use
+[red-arrow gem](https://rubygems.org/gems/red-arrow). It's based on
+gobject-introspection gem. It adds many convenient features to raw
+gobject-introspection gem based bindings.
+
+## Install
+
+### Package
+
+TODO
+
+### Build
+
+You need to install Arrow C++ before you install Arrow GLib. See Arrow
+C++ document about how to install Arrow C++.
+
+You need [GTK-Doc](https://www.gtk.org/gtk-doc/) and
+[GObject Introspection](https://wiki.gnome.org/action/show/Projects/GObjectIntrospection)
+to build Arrow GLib. You can install them by the followings:
+
+On Debian GNU/Linux or Ubuntu:
+
+```text
+% sudo apt install -y -V gtk-doc-tools libgirepository1.0-dev
+```
+
+On CentOS 7 or later:
+
+```text
+% sudo yum install -y gtk-doc gobject-introspection-devel
+```
+
+On macOS with [Homebrew](https://brew.sh/):
+
+```text
+% brew install -y gtk-doc gobject-introspection
+```
+
+Now, you can build Arrow GLib:
+
+```text
+% cd glib
+% ./configure --enable-gtk-doc
+% make
+% sudo make install
+```
+
+## Usage
+
+You can use Arrow GLib with C or other languages. If you use Arrow
+GLib with C, you use C API. If you use Arrow GLib with other
+languages, you use GObject Introspection based bindings.
+
+### C
+
+You can find API reference in the
+`/usr/local/share/gtk-doc/html/arrow-glib/` directory. If you specify
+`--prefix` to `configure`, the directory will be different.
+
+You can find example codes in the `example/` directory.
+
+### Language bindings
+
+You can use Arrow GLib with non C languages with GObject Introspection
+based bindings. Here are languages that support GObject Introspection:
+
+ * Ruby: [red-arrow gem](https://rubygems.org/gems/red-arrow) should be used.
+
+ * Python: [PyGObject](https://wiki.gnome.org/Projects/PyGObject) should be used. (Note that you should use PyArrow than Arrow GLib.)
+
+ * Lua: [LGI](https://github.com/pavouk/lgi) should be used.
+
+ * Go: [Go-gir-generator](https://github.com/linuxdeepin/go-gir-generator) should be used.
+
+See also
+[Projects/GObjectIntrospection/Users - GNOME Wiki!](https://wiki.gnome.org/Projects/GObjectIntrospection/Users)
+for other languages.
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/Makefile.am
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/Makefile.am b/c_glib/arrow-glib/Makefile.am
new file mode 100644
index 0000000..61137a0
--- /dev/null
+++ b/c_glib/arrow-glib/Makefile.am
@@ -0,0 +1,494 @@
+# 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.
+
+CLEANFILES =
+
+EXTRA_DIST =
+
+AM_CPPFLAGS = \
+ -I$(top_builddir) \
+ -I$(top_srcdir)
+
+AM_CFLAGS = \
+ $(GLIB_CFLAGS) \
+ $(GARROW_CFLAGS)
+
+# libarrow-glib
+lib_LTLIBRARIES = \
+ libarrow-glib.la
+
+libarrow_glib_la_CXXFLAGS = \
+ $(GLIB_CFLAGS) \
+ $(ARROW_CFLAGS) \
+ $(GARROW_CXXFLAGS)
+
+libarrow_glib_la_LIBADD = \
+ $(GLIB_LIBS) \
+ $(ARROW_LIBS)
+
+libarrow_glib_la_headers = \
+ array.h \
+ array-builder.h \
+ arrow-glib.h \
+ chunked-array.h \
+ column.h \
+ binary-array.h \
+ binary-array-builder.h \
+ binary-data-type.h \
+ boolean-array.h \
+ boolean-array-builder.h \
+ boolean-data-type.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 \
+ 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
+
+libarrow_glib_la_generated_headers = \
+ enums.h
+
+libarrow_glib_la_generated_sources = \
+ enums.c \
+ $(libarrow_glib_la_generated_headers)
+
+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 \
+ 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 \
+ 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) \
+ $(libarrow_glib_la_generated_sources)
+
+libarrow_glib_la_cpp_headers = \
+ array.hpp \
+ array-builder.hpp \
+ arrow-glib.hpp \
+ chunked-array.hpp \
+ column.hpp \
+ data-type.hpp \
+ error.hpp \
+ field.hpp \
+ record-batch.hpp \
+ schema.hpp \
+ table.hpp \
+ type.hpp
+
+libarrow_glib_la_SOURCES = \
+ $(libarrow_glib_la_sources) \
+ $(libarrow_glib_la_cpp_headers)
+
+BUILT_SOURCES = \
+ $(libarrow_glib_la_genearted_sources) \
+ stamp-enums.c \
+ stamp-enums.h
+
+EXTRA_DIST += \
+ enums.c.template \
+ enums.h.template
+
+enums.h: stamp-enums.h
+ @true
+stamp-enums.h: $(libarrow_glib_la_headers) enums.h.template
+ $(AM_V_GEN) \
+ (cd $(srcdir) && \
+ $(GLIB_MKENUMS) \
+ --identifier-prefix GArrow \
+ --symbol-prefix garrow \
+ --template enums.h.template \
+ $(libarrow_glib_la_headers)) > enums.h
+ touch $@
+
+enums.c: stamp-enums.c
+ @true
+stamp-enums.c: $(libarrow_glib_la_headers) enums.c.template
+ $(AM_V_GEN) \
+ (cd $(srcdir) && \
+ $(GLIB_MKENUMS) \
+ --identifier-prefix GArrow \
+ --symbol-prefix garrow \
+ --template enums.c.template \
+ $(libarrow_glib_la_headers)) > enums.c
+ touch $@
+
+# libarrow-io-glib
+lib_LTLIBRARIES += \
+ libarrow-io-glib.la
+
+libarrow_io_glib_la_CXXFLAGS = \
+ $(GLIB_CFLAGS) \
+ $(ARROW_IO_CFLAGS) \
+ $(GARROW_CXXFLAGS)
+
+libarrow_io_glib_la_LIBADD = \
+ $(GLIB_LIBS) \
+ $(ARROW_IO_LIBS)
+
+libarrow_io_glib_la_headers = \
+ arrow-io-glib.h \
+ io-file.h \
+ io-file-mode.h \
+ io-file-output-stream.h \
+ io-input-stream.h \
+ io-memory-mapped-file.h \
+ io-output-stream.h \
+ io-readable.h \
+ io-readable-file.h \
+ io-writeable.h \
+ io-writeable-file.h
+
+libarrow_io_glib_la_generated_headers = \
+ io-enums.h
+
+libarrow_io_glib_la_generated_sources = \
+ io-enums.c \
+ $(libarrow_io_glib_la_generated_headers)
+
+libarrow_io_glib_la_sources = \
+ io-file.cpp \
+ io-file-mode.cpp \
+ io-file-output-stream.cpp \
+ io-input-stream.cpp \
+ io-memory-mapped-file.cpp \
+ io-output-stream.cpp \
+ io-readable.cpp \
+ io-readable-file.cpp \
+ io-writeable.cpp \
+ io-writeable-file.cpp \
+ $(libarrow_io_glib_la_headers) \
+ $(libarrow_io_glib_la_generated_sources)
+
+libarrow_io_glib_la_cpp_headers = \
+ arrow-io-glib.hpp \
+ io-file.hpp \
+ io-file-mode.hpp \
+ io-file-output-stream.hpp \
+ io-input-stream.hpp \
+ io-memory-mapped-file.hpp \
+ io-output-stream.hpp \
+ io-readable.hpp \
+ io-readable-file.hpp \
+ io-writeable.hpp \
+ io-writeable-file.hpp
+
+libarrow_io_glib_la_SOURCES = \
+ $(libarrow_io_glib_la_sources) \
+ $(libarrow_io_glib_la_cpp_headers)
+
+BUILT_SOURCES += \
+ $(libarrow_io_glib_la_genearted_sources) \
+ stamp-io-enums.c \
+ stamp-io-enums.h
+
+EXTRA_DIST += \
+ io-enums.c.template \
+ io-enums.h.template
+
+io-enums.h: stamp-io-enums.h
+ @true
+stamp-io-enums.h: $(libarrow_io_glib_la_headers) io-enums.h.template
+ $(AM_V_GEN) \
+ (cd $(srcdir) && \
+ $(GLIB_MKENUMS) \
+ --identifier-prefix GArrowIO \
+ --symbol-prefix garrow_io \
+ --template io-enums.h.template \
+ $(libarrow_io_glib_la_headers)) > io-enums.h
+ touch $@
+
+io-enums.c: stamp-io-enums.c
+ @true
+stamp-io-enums.c: $(libarrow_io_glib_la_headers) io-enums.c.template
+ $(AM_V_GEN) \
+ (cd $(srcdir) && \
+ $(GLIB_MKENUMS) \
+ --identifier-prefix GArrowIO \
+ --symbol-prefix garrow_io \
+ --template io-enums.c.template \
+ $(libarrow_io_glib_la_headers)) > io-enums.c
+ touch $@
+
+# libarrow-ipc-glib
+lib_LTLIBRARIES += \
+ libarrow-ipc-glib.la
+
+libarrow_ipc_glib_la_CXXFLAGS = \
+ $(GLIB_CFLAGS) \
+ $(ARROW_IPC_CFLAGS) \
+ $(GARROW_CXXFLAGS)
+
+libarrow_ipc_glib_la_LIBADD = \
+ $(GLIB_LIBS) \
+ $(ARROW_IPC_LIBS)
+
+libarrow_ipc_glib_la_headers = \
+ arrow-ipc-glib.h \
+ ipc-file-reader.h \
+ ipc-file-writer.h \
+ ipc-stream-reader.h \
+ ipc-stream-writer.h \
+ ipc-metadata-version.h
+
+libarrow_ipc_glib_la_generated_headers = \
+ ipc-enums.h
+
+libarrow_ipc_glib_la_generated_sources = \
+ ipc-enums.c \
+ $(libarrow_ipc_glib_la_generated_headers)
+
+libarrow_ipc_glib_la_sources = \
+ ipc-file-reader.cpp \
+ ipc-file-writer.cpp \
+ ipc-metadata-version.cpp \
+ ipc-stream-reader.cpp \
+ ipc-stream-writer.cpp \
+ $(libarrow_ipc_glib_la_headers) \
+ $(libarrow_ipc_glib_la_generated_sources)
+
+libarrow_ipc_glib_la_cpp_headers = \
+ arrow-ipc-glib.hpp \
+ ipc-file-reader.hpp \
+ ipc-file-writer.hpp \
+ ipc-metadata-version.hpp \
+ ipc-stream-reader.hpp \
+ ipc-stream-writer.hpp
+
+libarrow_ipc_glib_la_SOURCES = \
+ $(libarrow_ipc_glib_la_sources) \
+ $(libarrow_ipc_glib_la_cpp_headers)
+
+BUILT_SOURCES += \
+ $(libarrow_ipc_glib_la_genearted_sources) \
+ stamp-ipc-enums.c \
+ stamp-ipc-enums.h
+
+EXTRA_DIST += \
+ ipc-enums.c.template \
+ ipc-enums.h.template
+
+ipc-enums.h: stamp-ipc-enums.h
+ @true
+stamp-ipc-enums.h: $(libarrow_ipc_glib_la_headers) ipc-enums.h.template
+ $(AM_V_GEN) \
+ (cd $(srcdir) && \
+ $(GLIB_MKENUMS) \
+ --identifier-prefix GArrowIPC \
+ --symbol-prefix garrow_ipc \
+ --template ipc-enums.h.template \
+ $(libarrow_ipc_glib_la_headers)) > ipc-enums.h
+ touch $@
+
+ipc-enums.c: stamp-ipc-enums.c
+ @true
+stamp-ipc-enums.c: $(libarrow_ipc_glib_la_headers) ipc-enums.c.template
+ $(AM_V_GEN) \
+ (cd $(srcdir) && \
+ $(GLIB_MKENUMS) \
+ --identifier-prefix GArrowIPC \
+ --symbol-prefix garrow_ipc \
+ --template ipc-enums.c.template \
+ $(libarrow_ipc_glib_la_headers)) > ipc-enums.c
+ touch $@
+
+pkginclude_HEADERS = \
+ $(libarrow_glib_la_headers) \
+ $(libarrow_glib_la_cpp_headers) \
+ $(libarrow_glib_la_generated_headers) \
+ $(libarrow_io_glib_la_headers) \
+ $(libarrow_io_glib_la_cpp_headers) \
+ $(libarrow_io_glib_la_generated_headers) \
+ $(libarrow_ipc_glib_la_headers) \
+ $(libarrow_ipc_glib_la_cpp_headers) \
+ $(libarrow_ipc_glib_la_generated_headers)
+
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = \
+ arrow-glib.pc \
+ arrow-io-glib.pc \
+ arrow-ipc-glib.pc
+
+# GObject Introspection
+-include $(INTROSPECTION_MAKEFILE)
+INTROSPECTION_GIRS =
+INTROSPECTION_SCANNER_ARGS =
+INTROSPECTION_COMPILER_ARGS =
+
+if HAVE_INTROSPECTION
+Arrow-1.0.gir: libarrow-glib.la
+Arrow_1_0_gir_PACKAGES = \
+ gobject-2.0
+Arrow_1_0_gir_EXPORT_PACKAGES = arrow
+Arrow_1_0_gir_INCLUDES = GObject-2.0
+Arrow_1_0_gir_CFLAGS = \
+ $(AM_CPPFLAGS)
+Arrow_1_0_gir_LIBS = libarrow-glib.la
+Arrow_1_0_gir_FILES = $(libarrow_glib_la_sources)
+Arrow_1_0_gir_SCANNERFLAGS = \
+ --warn-all \
+ --identifier-prefix=GArrow \
+ --symbol-prefix=garrow
+INTROSPECTION_GIRS += Arrow-1.0.gir
+
+ArrowIO-1.0.gir: libarrow-io-glib.la
+ArrowIO-1.0.gir: Arrow-1.0.gir
+ArrowIO_1_0_gir_PACKAGES = \
+ gobject-2.0
+ArrowIO_1_0_gir_EXPORT_PACKAGES = arrow-io
+ArrowIO_1_0_gir_INCLUDES = \
+ GObject-2.0
+ArrowIO_1_0_gir_CFLAGS = \
+ $(AM_CPPFLAGS)
+ArrowIO_1_0_gir_LIBS = \
+ libarrow-io-glib.la \
+ libarrow-glib.la
+ArrowIO_1_0_gir_FILES = $(libarrow_io_glib_la_sources)
+ArrowIO_1_0_gir_SCANNERFLAGS = \
+ --include-uninstalled=$(builddir)/Arrow-1.0.gir \
+ --warn-all \
+ --identifier-prefix=GArrowIO \
+ --symbol-prefix=garrow_io
+INTROSPECTION_GIRS += ArrowIO-1.0.gir
+
+ArrowIPC-1.0.gir: libarrow-ipc-glib.la
+ArrowIPC-1.0.gir: Arrow-1.0.gir
+ArrowIPC-1.0.gir: ArrowIO-1.0.gir
+ArrowIPC_1_0_gir_PACKAGES = \
+ gobject-2.0
+ArrowIPC_1_0_gir_EXPORT_PACKAGES = arrow-ipc
+ArrowIPC_1_0_gir_INCLUDES = \
+ GObject-2.0
+ArrowIPC_1_0_gir_CFLAGS = \
+ $(AM_CPPFLAGS)
+ArrowIPC_1_0_gir_LIBS = \
+ libarrow-ipc-glib.la \
+ libarrow-io-glib.la \
+ libarrow-glib.la
+ArrowIPC_1_0_gir_FILES = $(libarrow_ipc_glib_la_sources)
+ArrowIPC_1_0_gir_SCANNERFLAGS = \
+ --include-uninstalled=$(builddir)/Arrow-1.0.gir \
+ --include-uninstalled=$(builddir)/ArrowIO-1.0.gir \
+ --warn-all \
+ --identifier-prefix=GArrowIPC \
+ --symbol-prefix=garrow_ipc
+INTROSPECTION_GIRS += ArrowIPC-1.0.gir
+
+girdir = $(datadir)/gir-1.0
+gir_DATA = $(INTROSPECTION_GIRS)
+
+typelibdir = $(libdir)/girepository-1.0
+typelib_DATA = $(INTROSPECTION_GIRS:.gir=.typelib)
+
+CLEANFILES += \
+ $(gir_DATA) \
+ $(typelib_DATA)
+endif
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/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
new file mode 100644
index 0000000..0f038c8
--- /dev/null
+++ b/c_glib/arrow-glib/array-builder.cpp
@@ -0,0 +1,229 @@
+/*
+ * 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-builder.hpp>
+#include <arrow-glib/binary-array-builder.h>
+#include <arrow-glib/boolean-array-builder.h>
+#include <arrow-glib/double-array-builder.h>
+#include <arrow-glib/float-array-builder.h>
+#include <arrow-glib/int8-array-builder.h>
+#include <arrow-glib/int16-array-builder.h>
+#include <arrow-glib/int32-array-builder.h>
+#include <arrow-glib/int64-array-builder.h>
+#include <arrow-glib/list-array-builder.h>
+#include <arrow-glib/string-array-builder.h>
+#include <arrow-glib/struct-array-builder.h>
+#include <arrow-glib/uint8-array-builder.h>
+#include <arrow-glib/uint16-array-builder.h>
+#include <arrow-glib/uint32-array-builder.h>
+#include <arrow-glib/uint64-array-builder.h>
+
+G_BEGIN_DECLS
+
+/**
+ * SECTION: array-builder
+ * @short_description: Base class for all array builder classes.
+ *
+ * #GArrowArrayBuilder is a base class for all array builder classes
+ * such as #GArrowBooleanArrayBuilder.
+ *
+ * You need to use array builder class to create a new array.
+ */
+
+typedef struct GArrowArrayBuilderPrivate_ {
+ std::shared_ptr<arrow::ArrayBuilder> array_builder;
+} GArrowArrayBuilderPrivate;
+
+enum {
+ PROP_0,
+ PROP_ARRAY_BUILDER
+};
+
+G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE(GArrowArrayBuilder,
+ garrow_array_builder,
+ G_TYPE_OBJECT)
+
+#define GARROW_ARRAY_BUILDER_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE((obj), \
+ GARROW_TYPE_ARRAY_BUILDER, \
+ GArrowArrayBuilderPrivate))
+
+static void
+garrow_array_builder_finalize(GObject *object)
+{
+ GArrowArrayBuilderPrivate *priv;
+
+ priv = GARROW_ARRAY_BUILDER_GET_PRIVATE(object);
+
+ priv->array_builder = nullptr;
+
+ G_OBJECT_CLASS(garrow_array_builder_parent_class)->finalize(object);
+}
+
+static void
+garrow_array_builder_set_property(GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ GArrowArrayBuilderPrivate *priv;
+
+ priv = GARROW_ARRAY_BUILDER_GET_PRIVATE(object);
+
+ switch (prop_id) {
+ case PROP_ARRAY_BUILDER:
+ priv->array_builder =
+ *static_cast<std::shared_ptr<arrow::ArrayBuilder> *>(g_value_get_pointer(value));
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+ break;
+ }
+}
+
+static void
+garrow_array_builder_get_property(GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ switch (prop_id) {
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+ break;
+ }
+}
+
+static void
+garrow_array_builder_init(GArrowArrayBuilder *builder)
+{
+}
+
+static void
+garrow_array_builder_class_init(GArrowArrayBuilderClass *klass)
+{
+ GObjectClass *gobject_class;
+ GParamSpec *spec;
+
+ gobject_class = G_OBJECT_CLASS(klass);
+
+ gobject_class->finalize = garrow_array_builder_finalize;
+ gobject_class->set_property = garrow_array_builder_set_property;
+ gobject_class->get_property = garrow_array_builder_get_property;
+
+ spec = g_param_spec_pointer("array-builder",
+ "Array builder",
+ "The raw std::shared<arrow::ArrayBuilder> *",
+ static_cast<GParamFlags>(G_PARAM_WRITABLE |
+ G_PARAM_CONSTRUCT_ONLY));
+ g_object_class_install_property(gobject_class, PROP_ARRAY_BUILDER, spec);
+}
+
+/**
+ * garrow_array_builder_finish:
+ * @builder: A #GArrowArrayBuilder.
+ *
+ * Returns: (transfer full): The built #GArrowArray.
+ */
+GArrowArray *
+garrow_array_builder_finish(GArrowArrayBuilder *builder)
+{
+ auto arrow_builder = garrow_array_builder_get_raw(builder);
+ std::shared_ptr<arrow::Array> arrow_array;
+ arrow_builder->Finish(&arrow_array);
+ return garrow_array_new_raw(&arrow_array);
+}
+
+G_END_DECLS
+
+GArrowArrayBuilder *
+garrow_array_builder_new_raw(std::shared_ptr<arrow::ArrayBuilder> *arrow_builder)
+{
+ GType type;
+
+ switch ((*arrow_builder)->type()->type) {
+ case arrow::Type::type::BOOL:
+ type = GARROW_TYPE_BOOLEAN_ARRAY_BUILDER;
+ break;
+ case arrow::Type::type::UINT8:
+ type = GARROW_TYPE_UINT8_ARRAY_BUILDER;
+ break;
+ case arrow::Type::type::INT8:
+ type = GARROW_TYPE_INT8_ARRAY_BUILDER;
+ break;
+ case arrow::Type::type::UINT16:
+ type = GARROW_TYPE_UINT16_ARRAY_BUILDER;
+ break;
+ case arrow::Type::type::INT16:
+ type = GARROW_TYPE_INT16_ARRAY_BUILDER;
+ break;
+ case arrow::Type::type::UINT32:
+ type = GARROW_TYPE_UINT32_ARRAY_BUILDER;
+ break;
+ case arrow::Type::type::INT32:
+ type = GARROW_TYPE_INT32_ARRAY_BUILDER;
+ break;
+ case arrow::Type::type::UINT64:
+ type = GARROW_TYPE_UINT64_ARRAY_BUILDER;
+ break;
+ case arrow::Type::type::INT64:
+ type = GARROW_TYPE_INT64_ARRAY_BUILDER;
+ break;
+ case arrow::Type::type::FLOAT:
+ type = GARROW_TYPE_FLOAT_ARRAY_BUILDER;
+ break;
+ case arrow::Type::type::DOUBLE:
+ type = GARROW_TYPE_DOUBLE_ARRAY_BUILDER;
+ break;
+ case arrow::Type::type::BINARY:
+ type = GARROW_TYPE_BINARY_ARRAY_BUILDER;
+ break;
+ case arrow::Type::type::STRING:
+ type = GARROW_TYPE_STRING_ARRAY_BUILDER;
+ break;
+ case arrow::Type::type::LIST:
+ type = GARROW_TYPE_LIST_ARRAY_BUILDER;
+ break;
+ case arrow::Type::type::STRUCT:
+ type = GARROW_TYPE_STRUCT_ARRAY_BUILDER;
+ break;
+ default:
+ type = GARROW_TYPE_ARRAY_BUILDER;
+ break;
+ }
+
+ auto builder =
+ GARROW_ARRAY_BUILDER(g_object_new(type,
+ "array-builder", arrow_builder,
+ NULL));
+ return builder;
+}
+
+std::shared_ptr<arrow::ArrayBuilder>
+garrow_array_builder_get_raw(GArrowArrayBuilder *builder)
+{
+ GArrowArrayBuilderPrivate *priv;
+
+ priv = GARROW_ARRAY_BUILDER_GET_PRIVATE(builder);
+ return priv->array_builder;
+}
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/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
new file mode 100644
index 0000000..3717aef
--- /dev/null
+++ b/c_glib/arrow-glib/array-builder.h
@@ -0,0 +1,70 @@
+/*
+ * 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_ARRAY_BUILDER \
+ (garrow_array_builder_get_type())
+#define GARROW_ARRAY_BUILDER(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj), \
+ GARROW_TYPE_ARRAY_BUILDER, \
+ GArrowArrayBuilder))
+#define GARROW_ARRAY_BUILDER_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST((klass), \
+ GARROW_TYPE_ARRAY_BUILDER, \
+ GArrowArrayBuilderClass))
+#define GARROW_IS_ARRAY_BUILDER(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj), \
+ GARROW_TYPE_ARRAY_BUILDER))
+#define GARROW_IS_ARRAY_BUILDER_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE((klass), \
+ GARROW_TYPE_ARRAY_BUILDER))
+#define GARROW_ARRAY_BUILDER_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS((obj), \
+ GARROW_TYPE_ARRAY_BUILDER, \
+ GArrowArrayBuilderClass))
+
+typedef struct _GArrowArrayBuilder GArrowArrayBuilder;
+typedef struct _GArrowArrayBuilderClass GArrowArrayBuilderClass;
+
+/**
+ * GArrowArrayBuilder:
+ *
+ * It wraps `arrow::ArrayBuilder`.
+ */
+struct _GArrowArrayBuilder
+{
+ /*< private >*/
+ GObject parent_instance;
+};
+
+struct _GArrowArrayBuilderClass
+{
+ GObjectClass parent_class;
+};
+
+GType garrow_array_builder_get_type (void) G_GNUC_CONST;
+
+GArrowArray *garrow_array_builder_finish (GArrowArrayBuilder *builder);
+
+G_END_DECLS
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/array-builder.hpp
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/array-builder.hpp b/c_glib/arrow-glib/array-builder.hpp
new file mode 100644
index 0000000..becebb2
--- /dev/null
+++ b/c_glib/arrow-glib/array-builder.hpp
@@ -0,0 +1,26 @@
+/*
+ * 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.hpp>
+#include <arrow-glib/array-builder.h>
+
+GArrowArrayBuilder *garrow_array_builder_new_raw(std::shared_ptr<arrow::ArrayBuilder> *arrow_builder);
+std::shared_ptr<arrow::ArrayBuilder> garrow_array_builder_get_raw(GArrowArrayBuilder *builder);
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/array.cpp
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/array.cpp b/c_glib/arrow-glib/array.cpp
new file mode 100644
index 0000000..5dacb07
--- /dev/null
+++ b/c_glib/arrow-glib/array.cpp
@@ -0,0 +1,268 @@
+/*
+ * 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>
+#include <arrow-glib/boolean-array.h>
+#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/uint8-array.h>
+#include <arrow-glib/uint16-array.h>
+#include <arrow-glib/uint32-array.h>
+#include <arrow-glib/uint64-array.h>
+
+#include <iostream>
+
+G_BEGIN_DECLS
+
+/**
+ * SECTION: array
+ * @short_description: Base class for all array classes
+ *
+ * #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.
+ */
+
+typedef struct GArrowArrayPrivate_ {
+ std::shared_ptr<arrow::Array> array;
+} GArrowArrayPrivate;
+
+enum {
+ PROP_0,
+ PROP_ARRAY
+};
+
+G_DEFINE_TYPE_WITH_PRIVATE(GArrowArray, garrow_array, G_TYPE_OBJECT)
+
+#define GARROW_ARRAY_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE((obj), GARROW_TYPE_ARRAY, GArrowArrayPrivate))
+
+static void
+garrow_array_finalize(GObject *object)
+{
+ auto priv = GARROW_ARRAY_GET_PRIVATE(object);
+
+ priv->array = nullptr;
+
+ G_OBJECT_CLASS(garrow_array_parent_class)->finalize(object);
+}
+
+static void
+garrow_array_set_property(GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ auto priv = GARROW_ARRAY_GET_PRIVATE(object);
+
+ switch (prop_id) {
+ case PROP_ARRAY:
+ priv->array =
+ *static_cast<std::shared_ptr<arrow::Array> *>(g_value_get_pointer(value));
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+ break;
+ }
+}
+
+static void
+garrow_array_get_property(GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ switch (prop_id) {
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+ break;
+ }
+}
+
+static void
+garrow_array_init(GArrowArray *object)
+{
+}
+
+static void
+garrow_array_class_init(GArrowArrayClass *klass)
+{
+ GParamSpec *spec;
+
+ auto gobject_class = G_OBJECT_CLASS(klass);
+
+ gobject_class->finalize = garrow_array_finalize;
+ gobject_class->set_property = garrow_array_set_property;
+ gobject_class->get_property = garrow_array_get_property;
+
+ spec = g_param_spec_pointer("array",
+ "Array",
+ "The raw std::shared<arrow::Array> *",
+ static_cast<GParamFlags>(G_PARAM_WRITABLE |
+ G_PARAM_CONSTRUCT_ONLY));
+ g_object_class_install_property(gobject_class, PROP_ARRAY, spec);
+}
+
+/**
+ * garrow_array_get_length:
+ * @array: A #GArrowArray.
+ *
+ * Returns: The number of rows in the array.
+ */
+gint64
+garrow_array_get_length(GArrowArray *array)
+{
+ auto arrow_array = garrow_array_get_raw(array);
+ return arrow_array->length();
+}
+
+/**
+ * garrow_array_get_offset:
+ * @array: A #GArrowArray.
+ *
+ * Returns: The number of values in the array.
+ */
+gint64
+garrow_array_get_offset(GArrowArray *array)
+{
+ auto arrow_array = garrow_array_get_raw(array);
+ return arrow_array->offset();
+}
+
+/**
+ * garrow_array_get_n_nulls:
+ * @array: A #GArrowArray.
+ *
+ * Returns: The number of NULLs in the array.
+ */
+gint64
+garrow_array_get_n_nulls(GArrowArray *array)
+{
+ auto arrow_array = garrow_array_get_raw(array);
+ return arrow_array->null_count();
+}
+
+/**
+ * garrow_array_slice:
+ * @array: A #GArrowArray.
+ * @offset: The offset of sub #GArrowArray.
+ * @length: The length of sub #GArrowArray.
+ *
+ * Returns: (transfer full): The sub #GArrowArray. It covers only from
+ * `offset` to `offset + length` range. The sub #GArrowArray shares
+ * values with the base #GArrowArray.
+ */
+GArrowArray *
+garrow_array_slice(GArrowArray *array,
+ gint64 offset,
+ gint64 length)
+{
+ const auto arrow_array = garrow_array_get_raw(array);
+ auto arrow_sub_array = arrow_array->Slice(offset, length);
+ return garrow_array_new_raw(&arrow_sub_array);
+}
+
+G_END_DECLS
+
+GArrowArray *
+garrow_array_new_raw(std::shared_ptr<arrow::Array> *arrow_array)
+{
+ GType type;
+ GArrowArray *array;
+
+ switch ((*arrow_array)->type_enum()) {
+ case arrow::Type::type::NA:
+ type = GARROW_TYPE_NULL_ARRAY;
+ break;
+ case arrow::Type::type::BOOL:
+ type = GARROW_TYPE_BOOLEAN_ARRAY;
+ break;
+ case arrow::Type::type::UINT8:
+ type = GARROW_TYPE_UINT8_ARRAY;
+ break;
+ case arrow::Type::type::INT8:
+ type = GARROW_TYPE_INT8_ARRAY;
+ break;
+ case arrow::Type::type::UINT16:
+ type = GARROW_TYPE_UINT16_ARRAY;
+ break;
+ case arrow::Type::type::INT16:
+ type = GARROW_TYPE_INT16_ARRAY;
+ break;
+ case arrow::Type::type::UINT32:
+ type = GARROW_TYPE_UINT32_ARRAY;
+ break;
+ case arrow::Type::type::INT32:
+ type = GARROW_TYPE_INT32_ARRAY;
+ break;
+ case arrow::Type::type::UINT64:
+ type = GARROW_TYPE_UINT64_ARRAY;
+ break;
+ case arrow::Type::type::INT64:
+ type = GARROW_TYPE_INT64_ARRAY;
+ break;
+ case arrow::Type::type::FLOAT:
+ type = GARROW_TYPE_FLOAT_ARRAY;
+ break;
+ case arrow::Type::type::DOUBLE:
+ type = GARROW_TYPE_DOUBLE_ARRAY;
+ break;
+ case arrow::Type::type::BINARY:
+ type = GARROW_TYPE_BINARY_ARRAY;
+ break;
+ case arrow::Type::type::STRING:
+ type = GARROW_TYPE_STRING_ARRAY;
+ break;
+ case arrow::Type::type::LIST:
+ type = GARROW_TYPE_LIST_ARRAY;
+ break;
+ case arrow::Type::type::STRUCT:
+ type = GARROW_TYPE_STRUCT_ARRAY;
+ break;
+ default:
+ type = GARROW_TYPE_ARRAY;
+ break;
+ }
+ array = GARROW_ARRAY(g_object_new(type,
+ "array", arrow_array,
+ NULL));
+ return array;
+}
+
+std::shared_ptr<arrow::Array>
+garrow_array_get_raw(GArrowArray *array)
+{
+ auto priv = GARROW_ARRAY_GET_PRIVATE(array);
+ return priv->array;
+}
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/array.h
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/array.h b/c_glib/arrow-glib/array.h
new file mode 100644
index 0000000..9b1fa7e
--- /dev/null
+++ b/c_glib/arrow-glib/array.h
@@ -0,0 +1,67 @@
+/*
+ * 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 <glib-object.h>
+
+G_BEGIN_DECLS
+
+#define GARROW_TYPE_ARRAY \
+ (garrow_array_get_type())
+#define GARROW_ARRAY(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj), GARROW_TYPE_ARRAY, GArrowArray))
+#define GARROW_ARRAY_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST((klass), GARROW_TYPE_ARRAY, GArrowArrayClass))
+#define GARROW_IS_ARRAY(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj), GARROW_TYPE_ARRAY))
+#define GARROW_IS_ARRAY_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE((klass), GARROW_TYPE_ARRAY))
+#define GARROW_ARRAY_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS((obj), GARROW_TYPE_ARRAY, GArrowArrayClass))
+
+typedef struct _GArrowArray GArrowArray;
+typedef struct _GArrowArrayClass GArrowArrayClass;
+
+/**
+ * GArrowArray:
+ *
+ * It wraps `arrow::Array`.
+ */
+struct _GArrowArray
+{
+ /*< private >*/
+ GObject parent_instance;
+};
+
+struct _GArrowArrayClass
+{
+ GObjectClass parent_class;
+};
+
+GType garrow_array_get_type (void) G_GNUC_CONST;
+
+gint64 garrow_array_get_length (GArrowArray *array);
+gint64 garrow_array_get_offset (GArrowArray *array);
+gint64 garrow_array_get_n_nulls (GArrowArray *array);
+GArrowArray *garrow_array_slice (GArrowArray *array,
+ gint64 offset,
+ gint64 length);
+
+G_END_DECLS
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/array.hpp
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/array.hpp b/c_glib/arrow-glib/array.hpp
new file mode 100644
index 0000000..d2dff22
--- /dev/null
+++ b/c_glib/arrow-glib/array.hpp
@@ -0,0 +1,27 @@
+/*
+ * 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/api.h>
+
+#include <arrow-glib/array.h>
+
+GArrowArray *garrow_array_new_raw(std::shared_ptr<arrow::Array> *arrow_array);
+std::shared_ptr<arrow::Array> garrow_array_get_raw(GArrowArray *array);
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/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
new file mode 100644
index 0000000..4356234
--- /dev/null
+++ b/c_glib/arrow-glib/arrow-glib.h
@@ -0,0 +1,80 @@
+/*
+ * 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>
+#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/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/39c7274f/c_glib/arrow-glib/arrow-glib.hpp
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/arrow-glib.hpp b/c_glib/arrow-glib/arrow-glib.hpp
new file mode 100644
index 0000000..70fda8d
--- /dev/null
+++ b/c_glib/arrow-glib/arrow-glib.hpp
@@ -0,0 +1,37 @@
+/*
+ * 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/arrow-glib.h>
+#include <arrow-glib/array.hpp>
+#include <arrow-glib/array-builder.hpp>
+#include <arrow-glib/boolean-array.hpp>
+#include <arrow-glib/boolean-data-type.hpp>
+#include <arrow-glib/chunked-array.hpp>
+#include <arrow-glib/column.hpp>
+#include <arrow-glib/data-type.hpp>
+#include <arrow-glib/double-array.hpp>
+#include <arrow-glib/error.hpp>
+#include <arrow-glib/field.hpp>
+#include <arrow-glib/float-array.hpp>
+#include <arrow-glib/record-batch.h>
+#include <arrow-glib/schema.hpp>
+#include <arrow-glib/table.hpp>
+#include <arrow-glib/type.hpp>
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/arrow-glib.pc.in
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/arrow-glib.pc.in b/c_glib/arrow-glib/arrow-glib.pc.in
new file mode 100644
index 0000000..f9f27b2
--- /dev/null
+++ b/c_glib/arrow-glib/arrow-glib.pc.in
@@ -0,0 +1,28 @@
+# 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.
+
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: Apache Arrow GLib
+Description: C API for Apache Arrow based on GLib
+Version: @VERSION@
+Libs: -L${libdir} -larrow-glib
+Cflags: -I${includedir}
+Requires: gobject-2.0 arrow
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/arrow-io-glib.h
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/arrow-io-glib.h b/c_glib/arrow-glib/arrow-io-glib.h
new file mode 100644
index 0000000..e02aa9b
--- /dev/null
+++ b/c_glib/arrow-glib/arrow-io-glib.h
@@ -0,0 +1,32 @@
+/*
+ * 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/io-enums.h>
+#include <arrow-glib/io-file.h>
+#include <arrow-glib/io-file-mode.h>
+#include <arrow-glib/io-file-output-stream.h>
+#include <arrow-glib/io-input-stream.h>
+#include <arrow-glib/io-memory-mapped-file.h>
+#include <arrow-glib/io-output-stream.h>
+#include <arrow-glib/io-readable.h>
+#include <arrow-glib/io-readable-file.h>
+#include <arrow-glib/io-writeable.h>
+#include <arrow-glib/io-writeable-file.h>
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/arrow-io-glib.hpp
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/arrow-io-glib.hpp b/c_glib/arrow-glib/arrow-io-glib.hpp
new file mode 100644
index 0000000..378f202
--- /dev/null
+++ b/c_glib/arrow-glib/arrow-io-glib.hpp
@@ -0,0 +1,30 @@
+/*
+ * 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/io-file.hpp>
+#include <arrow-glib/io-file-mode.hpp>
+#include <arrow-glib/io-file-output-stream.hpp>
+#include <arrow-glib/io-input-stream.hpp>
+#include <arrow-glib/io-memory-mapped-file.hpp>
+#include <arrow-glib/io-output-stream.hpp>
+#include <arrow-glib/io-readable.hpp>
+#include <arrow-glib/io-readable-file.hpp>
+#include <arrow-glib/io-writeable.hpp>
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/arrow-io-glib.pc.in
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/arrow-io-glib.pc.in b/c_glib/arrow-glib/arrow-io-glib.pc.in
new file mode 100644
index 0000000..4256184
--- /dev/null
+++ b/c_glib/arrow-glib/arrow-io-glib.pc.in
@@ -0,0 +1,28 @@
+# 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.
+
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: Apache Arrow I/O GLib
+Description: C API for Apache Arrow I/O based on GLib
+Version: @VERSION@
+Libs: -L${libdir} -larrow-glib-io
+Cflags: -I${includedir}
+Requires: arrow-glib arrow-io
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/arrow-ipc-glib.h
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/arrow-ipc-glib.h b/c_glib/arrow-glib/arrow-ipc-glib.h
new file mode 100644
index 0000000..4954d83
--- /dev/null
+++ b/c_glib/arrow-glib/arrow-ipc-glib.h
@@ -0,0 +1,27 @@
+/*
+ * 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/ipc-enums.h>
+#include <arrow-glib/ipc-file-reader.h>
+#include <arrow-glib/ipc-file-writer.h>
+#include <arrow-glib/ipc-metadata-version.h>
+#include <arrow-glib/ipc-stream-reader.h>
+#include <arrow-glib/ipc-stream-writer.h>
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/arrow-ipc-glib.hpp
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/arrow-ipc-glib.hpp b/c_glib/arrow-glib/arrow-ipc-glib.hpp
new file mode 100644
index 0000000..d32bc05
--- /dev/null
+++ b/c_glib/arrow-glib/arrow-ipc-glib.hpp
@@ -0,0 +1,30 @@
+/*
+ * 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/arrow-glib.hpp>
+
+#include <arrow-glib/arrow-io-glib.hpp>
+
+#include <arrow-glib/ipc-file-reader.hpp>
+#include <arrow-glib/ipc-file-writer.hpp>
+#include <arrow-glib/ipc-metadata-version.hpp>
+#include <arrow-glib/ipc-stream-reader.hpp>
+#include <arrow-glib/ipc-stream-writer.hpp>
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/arrow-ipc-glib.pc.in
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/arrow-ipc-glib.pc.in b/c_glib/arrow-glib/arrow-ipc-glib.pc.in
new file mode 100644
index 0000000..0b04c4a
--- /dev/null
+++ b/c_glib/arrow-glib/arrow-ipc-glib.pc.in
@@ -0,0 +1,28 @@
+# 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.
+
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: Apache Arrow IPC GLib
+Description: C API for Apache Arrow IPC based on GLib
+Version: @VERSION@
+Libs: -L${libdir} -larrow-glib-ipc
+Cflags: -I${includedir}
+Requires: arrow-glib-io arrow-ipc
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/binary-array-builder.cpp
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/binary-array-builder.cpp b/c_glib/arrow-glib/binary-array-builder.cpp
new file mode 100644
index 0000000..ab11535
--- /dev/null
+++ b/c_glib/arrow-glib/binary-array-builder.cpp
@@ -0,0 +1,122 @@
+/*
+ * 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-builder.hpp>
+#include <arrow-glib/binary-array-builder.h>
+#include <arrow-glib/error.hpp>
+
+G_BEGIN_DECLS
+
+/**
+ * SECTION: binary-array-builder
+ * @short_description: Binary array builder class
+ *
+ * #GArrowBinaryArrayBuilder is the class to create a new
+ * #GArrowBinaryArray.
+ */
+
+G_DEFINE_TYPE(GArrowBinaryArrayBuilder,
+ garrow_binary_array_builder,
+ GARROW_TYPE_ARRAY_BUILDER)
+
+static void
+garrow_binary_array_builder_init(GArrowBinaryArrayBuilder *builder)
+{
+}
+
+static void
+garrow_binary_array_builder_class_init(GArrowBinaryArrayBuilderClass *klass)
+{
+}
+
+/**
+ * garrow_binary_array_builder_new:
+ *
+ * Returns: A newly created #GArrowBinaryArrayBuilder.
+ */
+GArrowBinaryArrayBuilder *
+garrow_binary_array_builder_new(void)
+{
+ auto memory_pool = arrow::default_memory_pool();
+ auto arrow_builder =
+ std::make_shared<arrow::BinaryBuilder>(memory_pool, arrow::binary());
+ auto builder =
+ GARROW_BINARY_ARRAY_BUILDER(g_object_new(GARROW_TYPE_BINARY_ARRAY_BUILDER,
+ "array-builder", &arrow_builder,
+ NULL));
+ return builder;
+}
+
+/**
+ * garrow_binary_array_builder_append:
+ * @builder: A #GArrowBinaryArrayBuilder.
+ * @value: (array length=length): A binary value.
+ * @length: A value length.
+ * @error: (nullable): Return location for a #GError or %NULL.
+ *
+ * Returns: %TRUE on success, %FALSE if there was an error.
+ */
+gboolean
+garrow_binary_array_builder_append(GArrowBinaryArrayBuilder *builder,
+ const guint8 *value,
+ gint32 length,
+ GError **error)
+{
+ auto arrow_builder =
+ static_cast<arrow::BinaryBuilder *>(
+ garrow_array_builder_get_raw(GARROW_ARRAY_BUILDER(builder)).get());
+
+ auto status = arrow_builder->Append(value, length);
+ if (status.ok()) {
+ return TRUE;
+ } else {
+ garrow_error_set(error, status, "[binary-array-builder][append]");
+ return FALSE;
+ }
+}
+
+/**
+ * garrow_binary_array_builder_append_null:
+ * @builder: A #GArrowBinaryArrayBuilder.
+ * @error: (nullable): Return location for a #GError or %NULL.
+ *
+ * Returns: %TRUE on success, %FALSE if there was an error.
+ */
+gboolean
+garrow_binary_array_builder_append_null(GArrowBinaryArrayBuilder *builder,
+ GError **error)
+{
+ auto arrow_builder =
+ static_cast<arrow::BinaryBuilder *>(
+ garrow_array_builder_get_raw(GARROW_ARRAY_BUILDER(builder)).get());
+
+ auto status = arrow_builder->AppendNull();
+ if (status.ok()) {
+ return TRUE;
+ } else {
+ garrow_error_set(error, status, "[binary-array-builder][append-null]");
+ return FALSE;
+ }
+}
+
+G_END_DECLS
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/c_glib/arrow-glib/binary-array-builder.h
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/binary-array-builder.h b/c_glib/arrow-glib/binary-array-builder.h
new file mode 100644
index 0000000..111a83a
--- /dev/null
+++ b/c_glib/arrow-glib/binary-array-builder.h
@@ -0,0 +1,77 @@
+/*
+ * 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-builder.h>
+
+G_BEGIN_DECLS
+
+#define GARROW_TYPE_BINARY_ARRAY_BUILDER \
+ (garrow_binary_array_builder_get_type())
+#define GARROW_BINARY_ARRAY_BUILDER(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj), \
+ GARROW_TYPE_BINARY_ARRAY_BUILDER, \
+ GArrowBinaryArrayBuilder))
+#define GARROW_BINARY_ARRAY_BUILDER_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST((klass), \
+ GARROW_TYPE_BINARY_ARRAY_BUILDER, \
+ GArrowBinaryArrayBuilderClass))
+#define GARROW_IS_BINARY_ARRAY_BUILDER(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj), \
+ GARROW_TYPE_BINARY_ARRAY_BUILDER))
+#define GARROW_IS_BINARY_ARRAY_BUILDER_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE((klass), \
+ GARROW_TYPE_BINARY_ARRAY_BUILDER))
+#define GARROW_BINARY_ARRAY_BUILDER_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS((obj), \
+ GARROW_TYPE_BINARY_ARRAY_BUILDER, \
+ GArrowBinaryArrayBuilderClass))
+
+typedef struct _GArrowBinaryArrayBuilder GArrowBinaryArrayBuilder;
+typedef struct _GArrowBinaryArrayBuilderClass GArrowBinaryArrayBuilderClass;
+
+/**
+ * GArrowBinaryArrayBuilder:
+ *
+ * It wraps `arrow::BinaryBuilder`.
+ */
+struct _GArrowBinaryArrayBuilder
+{
+ /*< private >*/
+ GArrowArrayBuilder parent_instance;
+};
+
+struct _GArrowBinaryArrayBuilderClass
+{
+ GArrowArrayBuilderClass parent_class;
+};
+
+GType garrow_binary_array_builder_get_type(void) G_GNUC_CONST;
+
+GArrowBinaryArrayBuilder *garrow_binary_array_builder_new(void);
+
+gboolean garrow_binary_array_builder_append(GArrowBinaryArrayBuilder *builder,
+ const guint8 *value,
+ gint32 length,
+ GError **error);
+gboolean garrow_binary_array_builder_append_null(GArrowBinaryArrayBuilder *builder,
+ GError **error);
+
+G_END_DECLS
http://git-wip-us.apache.org/repos/asf/arrow/blob/39c7274f/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
new file mode 100644
index 0000000..c149d14
--- /dev/null
+++ b/c_glib/arrow-glib/binary-array.cpp
@@ -0,0 +1,73 @@
+/*
+ * 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/39c7274f/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
new file mode 100644
index 0000000..ab63ece
--- /dev/null
+++ b/c_glib/arrow-glib/binary-array.h
@@ -0,0 +1,72 @@
+/*
+ * 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/39c7274f/c_glib/arrow-glib/binary-data-type.cpp
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/binary-data-type.cpp b/c_glib/arrow-glib/binary-data-type.cpp
new file mode 100644
index 0000000..e5187f7
--- /dev/null
+++ b/c_glib/arrow-glib/binary-data-type.cpp
@@ -0,0 +1,67 @@
+/*
+ * 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/data-type.hpp>
+#include <arrow-glib/binary-data-type.h>
+
+G_BEGIN_DECLS
+
+/**
+ * SECTION: binary-data-type
+ * @short_description: Binary data type
+ *
+ * #GArrowBinaryDataType is a class for binary data type.
+ */
+
+G_DEFINE_TYPE(GArrowBinaryDataType, \
+ garrow_binary_data_type, \
+ GARROW_TYPE_DATA_TYPE)
+
+static void
+garrow_binary_data_type_init(GArrowBinaryDataType *object)
+{
+}
+
+static void
+garrow_binary_data_type_class_init(GArrowBinaryDataTypeClass *klass)
+{
+}
+
+/**
+ * garrow_binary_data_type_new:
+ *
+ * Returns: The newly created binary data type.
+ */
+GArrowBinaryDataType *
+garrow_binary_data_type_new(void)
+{
+ auto arrow_data_type = arrow::binary();
+
+ GArrowBinaryDataType *data_type =
+ GARROW_BINARY_DATA_TYPE(g_object_new(GARROW_TYPE_BINARY_DATA_TYPE,
+ "data-type", &arrow_data_type,
+ NULL));
+ return data_type;
+}
+
+G_END_DECLS