From bda1891d50701be724764fe228d5bbbcb666e3f8 Mon Sep 17 00:00:00 2001 From: kshitij12345 Date: Fri, 23 Sep 2022 17:26:53 +0000 Subject: [PATCH 1/3] use the array returned by tweakvalidity bit --- cpp/src/arrow/compute/kernels/vector_nested_test.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cpp/src/arrow/compute/kernels/vector_nested_test.cc b/cpp/src/arrow/compute/kernels/vector_nested_test.cc index 1e72ef43d34cf..5e4c7751bc5f1 100644 --- a/cpp/src/arrow/compute/kernels/vector_nested_test.cc +++ b/cpp/src/arrow/compute/kernels/vector_nested_test.cc @@ -36,9 +36,9 @@ TEST(TestVectorNested, ListFlatten) { CheckVectorUnary("list_flatten", input, expected); // Construct a list with a non-empty null slot - TweakValidityBit(input, 0, false); + auto tweaked = TweakValidityBit(input, 0, false); expected = ArrayFromJSON(int16(), "[2, 3]"); - CheckVectorUnary("list_flatten", input, expected); + CheckVectorUnary("list_flatten", tweaked, expected); } } @@ -86,9 +86,9 @@ TEST(TestVectorNested, ListParentIndices) { // Construct a list with a non-empty null slot auto input = ArrayFromJSON(list(int16()), "[[0, null, 1], [0, 0], [2, 3], [], [4, 5]]"); - TweakValidityBit(input, 1, false); + auto tweaked = TweakValidityBit(input, 1, false); auto expected = ArrayFromJSON(int64(), "[0, 0, 0, 1, 1, 2, 2, 4, 4]"); - CheckVectorUnary("list_parent_indices", input, expected); + CheckVectorUnary("list_parent_indices", tweaked, expected); } TEST(TestVectorNested, ListParentIndicesChunkedArray) { From 80164519694a0dfbc0521628ce7b95114a20a04d Mon Sep 17 00:00:00 2001 From: kshitij12345 Date: Fri, 23 Sep 2022 17:35:06 +0000 Subject: [PATCH 2/3] add nodiscard attribute --- cpp/src/arrow/testing/gtest_util.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cpp/src/arrow/testing/gtest_util.h b/cpp/src/arrow/testing/gtest_util.h index b6bfcb8e2d38c..4c94d1cd40059 100644 --- a/cpp/src/arrow/testing/gtest_util.h +++ b/cpp/src/arrow/testing/gtest_util.h @@ -349,7 +349,7 @@ std::shared_ptr TableFromJSON(const std::shared_ptr&, // This is useful to force the underlying "value" of null entries to otherwise // invalid data and check that errors don't get reported. ARROW_TESTING_EXPORT -std::shared_ptr TweakValidityBit(const std::shared_ptr& array, +[[nodiscard]] std::shared_ptr TweakValidityBit(const std::shared_ptr& array, int64_t index, bool validity); ARROW_TESTING_EXPORT From 81030d3cad1ab40603d59708e3a2cbf4aa367828 Mon Sep 17 00:00:00 2001 From: kshitij12345 Date: Fri, 23 Sep 2022 18:16:44 +0000 Subject: [PATCH 3/3] dont use nodiscard --- cpp/src/arrow/testing/gtest_util.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cpp/src/arrow/testing/gtest_util.h b/cpp/src/arrow/testing/gtest_util.h index 4c94d1cd40059..b6bfcb8e2d38c 100644 --- a/cpp/src/arrow/testing/gtest_util.h +++ b/cpp/src/arrow/testing/gtest_util.h @@ -349,7 +349,7 @@ std::shared_ptr
TableFromJSON(const std::shared_ptr&, // This is useful to force the underlying "value" of null entries to otherwise // invalid data and check that errors don't get reported. ARROW_TESTING_EXPORT -[[nodiscard]] std::shared_ptr TweakValidityBit(const std::shared_ptr& array, +std::shared_ptr TweakValidityBit(const std::shared_ptr& array, int64_t index, bool validity); ARROW_TESTING_EXPORT