zanmato1984 commented on code in PR #39383:
URL: https://github.com/apache/arrow/pull/39383#discussion_r1456158094
##########
cpp/src/arrow/compute/light_array.cc:
##########
@@ -575,18 +576,26 @@ Status ExecBatchBuilder::AppendSelected(const
std::shared_ptr<ArrayData>& source
// Step 1: calculate target offsets
//
- uint32_t* offsets = reinterpret_cast<uint32_t*>(target->mutable_data(1));
- uint32_t sum = num_rows_before == 0 ? 0 : offsets[num_rows_before];
- Visit(source, num_rows_to_append, row_ids,
- [&](int i, const uint8_t* ptr, uint32_t num_bytes) {
- offsets[num_rows_before + i] = num_bytes;
- });
- for (int i = 0; i < num_rows_to_append; ++i) {
- uint32_t length = offsets[num_rows_before + i];
- offsets[num_rows_before + i] = sum;
- sum += length;
+ int32_t* offsets = reinterpret_cast<int32_t*>(target->mutable_data(1));
+ {
Review Comment:
Not any substantial reason. Just to hide `sum` from below to make the
following code easier to read. Perhaps it unexpectedly brings more confusion
than ease...
--
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]