You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by bk...@apache.org on 2022/11/30 14:50:52 UTC

[arrow] 08/15: run binary data visitor tests on StringView/BinaryView

This is an automated email from the ASF dual-hosted git repository.

bkietz pushed a commit to branch feature/format-string-view
in repository https://gitbox.apache.org/repos/asf/arrow.git

commit 3d6a30a09da0169369a67ed7a0d4afa478348292
Author: Tobias Zagorni <to...@zagorni.eu>
AuthorDate: Tue Oct 18 17:29:16 2022 +0200

    run binary data visitor tests on StringView/BinaryView
---
 cpp/src/arrow/array/array_binary_test.cc | 13 ++++++++++---
 cpp/src/arrow/testing/gtest_util.h       |  3 +++
 2 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/cpp/src/arrow/array/array_binary_test.cc b/cpp/src/arrow/array/array_binary_test.cc
index 3bc9bb91a0..c9f1b1cfab 100644
--- a/cpp/src/arrow/array/array_binary_test.cc
+++ b/cpp/src/arrow/array/array_binary_test.cc
@@ -883,11 +883,15 @@ class TestBaseBinaryDataVisitor : public ::testing::Test {
   void SetUp() override { type_ = TypeTraits<TypeClass>::type_singleton(); }
 
   void TestBasics() {
-    auto array = ArrayFromJSON(type_, R"(["foo", null, "bar"])");
+    auto array = ArrayFromJSON(
+        type_,
+        R"(["foo", null, "bar", "inline_me", "allocate_me_aaaaa", "allocate_me_bbbb"])");
     BinaryAppender appender;
     ArraySpanVisitor<TypeClass> visitor;
     ASSERT_OK(visitor.Visit(*array->data(), &appender));
-    ASSERT_THAT(appender.data, ::testing::ElementsAreArray({"foo", "(null)", "bar"}));
+    ASSERT_THAT(appender.data,
+                ::testing::ElementsAreArray({"foo", "(null)", "bar", "inline_me",
+                                             "allocate_me_aaaaa", "allocate_me_bbbb"}));
     ARROW_UNUSED(visitor);  // Workaround weird MSVC warning
   }
 
@@ -904,7 +908,10 @@ class TestBaseBinaryDataVisitor : public ::testing::Test {
   std::shared_ptr<DataType> type_;
 };
 
-TYPED_TEST_SUITE(TestBaseBinaryDataVisitor, BaseBinaryArrowTypes);
+using BinaryAndBin = ::testing::Types<BinaryType, LargeBinaryType, StringType,
+                                      LargeStringType, BinaryViewType, StringViewType>;
+
+TYPED_TEST_SUITE(TestBaseBinaryDataVisitor, BaseBinaryOrBinaryViewLikeArrowTypes);
 
 TYPED_TEST(TestBaseBinaryDataVisitor, Basics) { this->TestBasics(); }
 
diff --git a/cpp/src/arrow/testing/gtest_util.h b/cpp/src/arrow/testing/gtest_util.h
index 2708056295..fc319a6d10 100644
--- a/cpp/src/arrow/testing/gtest_util.h
+++ b/cpp/src/arrow/testing/gtest_util.h
@@ -176,6 +176,9 @@ using DecimalArrowTypes = ::testing::Types<Decimal128Type, Decimal256Type>;
 using BaseBinaryArrowTypes =
     ::testing::Types<BinaryType, LargeBinaryType, StringType, LargeStringType>;
 
+using BaseBinaryOrBinaryViewLikeArrowTypes =
+    ::testing::Types<BinaryType, LargeBinaryType, StringType, LargeStringType>;
+
 using BinaryArrowTypes = ::testing::Types<BinaryType, LargeBinaryType>;
 
 using StringArrowTypes = ::testing::Types<StringType, LargeStringType>;