kou commented on code in PR #49443:
URL: https://github.com/apache/arrow/pull/49443#discussion_r2901734586
##########
cpp/src/arrow/compute/kernels/scalar_if_else.cc:
##########
@@ -745,9 +745,17 @@ struct IfElseFunctor<Type, enable_if_base_binary<Type>> {
ARROW_ASSIGN_OR_RAISE(out_data->buffers[1],
ctx->Allocate(offset_length));
std::memcpy(out_data->buffers[1]->mutable_data(), right_offsets,
offset_length);
- auto right_data_length = right_offsets[right.length] - right_offsets[0];
+ OffsetType base = right_offsets[0];
+ auto* out_offsets =
+ reinterpret_cast<OffsetType*>(out_data->buffers[1]->mutable_data());
+ for (int64_t i = 0; i <= cond.length; ++i) {
+ out_offsets[i] = right_offsets[i] - base;
+ }
Review Comment:
This change always (1) copies right offsets and (2) recomputes right
offsets, right?
Can we use do the following?
1. If right array isn't sliced, we use only (1)
2. If right array is sliced, we use only (2)
--
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]