lidavidm commented on a change in pull request #10880:
URL: https://github.com/apache/arrow/pull/10880#discussion_r683590441
##########
File path: cpp/src/arrow/compute/kernels/vector_selection_test.cc
##########
@@ -996,6 +996,16 @@ TEST_F(TestTakeKernel, InvalidIndexType) {
"[0.0, 1.0, 0.1]", &arr));
}
+TEST_F(TestTakeKernel, TakeEmptyIndices) {
+ Datum out;
+ auto dat = Datum(std::make_shared<ChunkedArray>(ArrayFromJSON(int8(),
"[]")));
+ auto idx = Datum(std::make_shared<ChunkedArray>(ArrayVector(), int32()));
+ auto ret = Take(dat, idx).Value(&out);
+ ASSERT_OK(ret);
Review comment:
```suggestion
TEST_F(TestTakeKernel, TakeEmptyIndices) {
Datum dat = ChunkedArrayFromJSON(int8(), {"[]"});
Datum idx = ChunkedArrayFromJSON(int32(), {});
ASSERT_OK_AND_ASSIGN(auto out, Take(dat, idx));
```
##########
File path: cpp/src/arrow/compute/kernels/vector_selection_test.cc
##########
@@ -996,6 +996,16 @@ TEST_F(TestTakeKernel, InvalidIndexType) {
"[0.0, 1.0, 0.1]", &arr));
}
+TEST_F(TestTakeKernel, TakeEmptyIndices) {
+ Datum out;
+ auto dat = Datum(std::make_shared<ChunkedArray>(ArrayFromJSON(int8(),
"[]")));
+ auto idx = Datum(std::make_shared<ChunkedArray>(ArrayVector(), int32()));
+ auto ret = Take(dat, idx).Value(&out);
+ ASSERT_OK(ret);
Review comment:
This can be simplified a bit.
##########
File path: cpp/src/arrow/compute/kernels/vector_selection_test.cc
##########
@@ -996,6 +996,16 @@ TEST_F(TestTakeKernel, InvalidIndexType) {
"[0.0, 1.0, 0.1]", &arr));
}
+TEST_F(TestTakeKernel, TakeEmptyIndices) {
+ Datum out;
+ auto dat = Datum(std::make_shared<ChunkedArray>(ArrayFromJSON(int8(),
"[]")));
+ auto idx = Datum(std::make_shared<ChunkedArray>(ArrayVector(), int32()));
+ auto ret = Take(dat, idx).Value(&out);
+ ASSERT_OK(ret);
Review comment:
I think we should test both branches above too. This tests the changes
in TestCC, we can add a test for TestAC that calls Take with an Array and an
empty (chunk-less) ChunkedArray.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]