Skip to content
This repository has been archived by the owner on Sep 18, 2023. It is now read-only.

Commit

Permalink
[NSE-910] fix bug of PR903 (#911)
Browse files Browse the repository at this point in the history
  • Loading branch information
FelixYBW authored May 10, 2022
1 parent 424d41c commit ffb45e4
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions native-sql-engine/cpp/src/shuffle/splitter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1424,13 +1424,15 @@ arrow::Status Splitter::SplitFixedWidthValidityBuffer(const arrow::RecordBatch&
partition_buffer_dst_offset_[pid]++;
}
// set the last byte
auto lastoffset = partition_buffer_dst_offset_[pid];
uint8_t dst = dst_addrs[pid][lastoffset >> 3];
uint8_t msk = 0x1 << (lastoffset & 0x7);
msk = ~(msk - 1);
msk &= ((lastoffset & 7) == 0) - 1;
dst |= msk;
dst_addrs[pid][lastoffset >> 3] = dst;
if (partition_id_cnt_[pid] > 0 && dst_addrs[pid] != nullptr) {
auto lastoffset = partition_buffer_dst_offset_[pid];
uint8_t dst = dst_addrs[pid][lastoffset >> 3];
uint8_t msk = 0x1 << (lastoffset & 0x7);
msk = ~(msk - 1);
msk &= ((lastoffset & 7) == 0) - 1;
dst |= msk;
dst_addrs[pid][lastoffset >> 3] = dst;
}
}
#else
for (auto row = 0; row < num_rows; ++row) {
Expand Down

0 comments on commit ffb45e4

Please sign in to comment.