arrow-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From w...@apache.org
Subject arrow git commit: ARROW-1145: [GLib] Add get_values()
Date Sat, 24 Jun 2017 16:20:39 GMT
Repository: arrow
Updated Branches:
  refs/heads/master 41524d6d2 -> f3bcf76f2


ARROW-1145: [GLib] Add get_values()

Author: Kouhei Sutou <kou@clear-code.com>

Closes #775 from kou/glib-get-values and squashes the following commits:

7a02ab73 [Kouhei Sutou] [GLib] Use template for common code
ebb24f9e [Kouhei Sutou] [GLib] Add get_values()


Project: http://git-wip-us.apache.org/repos/asf/arrow/repo
Commit: http://git-wip-us.apache.org/repos/asf/arrow/commit/f3bcf76f
Tree: http://git-wip-us.apache.org/repos/asf/arrow/tree/f3bcf76f
Diff: http://git-wip-us.apache.org/repos/asf/arrow/diff/f3bcf76f

Branch: refs/heads/master
Commit: f3bcf76f2c5eb11b9f750994b97c3006b6371fec
Parents: 41524d6
Author: Kouhei Sutou <kou@clear-code.com>
Authored: Sat Jun 24 12:20:34 2017 -0400
Committer: Wes McKinney <wes.mckinney@twosigma.com>
Committed: Sat Jun 24 12:20:34 2017 -0400

----------------------------------------------------------------------
 c_glib/arrow-glib/array.cpp      | 168 +++++++++++++++++++++++++++++++++-
 c_glib/arrow-glib/array.h        |  20 ++++
 c_glib/test/test-double-array.rb |  11 +++
 c_glib/test/test-float-array.rb  |  11 +++
 c_glib/test/test-int16-array.rb  |  11 +++
 c_glib/test/test-int32-array.rb  |   9 ++
 c_glib/test/test-int64-array.rb  |   9 ++
 c_glib/test/test-int8-array.rb   |   9 ++
 c_glib/test/test-uint16-array.rb |  11 +++
 c_glib/test/test-uint32-array.rb |  11 +++
 c_glib/test/test-uint64-array.rb |  11 +++
 c_glib/test/test-uint8-array.rb  |   9 ++
 12 files changed, 289 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/arrow/blob/f3bcf76f/c_glib/arrow-glib/array.cpp
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/array.cpp b/c_glib/arrow-glib/array.cpp
index e9a6a49..92a748d 100644
--- a/c_glib/arrow-glib/array.cpp
+++ b/c_glib/arrow-glib/array.cpp
@@ -30,6 +30,17 @@
 #include <iostream>
 #include <sstream>
 
+template <typename T>
+const typename T::c_type *
+garrow_array_get_values_raw(std::shared_ptr<arrow::Array> arrow_array,
+                            gint64 *length)
+{
+  auto arrow_specific_array =
+    std::static_pointer_cast<typename arrow::TypeTraits<T>::ArrayType>(arrow_array);
+  *length = arrow_specific_array->length();
+  return arrow_specific_array->raw_data();
+};
+
 G_BEGIN_DECLS
 
 /**
@@ -609,6 +620,21 @@ garrow_int8_array_get_value(GArrowInt8Array *array,
   return static_cast<arrow::Int8Array *>(arrow_array.get())->Value(i);
 }
 
+/**
+ * garrow_int8_array_get_values:
+ * @array: A #GArrowInt8Array.
+ * @length: (out): The number of values.
+ *
+ * Returns: (array length=length): The raw values.
+ */
+const gint8 *
+garrow_int8_array_get_values(GArrowInt8Array *array,
+                             gint64 *length)
+{
+  auto arrow_array = garrow_array_get_raw(GARROW_ARRAY(array));
+  return garrow_array_get_values_raw<arrow::Int8Type>(arrow_array, length);
+}
+
 
 G_DEFINE_TYPE(GArrowUInt8Array,               \
               garrow_uint8_array,             \
@@ -672,6 +698,21 @@ garrow_uint8_array_get_value(GArrowUInt8Array *array,
   return static_cast<arrow::UInt8Array *>(arrow_array.get())->Value(i);
 }
 
+/**
+ * garrow_uint8_array_get_values:
+ * @array: A #GArrowUInt8Array.
+ * @length: (out): The number of values.
+ *
+ * Returns: (array length=length): The raw values.
+ */
+const guint8 *
+garrow_uint8_array_get_values(GArrowUInt8Array *array,
+                              gint64 *length)
+{
+  auto arrow_array = garrow_array_get_raw(GARROW_ARRAY(array));
+  return garrow_array_get_values_raw<arrow::UInt8Type>(arrow_array, length);
+}
+
 
 G_DEFINE_TYPE(GArrowInt16Array,               \
               garrow_int16_array,             \
@@ -735,6 +776,21 @@ garrow_int16_array_get_value(GArrowInt16Array *array,
   return static_cast<arrow::Int16Array *>(arrow_array.get())->Value(i);
 }
 
+/**
+ * garrow_int16_array_get_values:
+ * @array: A #GArrowInt16Array.
+ * @length: (out): The number of values.
+ *
+ * Returns: (array length=length): The raw values.
+ */
+const gint16 *
+garrow_int16_array_get_values(GArrowInt16Array *array,
+                              gint64 *length)
+{
+  auto arrow_array = garrow_array_get_raw(GARROW_ARRAY(array));
+  return garrow_array_get_values_raw<arrow::Int16Type>(arrow_array, length);
+}
+
 
 G_DEFINE_TYPE(GArrowUInt16Array,               \
               garrow_uint16_array,             \
@@ -792,12 +848,27 @@ garrow_uint16_array_new(gint64 length,
  */
 guint16
 garrow_uint16_array_get_value(GArrowUInt16Array *array,
-                             gint64 i)
+                              gint64 i)
 {
   auto arrow_array = garrow_array_get_raw(GARROW_ARRAY(array));
   return static_cast<arrow::UInt16Array *>(arrow_array.get())->Value(i);
 }
 
+/**
+ * garrow_uint16_array_get_values:
+ * @array: A #GArrowUInt16Array.
+ * @length: (out): The number of values.
+ *
+ * Returns: (array length=length): The raw values.
+ */
+const guint16 *
+garrow_uint16_array_get_values(GArrowUInt16Array *array,
+                               gint64 *length)
+{
+  auto arrow_array = garrow_array_get_raw(GARROW_ARRAY(array));
+  return garrow_array_get_values_raw<arrow::UInt16Type>(arrow_array, length);
+}
+
 
 G_DEFINE_TYPE(GArrowInt32Array,               \
               garrow_int32_array,             \
@@ -861,6 +932,21 @@ garrow_int32_array_get_value(GArrowInt32Array *array,
   return static_cast<arrow::Int32Array *>(arrow_array.get())->Value(i);
 }
 
+/**
+ * garrow_int32_array_get_values:
+ * @array: A #GArrowInt32Array.
+ * @length: (out): The number of values.
+ *
+ * Returns: (array length=length): The raw values.
+ */
+const gint32 *
+garrow_int32_array_get_values(GArrowInt32Array *array,
+                              gint64 *length)
+{
+  auto arrow_array = garrow_array_get_raw(GARROW_ARRAY(array));
+  return garrow_array_get_values_raw<arrow::Int32Type>(arrow_array, length);
+}
+
 
 G_DEFINE_TYPE(GArrowUInt32Array,               \
               garrow_uint32_array,             \
@@ -924,6 +1010,21 @@ garrow_uint32_array_get_value(GArrowUInt32Array *array,
   return static_cast<arrow::UInt32Array *>(arrow_array.get())->Value(i);
 }
 
+/**
+ * garrow_uint32_array_get_values:
+ * @array: A #GArrowUInt32Array.
+ * @length: (out): The number of values.
+ *
+ * Returns: (array length=length): The raw values.
+ */
+const guint32 *
+garrow_uint32_array_get_values(GArrowUInt32Array *array,
+                               gint64 *length)
+{
+  auto arrow_array = garrow_array_get_raw(GARROW_ARRAY(array));
+  return garrow_array_get_values_raw<arrow::UInt32Type>(arrow_array, length);
+}
+
 
 G_DEFINE_TYPE(GArrowInt64Array,               \
               garrow_int64_array,             \
@@ -987,6 +1088,23 @@ garrow_int64_array_get_value(GArrowInt64Array *array,
   return static_cast<arrow::Int64Array *>(arrow_array.get())->Value(i);
 }
 
+/**
+ * garrow_int64_array_get_values:
+ * @array: A #GArrowInt64Array.
+ * @length: (out): The number of values.
+ *
+ * Returns: (array length=length): The raw values.
+ */
+const gint64 *
+garrow_int64_array_get_values(GArrowInt64Array *array,
+                              gint64 *length)
+{
+  auto arrow_array = garrow_array_get_raw(GARROW_ARRAY(array));
+  auto values =
+    garrow_array_get_values_raw<arrow::Int64Type>(arrow_array, length);
+  return reinterpret_cast<const gint64 *>(values);
+}
+
 
 G_DEFINE_TYPE(GArrowUInt64Array,               \
               garrow_uint64_array,             \
@@ -1050,6 +1168,24 @@ garrow_uint64_array_get_value(GArrowUInt64Array *array,
   return static_cast<arrow::UInt64Array *>(arrow_array.get())->Value(i);
 }
 
+/**
+ * garrow_uint64_array_get_values:
+ * @array: A #GArrowUInt64Array.
+ * @length: (out): The number of values.
+ *
+ * Returns: (array length=length): The raw values.
+ */
+const guint64 *
+garrow_uint64_array_get_values(GArrowUInt64Array *array,
+                               gint64 *length)
+{
+  auto arrow_array = garrow_array_get_raw(GARROW_ARRAY(array));
+  auto values =
+    garrow_array_get_values_raw<arrow::UInt64Type>(arrow_array, length);
+  return reinterpret_cast<const guint64 *>(values);
+}
+
+
 G_DEFINE_TYPE(GArrowFloatArray,               \
               garrow_float_array,             \
               GARROW_TYPE_PRIMITIVE_ARRAY)
@@ -1112,6 +1248,21 @@ garrow_float_array_get_value(GArrowFloatArray *array,
   return static_cast<arrow::FloatArray *>(arrow_array.get())->Value(i);
 }
 
+/**
+ * garrow_float_array_get_values:
+ * @array: A #GArrowFloatArray.
+ * @length: (out): The number of values.
+ *
+ * Returns: (array length=length): The raw values.
+ */
+const gfloat *
+garrow_float_array_get_values(GArrowFloatArray *array,
+                              gint64 *length)
+{
+  auto arrow_array = garrow_array_get_raw(GARROW_ARRAY(array));
+  return garrow_array_get_values_raw<arrow::FloatType>(arrow_array, length);
+}
+
 
 G_DEFINE_TYPE(GArrowDoubleArray,               \
               garrow_double_array,             \
@@ -1175,6 +1326,21 @@ garrow_double_array_get_value(GArrowDoubleArray *array,
   return static_cast<arrow::DoubleArray *>(arrow_array.get())->Value(i);
 }
 
+/**
+ * garrow_double_array_get_values:
+ * @array: A #GArrowDoubleArray.
+ * @length: (out): The number of values.
+ *
+ * Returns: (array length=length): The raw values.
+ */
+const gdouble *
+garrow_double_array_get_values(GArrowDoubleArray *array,
+                               gint64 *length)
+{
+  auto arrow_array = garrow_array_get_raw(GARROW_ARRAY(array));
+  return garrow_array_get_values_raw<arrow::DoubleType>(arrow_array, length);
+}
+
 
 G_DEFINE_TYPE(GArrowBinaryArray,               \
               garrow_binary_array,             \

http://git-wip-us.apache.org/repos/asf/arrow/blob/f3bcf76f/c_glib/arrow-glib/array.h
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/array.h b/c_glib/arrow-glib/array.h
index d32157b..6043e90 100644
--- a/c_glib/arrow-glib/array.h
+++ b/c_glib/arrow-glib/array.h
@@ -272,6 +272,8 @@ GArrowInt8Array *garrow_int8_array_new(gint64 length,
 
 gint8 garrow_int8_array_get_value(GArrowInt8Array *array,
                                   gint64 i);
+const gint8 *garrow_int8_array_get_values(GArrowInt8Array *array,
+                                          gint64 *length);
 
 
 #define GARROW_TYPE_UINT8_ARRAY                 \
@@ -323,6 +325,8 @@ GArrowUInt8Array *garrow_uint8_array_new(gint64 length,
 
 guint8 garrow_uint8_array_get_value(GArrowUInt8Array *array,
                                     gint64 i);
+const guint8 *garrow_uint8_array_get_values(GArrowUInt8Array *array,
+                                            gint64 *length);
 
 
 #define GARROW_TYPE_INT16_ARRAY                  \
@@ -374,6 +378,8 @@ GArrowInt16Array *garrow_int16_array_new(gint64 length,
 
 gint16 garrow_int16_array_get_value(GArrowInt16Array *array,
                                     gint64 i);
+const gint16 *garrow_int16_array_get_values(GArrowInt16Array *array,
+                                            gint64 *length);
 
 
 #define GARROW_TYPE_UINT16_ARRAY                 \
@@ -425,6 +431,8 @@ GArrowUInt16Array *garrow_uint16_array_new(gint64 length,
 
 guint16 garrow_uint16_array_get_value(GArrowUInt16Array *array,
                                       gint64 i);
+const guint16 *garrow_uint16_array_get_values(GArrowUInt16Array *array,
+                                              gint64 *length);
 
 
 #define GARROW_TYPE_INT32_ARRAY                 \
@@ -476,6 +484,8 @@ GArrowInt32Array *garrow_int32_array_new(gint64 length,
 
 gint32 garrow_int32_array_get_value(GArrowInt32Array *array,
                                     gint64 i);
+const gint32 *garrow_int32_array_get_values(GArrowInt32Array *array,
+                                            gint64 *length);
 
 
 #define GARROW_TYPE_UINT32_ARRAY                \
@@ -527,6 +537,8 @@ GArrowUInt32Array *garrow_uint32_array_new(gint64 length,
 
 guint32 garrow_uint32_array_get_value(GArrowUInt32Array *array,
                                       gint64 i);
+const guint32 *garrow_uint32_array_get_values(GArrowUInt32Array *array,
+                                              gint64 *length);
 
 
 #define GARROW_TYPE_INT64_ARRAY                 \
@@ -578,6 +590,8 @@ GArrowInt64Array *garrow_int64_array_new(gint64 length,
 
 gint64 garrow_int64_array_get_value(GArrowInt64Array *array,
                                     gint64 i);
+const gint64 *garrow_int64_array_get_values(GArrowInt64Array *array,
+                                            gint64 *length);
 
 
 #define GARROW_TYPE_UINT64_ARRAY                \
@@ -629,6 +643,8 @@ GArrowUInt64Array *garrow_uint64_array_new(gint64 length,
 
 guint64 garrow_uint64_array_get_value(GArrowUInt64Array *array,
                                       gint64 i);
+const guint64 *garrow_uint64_array_get_values(GArrowUInt64Array *array,
+                                              gint64 *length);
 
 
 #define GARROW_TYPE_FLOAT_ARRAY                 \
@@ -680,6 +696,8 @@ GArrowFloatArray *garrow_float_array_new(gint64 length,
 
 gfloat garrow_float_array_get_value(GArrowFloatArray *array,
                                     gint64 i);
+const gfloat *garrow_float_array_get_values(GArrowFloatArray *array,
+                                            gint64 *length);
 
 
 #define GARROW_TYPE_DOUBLE_ARRAY                \
@@ -731,6 +749,8 @@ GArrowDoubleArray *garrow_double_array_new(gint64 length,
 
 gdouble garrow_double_array_get_value(GArrowDoubleArray *array,
                                       gint64 i);
+const gdouble *garrow_double_array_get_values(GArrowDoubleArray *array,
+                                              gint64 *length);
 
 
 #define GARROW_TYPE_BINARY_ARRAY                \

http://git-wip-us.apache.org/repos/asf/arrow/blob/f3bcf76f/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
index 935fbe5..c4a2d30 100644
--- a/c_glib/test/test-double-array.rb
+++ b/c_glib/test/test-double-array.rb
@@ -17,6 +17,7 @@
 
 class TestDoubleArray < Test::Unit::TestCase
   include Helper::Buildable
+  include Helper::Omittable
 
   def test_new
     assert_equal(build_double_array([-1.1, 2.2, nil]),
@@ -41,4 +42,14 @@ class TestDoubleArray < Test::Unit::TestCase
     array = builder.finish
     assert_in_delta(1.5, array.get_value(0))
   end
+
+  def test_values
+    require_gi(3, 1, 7)
+    builder = Arrow::DoubleArrayBuilder.new
+    builder.append(1.5)
+    builder.append(3)
+    builder.append(4.5)
+    array = builder.finish
+    assert_equal([1.5, 3.0, 4.5], array.values)
+  end
 end

http://git-wip-us.apache.org/repos/asf/arrow/blob/f3bcf76f/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
index fcac902..ce77c8b 100644
--- a/c_glib/test/test-float-array.rb
+++ b/c_glib/test/test-float-array.rb
@@ -17,6 +17,7 @@
 
 class TestFloatArray < Test::Unit::TestCase
   include Helper::Buildable
+  include Helper::Omittable
 
   def test_new
     assert_equal(build_float_array([-1.1, 2.2, nil]),
@@ -41,4 +42,14 @@ class TestFloatArray < Test::Unit::TestCase
     array = builder.finish
     assert_in_delta(1.5, array.get_value(0))
   end
+
+  def test_values
+    require_gi(3, 1, 7)
+    builder = Arrow::FloatArrayBuilder.new
+    builder.append(1.5)
+    builder.append(3)
+    builder.append(4.5)
+    array = builder.finish
+    assert_equal([1.5, 3.0, 4.5], array.values)
+  end
 end

http://git-wip-us.apache.org/repos/asf/arrow/blob/f3bcf76f/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
index 6bc7f88..8703e80 100644
--- a/c_glib/test/test-int16-array.rb
+++ b/c_glib/test/test-int16-array.rb
@@ -17,6 +17,7 @@
 
 class TestInt16Array < Test::Unit::TestCase
   include Helper::Buildable
+  include Helper::Omittable
 
   def test_new
     assert_equal(build_int16_array([-1, 2, nil]),
@@ -41,4 +42,14 @@ class TestInt16Array < Test::Unit::TestCase
     array = builder.finish
     assert_equal(-1, array.get_value(0))
   end
+
+  def test_values
+    require_gi(3, 1, 7)
+    builder = Arrow::Int16ArrayBuilder.new
+    builder.append(-1)
+    builder.append(2)
+    builder.append(-4)
+    array = builder.finish
+    assert_equal([-1, 2, -4], array.values)
+  end
 end

http://git-wip-us.apache.org/repos/asf/arrow/blob/f3bcf76f/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
index 0b68273..d1579a8 100644
--- a/c_glib/test/test-int32-array.rb
+++ b/c_glib/test/test-int32-array.rb
@@ -41,4 +41,13 @@ class TestInt32Array < Test::Unit::TestCase
     array = builder.finish
     assert_equal(-1, array.get_value(0))
   end
+
+  def test_values
+    builder = Arrow::Int32ArrayBuilder.new
+    builder.append(-1)
+    builder.append(2)
+    builder.append(-4)
+    array = builder.finish
+    assert_equal([-1, 2, -4], array.values)
+  end
 end

http://git-wip-us.apache.org/repos/asf/arrow/blob/f3bcf76f/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
index c217434..5d9c37a 100644
--- a/c_glib/test/test-int64-array.rb
+++ b/c_glib/test/test-int64-array.rb
@@ -41,4 +41,13 @@ class TestInt64Array < Test::Unit::TestCase
     array = builder.finish
     assert_equal(-1, array.get_value(0))
   end
+
+  def test_values
+    builder = Arrow::Int64ArrayBuilder.new
+    builder.append(-1)
+    builder.append(2)
+    builder.append(-4)
+    array = builder.finish
+    assert_equal([-1, 2, -4], array.values)
+  end
 end

http://git-wip-us.apache.org/repos/asf/arrow/blob/f3bcf76f/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
index c7ff216..e17c10c 100644
--- a/c_glib/test/test-int8-array.rb
+++ b/c_glib/test/test-int8-array.rb
@@ -41,4 +41,13 @@ class TestInt8Array < Test::Unit::TestCase
     array = builder.finish
     assert_equal(-1, array.get_value(0))
   end
+
+  def test_values
+    builder = Arrow::Int8ArrayBuilder.new
+    builder.append(-1)
+    builder.append(2)
+    builder.append(-4)
+    array = builder.finish
+    assert_equal([-1, 2, -4], array.values)
+  end
 end

http://git-wip-us.apache.org/repos/asf/arrow/blob/f3bcf76f/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
index e3ffa5d..1c79c99 100644
--- a/c_glib/test/test-uint16-array.rb
+++ b/c_glib/test/test-uint16-array.rb
@@ -17,6 +17,7 @@
 
 class TestUInt16Array < Test::Unit::TestCase
   include Helper::Buildable
+  include Helper::Omittable
 
   def test_new
     assert_equal(build_uint16_array([1, 2, nil]),
@@ -41,4 +42,14 @@ class TestUInt16Array < Test::Unit::TestCase
     array = builder.finish
     assert_equal(1, array.get_value(0))
   end
+
+  def test_values
+    require_gi(3, 1, 7)
+    builder = Arrow::UInt16ArrayBuilder.new
+    builder.append(1)
+    builder.append(2)
+    builder.append(4)
+    array = builder.finish
+    assert_equal([1, 2, 4], array.values)
+  end
 end

http://git-wip-us.apache.org/repos/asf/arrow/blob/f3bcf76f/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
index 95aee79..a4d1e32 100644
--- a/c_glib/test/test-uint32-array.rb
+++ b/c_glib/test/test-uint32-array.rb
@@ -17,6 +17,7 @@
 
 class TestUInt32Array < Test::Unit::TestCase
   include Helper::Buildable
+  include Helper::Omittable
 
   def test_new
     assert_equal(build_uint32_array([1, 2, nil]),
@@ -41,4 +42,14 @@ class TestUInt32Array < Test::Unit::TestCase
     array = builder.finish
     assert_equal(1, array.get_value(0))
   end
+
+  def test_values
+    require_gi(3, 1, 7)
+    builder = Arrow::UInt32ArrayBuilder.new
+    builder.append(1)
+    builder.append(2)
+    builder.append(4)
+    array = builder.finish
+    assert_equal([1, 2, 4], array.values)
+  end
 end

http://git-wip-us.apache.org/repos/asf/arrow/blob/f3bcf76f/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
index 7d91854..b7f9c40 100644
--- a/c_glib/test/test-uint64-array.rb
+++ b/c_glib/test/test-uint64-array.rb
@@ -17,6 +17,7 @@
 
 class TestUInt64Array < Test::Unit::TestCase
   include Helper::Buildable
+  include Helper::Omittable
 
   def test_new
     assert_equal(build_uint64_array([1, 2, nil]),
@@ -41,4 +42,14 @@ class TestUInt64Array < Test::Unit::TestCase
     array = builder.finish
     assert_equal(1, array.get_value(0))
   end
+
+  def test_values
+    require_gi(3, 1, 7)
+    builder = Arrow::UInt64ArrayBuilder.new
+    builder.append(1)
+    builder.append(2)
+    builder.append(4)
+    array = builder.finish
+    assert_equal([1, 2, 4], array.values)
+  end
 end

http://git-wip-us.apache.org/repos/asf/arrow/blob/f3bcf76f/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
index 9c93abe..9137e53 100644
--- a/c_glib/test/test-uint8-array.rb
+++ b/c_glib/test/test-uint8-array.rb
@@ -41,4 +41,13 @@ class TestUInt8Array < Test::Unit::TestCase
     array = builder.finish
     assert_equal(1, array.get_value(0))
   end
+
+  def test_values
+    builder = Arrow::UInt8ArrayBuilder.new
+    builder.append(1)
+    builder.append(2)
+    builder.append(4)
+    array = builder.finish
+    assert_equal([1, 2, 4], array.values)
+  end
 end


Mime
View raw message