From 0ba89bf839a341a4a50c9f2264ddfa35e2207d08 Mon Sep 17 00:00:00 2001 From: micah-white Date: Tue, 9 May 2023 17:06:26 -0500 Subject: [PATCH] not working test --- cpp/src/arrow/scalar_test.cc | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/cpp/src/arrow/scalar_test.cc b/cpp/src/arrow/scalar_test.cc index 5c0c0589934ec..f1700d2985188 100644 --- a/cpp/src/arrow/scalar_test.cc +++ b/cpp/src/arrow/scalar_test.cc @@ -1106,6 +1106,20 @@ class TestListScalar : public ::testing::Test { ASSERT_RAISES(Invalid, scalar.ValidateFull()); } + void TestHashing() { + ListScalar scalar(ArrayFromJSON(int16(), "[1, 2, 3]")); + ASSERT_OK(scalar.ValidateFull()); + ASSERT_TRUE(scalar.value->data()->buffers[0] == nullptr); + + auto data = scalar.value->data()->buffers[1]; + std::vector bitmap_data = {0,0,0}; + auto null_bitmap = std::make_shared(bitmap_data.data(), 3); + + std::shared_ptr arr(new Int16Array(3, data, null_bitmap, 0)); + ASSERT_TRUE(arr->null_count() == 0); + ASSERT_TRUE(arr->data()->buffers[0] != nullptr); + } + protected: std::shared_ptr type_; std::shared_ptr value_; @@ -1119,6 +1133,8 @@ TYPED_TEST(TestListScalar, Basics) { this->TestBasics(); } TYPED_TEST(TestListScalar, ValidateErrors) { this->TestValidateErrors(); } +TYPED_TEST(TestListScalar, TestHashing) { this->TestHashing(); } + TEST(TestFixedSizeListScalar, ValidateErrors) { const auto ty = fixed_size_list(int16(), 3); FixedSizeListScalar scalar(ArrayFromJSON(int16(), "[1, 2, 5]"), ty);