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 2018/01/07 17:19:34 UTC
[arrow] branch master updated: ARROW-1970: [GLib] Add
garrow_chunked_array_get_value_data_type() and
garrow_chunked_array_get_value_type()
This is an automated email from the ASF dual-hosted git repository.
wesm pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow.git
The following commit(s) were added to refs/heads/master by this push:
new bda85bb ARROW-1970: [GLib] Add garrow_chunked_array_get_value_data_type() and garrow_chunked_array_get_value_type()
bda85bb is described below
commit bda85bb1d58b71b822b358653665407de0cd4cad
Author: Kouhei Sutou <ko...@clear-code.com>
AuthorDate: Sun Jan 7 12:19:29 2018 -0500
ARROW-1970: [GLib] Add garrow_chunked_array_get_value_data_type() and garrow_chunked_array_get_value_type()
Author: Kouhei Sutou <ko...@clear-code.com>
Closes #1458 from kou/glib-add-chunked-array-get-value-type and squashes the following commits:
4d99a079 [Kouhei Sutou] [GLib] Add garrow_chunked_array_get_value_data_type() and garrow_chunked_array_get_value_type()
---
c_glib/arrow-glib/chunked-array.cpp | 35 +++++++++++++++++++++++++++++++++++
c_glib/arrow-glib/chunked-array.h | 5 +++++
c_glib/test/test-chunked-array.rb | 18 ++++++++++++++++++
3 files changed, 58 insertions(+)
diff --git a/c_glib/arrow-glib/chunked-array.cpp b/c_glib/arrow-glib/chunked-array.cpp
index 62d666f..69195c5 100644
--- a/c_glib/arrow-glib/chunked-array.cpp
+++ b/c_glib/arrow-glib/chunked-array.cpp
@@ -23,6 +23,8 @@
#include <arrow-glib/array.hpp>
#include <arrow-glib/chunked-array.hpp>
+#include <arrow-glib/data-type.hpp>
+#include <arrow-glib/type.hpp>
G_BEGIN_DECLS
@@ -164,6 +166,39 @@ garrow_chunked_array_equal(GArrowChunkedArray *chunked_array,
}
/**
+ * garrow_chunked_array_get_value_data_type:
+ * @chunked_array: A #GArrowChunkedArray.
+ *
+ * Returns: (transfer full): The #GArrowDataType of the value of
+ * the chunked array.
+ *
+ * Since: 0.9.0
+ */
+GArrowDataType *
+garrow_chunked_array_get_value_data_type(GArrowChunkedArray *chunked_array)
+{
+ auto arrow_chunked_array = garrow_chunked_array_get_raw(chunked_array);
+ auto arrow_type = arrow_chunked_array->type();
+ return garrow_data_type_new_raw(&arrow_type);
+}
+
+/**
+ * garrow_chunked_array_get_value_type:
+ * @chunked_array: A #GArrowChunkedArray.
+ *
+ * Returns: The #GArrowType of the value of the chunked array.
+ *
+ * Since: 0.9.0
+ */
+GArrowType
+garrow_chunked_array_get_value_type(GArrowChunkedArray *chunked_array)
+{
+ auto arrow_chunked_array = garrow_chunked_array_get_raw(chunked_array);
+ auto arrow_type = arrow_chunked_array->type();
+ return garrow_type_from_raw(arrow_type->id());
+}
+
+/**
* garrow_chunked_array_get_length:
* @chunked_array: A #GArrowChunkedArray.
*
diff --git a/c_glib/arrow-glib/chunked-array.h b/c_glib/arrow-glib/chunked-array.h
index c5f986a..0c3c81a 100644
--- a/c_glib/arrow-glib/chunked-array.h
+++ b/c_glib/arrow-glib/chunked-array.h
@@ -70,6 +70,11 @@ GArrowChunkedArray *garrow_chunked_array_new(GList *chunks);
gboolean garrow_chunked_array_equal(GArrowChunkedArray *chunked_array,
GArrowChunkedArray *other_chunked_array);
+GArrowDataType *
+garrow_chunked_array_get_value_data_type(GArrowChunkedArray *chunked_array);
+GArrowType
+garrow_chunked_array_get_value_type(GArrowChunkedArray *chunked_array);
+
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);
diff --git a/c_glib/test/test-chunked-array.rb b/c_glib/test/test-chunked-array.rb
index cde7a8b..9287058 100644
--- a/c_glib/test/test-chunked-array.rb
+++ b/c_glib/test/test-chunked-array.rb
@@ -31,6 +31,24 @@ class TestChunkedArray < Test::Unit::TestCase
Arrow::ChunkedArray.new(chunks2))
end
+ def test_value_data_type
+ chunks = [
+ build_boolean_array([true, false]),
+ build_boolean_array([true]),
+ ]
+ assert_equal(Arrow::BooleanDataType.new,
+ Arrow::ChunkedArray.new(chunks).value_data_type)
+ end
+
+ def test_value_type
+ chunks = [
+ build_boolean_array([true, false]),
+ build_boolean_array([true]),
+ ]
+ assert_equal(Arrow::Type::BOOL,
+ Arrow::ChunkedArray.new(chunks).value_type)
+ end
+
def test_length
chunks = [
build_boolean_array([true, false]),
--
To stop receiving notification emails like this one, please contact
['"commits@arrow.apache.org" <co...@arrow.apache.org>'].