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/02 15:29:19 UTC
arrow git commit: ARROW-754: [GLib] Add garrow_array_is_null()
Repository: arrow
Updated Branches:
refs/heads/master baf38e47a -> 7fec7d30c
ARROW-754: [GLib] Add garrow_array_is_null()
Author: Kouhei Sutou <ko...@clear-code.com>
Closes #480 from kou/glib-support-array-is-null and squashes the following commits:
5c4259b [Kouhei Sutou] [GLib] Add garrow_array_is_null()
Project: http://git-wip-us.apache.org/repos/asf/arrow/repo
Commit: http://git-wip-us.apache.org/repos/asf/arrow/commit/7fec7d30
Tree: http://git-wip-us.apache.org/repos/asf/arrow/tree/7fec7d30
Diff: http://git-wip-us.apache.org/repos/asf/arrow/diff/7fec7d30
Branch: refs/heads/master
Commit: 7fec7d30c75dd8910522002bb6bb640330834b90
Parents: baf38e4
Author: Kouhei Sutou <ko...@clear-code.com>
Authored: Sun Apr 2 11:29:14 2017 -0400
Committer: Wes McKinney <we...@twosigma.com>
Committed: Sun Apr 2 11:29:14 2017 -0400
----------------------------------------------------------------------
c_glib/arrow-glib/array.cpp | 14 ++++++++++++++
c_glib/arrow-glib/array.h | 2 ++
c_glib/test/test-array.rb | 9 +++++++++
3 files changed, 25 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/arrow/blob/7fec7d30/c_glib/arrow-glib/array.cpp
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/array.cpp b/c_glib/arrow-glib/array.cpp
index b084054..caf2eb5 100644
--- a/c_glib/arrow-glib/array.cpp
+++ b/c_glib/arrow-glib/array.cpp
@@ -136,6 +136,20 @@ garrow_array_class_init(GArrowArrayClass *klass)
}
/**
+ * garrow_array_is_null:
+ * @array: A #GArrowArray.
+ * @i: The index of the target value.
+ *
+ * Returns: Whether the i-th value is null or not.
+ */
+gboolean
+garrow_array_is_null(GArrowArray *array, gint64 i)
+{
+ auto arrow_array = garrow_array_get_raw(array);
+ return arrow_array->IsNull(i);
+}
+
+/**
* garrow_array_get_length:
* @array: A #GArrowArray.
*
http://git-wip-us.apache.org/repos/asf/arrow/blob/7fec7d30/c_glib/arrow-glib/array.h
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/array.h b/c_glib/arrow-glib/array.h
index 6467db5..957b441 100644
--- a/c_glib/arrow-glib/array.h
+++ b/c_glib/arrow-glib/array.h
@@ -57,6 +57,8 @@ struct _GArrowArrayClass
GType garrow_array_get_type (void) G_GNUC_CONST;
+gboolean garrow_array_is_null (GArrowArray *array,
+ gint64 i);
gint64 garrow_array_get_length (GArrowArray *array);
gint64 garrow_array_get_offset (GArrowArray *array);
gint64 garrow_array_get_n_nulls (GArrowArray *array);
http://git-wip-us.apache.org/repos/asf/arrow/blob/7fec7d30/c_glib/test/test-array.rb
----------------------------------------------------------------------
diff --git a/c_glib/test/test-array.rb b/c_glib/test/test-array.rb
index c427f02..08908b0 100644
--- a/c_glib/test/test-array.rb
+++ b/c_glib/test/test-array.rb
@@ -16,6 +16,15 @@
# under the License.
class TestArray < Test::Unit::TestCase
+ def test_is_null
+ builder = Arrow::BooleanArrayBuilder.new
+ builder.append_null
+ builder.append(true)
+ array = builder.finish
+ assert_equal([true, false],
+ array.length.times.collect {|i| array.null?(i)})
+ end
+
def test_length
builder = Arrow::BooleanArrayBuilder.new
builder.append(true)