taepper commented on code in PR #50705:
URL: https://github.com/apache/arrow/pull/50705#discussion_r3675850405
##########
cpp/src/arrow/compute/kernels/vector_sort.cc:
##########
@@ -231,19 +231,19 @@ void VisitConstantRanges(const ArrayType& array,
std::span<uint64_t> indices,
if (indices.empty()) {
return;
}
- auto range_start = indices.begin();
- auto range_cur = range_start;
- auto last_value = GetView::LogicalValue(array.GetView(*range_cur - offset));
- while (++range_cur != indices.end()) {
- auto v = GetView::LogicalValue(array.GetView(*range_cur - offset));
+ size_t range_start = 0;
+ size_t range_cur = 0;
+ auto last_value = GetView::LogicalValue(array.GetView(indices[range_cur] -
offset));
+ while (++range_cur != indices.size()) {
+ auto v = GetView::LogicalValue(array.GetView(indices[range_cur] - offset));
if (v != last_value) {
- visit({range_start, range_cur});
+ visit(indices.subspan(range_start, range_cur - range_start));
range_start = range_cur;
last_value = v;
}
}
if (range_start != range_cur) {
- visit({range_start, range_cur});
+ visit(indices.subspan(range_start, range_cur - range_start));
Review Comment:
This looks very sensible. Good idea to revert to `size_t` entirely instead
of recalculating (start, size) using iterator differences in the `subspan`
calls!
Thank you, I was not aware of the portability problems re/ `std::span`!
--
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]