felipecrv commented on code in PR #42067:
URL: https://github.com/apache/arrow/pull/42067#discussion_r1635557203
##########
cpp/src/arrow/compute/kernels/scalar_nested_test.cc:
##########
@@ -264,22 +276,25 @@ TEST(TestScalarNested, ListSliceChildArrayOffset) {
ASSERT_EQ(input->offset(), 0);
ASSERT_EQ(input->values()->offset(), 2);
- ListSliceOptions args(/*start=*/0, /*stop=*/2, /*step=*/1,
+ ListSliceOptions args(/*start=*/0, /*stop=*/3, /*step=*/1,
Review Comment:
I wanted padding to be more varied — `null, nul]` and `null]` in this
example after my change.
```diff
ListSlice: Change test case to have a case with >1 null-padding
diff --git a/cpp/src/arrow/compute/kernels/scalar_nested_test.cc
b/cpp/src/arrow/compute/kernels/scalar_nested_test.cc
index 0ffab23685..5648cb7930 100644
--- a/cpp/src/arrow/compute/kernels/scalar_nested_test.cc
+++ b/cpp/src/arrow/compute/kernels/scalar_nested_test.cc
@@ -276,13 +276,13 @@ TEST(TestScalarNested, ListSliceChildArrayOffset) {
ASSERT_EQ(input->offset(), 0);
ASSERT_EQ(input->values()->offset(), 2);
- ListSliceOptions args(/*start=*/0, /*stop=*/2, /*step=*/1,
+ ListSliceOptions args(/*start=*/0, /*stop=*/3, /*step=*/1,
/*return_fixed_size_list=*/false);
auto expected = ArrayFromJSON(list(int8()), "[[2], [3, 4]]");
CheckScalarUnary("list_slice", input, expected, &args);
args.return_fixed_size_list = true;
- expected = ArrayFromJSON(fixed_size_list(int8(), 2), "[[2, null], [3,
4]]");
+ expected = ArrayFromJSON(fixed_size_list(int8(), 3), "[[2, null, null],
[3, 4, null]]");
CheckScalarUnary("list_slice", input, expected, &args);
}
```
This avoid the possibility of a `AppendNull()` passing as the correct
implementation when an `AppendNulls(2)` needed to be called. Some commits
later, I made this change:
```diff
- if constexpr (kIsFixedSizeOutput) {
- while (cursor_offset < stop_offset) {
- RETURN_NOT_OK(out_value_builder->AppendNull());
- cursor_offset += step;
- }
+ if (null_padding > 0) {
+ RETURN_NOT_OK(out_value_builder->AppendNulls(null_padding));
}
```
--
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]