| 295 | #ifndef NDEBUG |
| 296 | template <typename Comparator> |
| 297 | void 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 | |
| 315 | void checkSortedWithPermutation(const Block & block, const SortDescription & description, UInt64 limit, const IColumn::Permutation & permutation) |
| 316 | { |
no test coverage detected