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/04/03 03:31:25 UTC
arrow git commit: ARROW-755: [GLib] Add garrow_array_get_value_type()
Repository: arrow
Updated Branches:
refs/heads/master 9f720b117 -> 8f113b4d0
ARROW-755: [GLib] Add garrow_array_get_value_type()
garrow_array_get_data_type() is renamed to
garrow_array_get_value_data_type() for consistency.
Author: Kouhei Sutou <ko...@clear-code.com>
Closes #481 from kou/glib-support-array-value-type and squashes the following commits:
bb4349c [Kouhei Sutou] [GLib] Add index for new symbols in 0.3.0 to API reference
7b07306 [Kouhei Sutou] [GLib] Add garrow_array_get_value_type()
Project: http://git-wip-us.apache.org/repos/asf/arrow/repo
Commit: http://git-wip-us.apache.org/repos/asf/arrow/commit/8f113b4d
Tree: http://git-wip-us.apache.org/repos/asf/arrow/tree/8f113b4d
Diff: http://git-wip-us.apache.org/repos/asf/arrow/diff/8f113b4d
Branch: refs/heads/master
Commit: 8f113b4d0fc344ab7d411af85fbf99154d5d1eaa
Parents: 9f720b1
Author: Kouhei Sutou <ko...@clear-code.com>
Authored: Sun Apr 2 23:31:19 2017 -0400
Committer: Wes McKinney <we...@twosigma.com>
Committed: Sun Apr 2 23:31:19 2017 -0400
----------------------------------------------------------------------
c_glib/arrow-glib/array.cpp | 23 ++++++++++++++++++++---
c_glib/arrow-glib/array.h | 3 ++-
c_glib/doc/reference/arrow-glib-docs.sgml | 4 ++++
c_glib/test/test-array.rb | 10 ++++++++--
4 files changed, 34 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/arrow/blob/8f113b4d/c_glib/arrow-glib/array.cpp
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/array.cpp b/c_glib/arrow-glib/array.cpp
index caf2eb5..9d0e101 100644
--- a/c_glib/arrow-glib/array.cpp
+++ b/c_glib/arrow-glib/array.cpp
@@ -35,6 +35,7 @@
#include <arrow-glib/null-array.h>
#include <arrow-glib/string-array.h>
#include <arrow-glib/struct-array.h>
+#include <arrow-glib/type.hpp>
#include <arrow-glib/uint8-array.h>
#include <arrow-glib/uint16-array.h>
#include <arrow-glib/uint32-array.h>
@@ -189,13 +190,15 @@ garrow_array_get_n_nulls(GArrowArray *array)
}
/**
- * garrow_array_get_data_type:
+ * garrow_array_get_value_data_type:
* @array: A #GArrowArray.
*
- * Returns: (transfer full): The #GArrowDataType for the array.
+ * Since: 0.3.0
+ * Returns: (transfer full): The #GArrowDataType for each value of the
+ * array.
*/
GArrowDataType *
-garrow_array_get_data_type(GArrowArray *array)
+garrow_array_get_value_data_type(GArrowArray *array)
{
auto arrow_array = garrow_array_get_raw(array);
auto arrow_data_type = arrow_array->type();
@@ -203,6 +206,20 @@ garrow_array_get_data_type(GArrowArray *array)
}
/**
+ * garrow_array_get_value_type:
+ * @array: A #GArrowArray.
+ *
+ * Since: 0.3.0
+ * Returns: The #GArrowType for each value of the array.
+ */
+GArrowType
+garrow_array_get_value_type(GArrowArray *array)
+{
+ auto arrow_array = garrow_array_get_raw(array);
+ return garrow_type_from_raw(arrow_array->type_enum());
+}
+
+/**
* garrow_array_slice:
* @array: A #GArrowArray.
* @offset: The offset of sub #GArrowArray.
http://git-wip-us.apache.org/repos/asf/arrow/blob/8f113b4d/c_glib/arrow-glib/array.h
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/array.h b/c_glib/arrow-glib/array.h
index 957b441..06a37e9 100644
--- a/c_glib/arrow-glib/array.h
+++ b/c_glib/arrow-glib/array.h
@@ -62,7 +62,8 @@ gboolean garrow_array_is_null (GArrowArray *array,
gint64 garrow_array_get_length (GArrowArray *array);
gint64 garrow_array_get_offset (GArrowArray *array);
gint64 garrow_array_get_n_nulls (GArrowArray *array);
-GArrowDataType *garrow_array_get_data_type(GArrowArray *array);
+GArrowDataType *garrow_array_get_value_data_type(GArrowArray *array);
+GArrowType garrow_array_get_value_type(GArrowArray *array);
GArrowArray *garrow_array_slice (GArrowArray *array,
gint64 offset,
gint64 length);
http://git-wip-us.apache.org/repos/asf/arrow/blob/8f113b4d/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
index a732e09..06a1936 100644
--- a/c_glib/doc/reference/arrow-glib-docs.sgml
+++ b/c_glib/doc/reference/arrow-glib-docs.sgml
@@ -167,5 +167,9 @@
<title>Index of deprecated API</title>
<xi:include href="xml/api-index-deprecated.xml"><xi:fallback /></xi:include>
</index>
+ <index id="api-index-0-3-0" role="0.3.0">
+ <title>Index of new symbols in 0.3.0</title>
+ <xi:include href="xml/api-index-0.3.0.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/8f113b4d/c_glib/test/test-array.rb
----------------------------------------------------------------------
diff --git a/c_glib/test/test-array.rb b/c_glib/test/test-array.rb
index 08908b0..06102eb 100644
--- a/c_glib/test/test-array.rb
+++ b/c_glib/test/test-array.rb
@@ -40,10 +40,16 @@ class TestArray < Test::Unit::TestCase
assert_equal(2, array.n_nulls)
end
- def test_data_type
+ def test_value_data_type
builder = Arrow::BooleanArrayBuilder.new
array = builder.finish
- assert_equal(Arrow::BooleanDataType.new, array.data_type)
+ assert_equal(Arrow::BooleanDataType.new, array.value_data_type)
+ end
+
+ def test_value_type
+ builder = Arrow::BooleanArrayBuilder.new
+ array = builder.finish
+ assert_equal(Arrow::Type::BOOL, array.value_type)
end
def test_slice