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

Function isAlreadySorted

src/Interpreters/sortBlock.cpp:391–418  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

389}
390
391bool isAlreadySorted(const Block & block, const SortDescription & description)
392{
393 if (block.empty())
394 return true;
395
396 ColumnsWithSortDescriptions columns_with_sort_desc = getColumnsWithSortDescription(block, description);
397 bool is_collation_required = false;
398
399 for (auto & column_with_sort_desc : columns_with_sort_desc)
400 {
401 if (isCollationRequired(column_with_sort_desc.description))
402 {
403 is_collation_required = true;
404 break;
405 }
406 }
407
408 size_t rows = block.rows();
409
410 if (is_collation_required)
411 {
412 PartialSortingLessWithCollation less(columns_with_sort_desc);
413 return isAlreadySortedImpl(rows, less);
414 }
415
416 PartialSortingLess less(columns_with_sort_desc);
417 return isAlreadySortedImpl(rows, less);
418}
419
420}

Callers 2

writeTempPartImplMethod · 0.85

Calls 5

isCollationRequiredFunction · 0.85
isAlreadySortedImplFunction · 0.85
emptyMethod · 0.45
rowsMethod · 0.45

Tested by

no test coverage detected