[
https://issues.apache.org/jira/browse/ARROW-1970?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16315394#comment-16315394
]
ASF GitHub Bot commented on ARROW-1970:
---------------------------------------
wesm closed pull request #1458: ARROW-1970: [GLib] Add
garrow_chunked_array_get_value_data_type() and
garrow_chunked_array_get_value_type()
URL: https://github.com/apache/arrow/pull/1458
This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:
As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):
diff --git a/c_glib/arrow-glib/chunked-array.cpp
b/c_glib/arrow-glib/chunked-array.cpp
index 62d666fbc..69195c57b 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
@@ -163,6 +165,39 @@ garrow_chunked_array_equal(GArrowChunkedArray
*chunked_array,
return arrow_chunked_array->Equals(arrow_other_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 c5f986a63..0c3c81a74 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 cde7a8b0c..9287058e1 100644
--- a/c_glib/test/test-chunked-array.rb
+++ b/c_glib/test/test-chunked-array.rb
@@ -31,6 +31,24 @@ def test_equal
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]),
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
> [GLib] Add garrow_chunked_array_get_value_data_type() and
> garrow_chunked_array_get_value_type()
> -----------------------------------------------------------------------------------------------
>
> Key: ARROW-1970
> URL: https://issues.apache.org/jira/browse/ARROW-1970
> Project: Apache Arrow
> Issue Type: New Feature
> Components: GLib
> Reporter: Kouhei Sutou
> Assignee: Kouhei Sutou
> Priority: Minor
> Labels: pull-request-available
> Fix For: 0.9.0
>
>
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)