MCPcopy Create free account
hub / github.com/apache/arrow / VisitConstantRanges

Function VisitConstantRanges

cpp/src/arrow/compute/kernels/vector_sort.cc:227–248  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

225// to be non-null.
226template <typename ArrayType, typename Visitor>
227void VisitConstantRanges(const ArrayType& array, std::span<uint64_t> indices,
228 int64_t offset, Visitor&& visit) {
229 using GetView = GetViewType<typename ArrayType::TypeClass>;
230
231 if (indices.empty()) {
232 return;
233 }
234 size_t range_start = 0;
235 size_t range_cur = 0;
236 auto last_value = GetView::LogicalValue(array.GetView(indices[range_cur] - offset));
237 while (++range_cur != indices.size()) {
238 auto v = GetView::LogicalValue(array.GetView(indices[range_cur] - offset));
239 if (v != last_value) {
240 visit(indices.subspan(range_start, range_cur - range_start));
241 range_start = range_cur;
242 last_value = v;
243 }
244 }
245 if (range_start != range_cur) {
246 visit(indices.subspan(range_start, range_cur - range_start));
247 }
248}
249
250// A sorter for a single column of a RecordBatch, deferring to the next column
251// for ranges of equal values.

Callers 1

SortRangeMethod · 0.85

Calls 3

emptyMethod · 0.45
GetViewMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected