zanmato1984 commented on code in PR #39383:
URL: https://github.com/apache/arrow/pull/39383#discussion_r1456194106
##########
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));
+ {
+ int64_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;
Review Comment:
If `source` is a well-constructed array, then `num_bytes` shouldn't be
greater than int32 max.
But yeah, changing `num_bytes` to `int32_t` will be more consistent with
other part. I'll change it.
--
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]