Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions cpp/src/arrow/compute/kernels/vector_sort.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Comment on lines +234 to +246

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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!

}
}

Expand Down
6 changes: 3 additions & 3 deletions cpp/src/parquet/arrow/reader.cc
Original file line number Diff line number Diff line change
Expand Up @@ -732,12 +732,12 @@ class PARQUET_NO_EXPORT FixedSizeListReader : public ListReader<int32_t> {
const int32_t expected_size = has_elements ? list_size : 0;
std::span<const int32_t> run_offsets(offsets + start,
static_cast<size_t>(length + 1));
const auto first_invalid_offset = std::ranges::adjacent_find(
run_offsets,
const auto first_invalid_offset = std::adjacent_find(
run_offsets.begin(), run_offsets.end(),
[&](int32_t left, int32_t right) { return right - left != expected_size; });
if (first_invalid_offset != run_offsets.end()) {
const int64_t x =
start + std::ranges::distance(run_offsets.begin(), first_invalid_offset);
start + std::distance(run_offsets.begin(), first_invalid_offset);
const int32_t size = offsets[x + 1] - offsets[x];
if (has_elements) {
return Status::Invalid("Expected all lists to be of size=", list_size,
Expand Down
Loading