MCPcopy Create free account
hub / github.com/ClickHouse/ClickHouse / checkSortedWithPermutationImpl

Function checkSortedWithPermutationImpl

src/Interpreters/sortBlock.cpp:297–313  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

295#ifndef NDEBUG
296template <typename Comparator>
297void checkSortedWithPermutationImpl(size_t rows, Comparator compare, UInt64 limit, const IColumn::Permutation & permutation)
298{
299 if (limit && limit < rows)
300 rows = limit;
301
302 const bool no_permutaiton = permutation.empty();
303
304 for (size_t i = 1; i < rows; ++i)
305 {
306 const size_t current_row = no_permutaiton ? i : permutation[i];
307 const size_t previous_row = no_permutaiton ? (i - 1) : permutation[i - 1];
308
309 if (compare(current_row, previous_row))
310 throw Exception(ErrorCodes::LOGICAL_ERROR,
311 "Rows are not sorted with permutation, position {}, previous_row index {}, current_row index {}", i, previous_row, current_row);
312 }
313}
314
315void checkSortedWithPermutation(const Block & block, const SortDescription & description, UInt64 limit, const IColumn::Permutation & permutation)
316{

Callers 1

Calls 2

ExceptionClass · 0.70
emptyMethod · 0.45

Tested by

no test coverage detected