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

Function getCollationAwareSortPrefixInColumns

src/Core/SortDescription.cpp:93–112  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

91}
92
93SortDescription getCollationAwareSortPrefixInColumns(const SortDescription & description, const Names & columns)
94{
95 std::unordered_set<std::string_view> column_set(columns.begin(), columns.end());
96
97 SortDescription prefix;
98 for (const auto & sort_column_desc : description)
99 {
100 if (!column_set.contains(sort_column_desc.column_name))
101 break;
102
103 /// A collated column is ordered by its collation key, not by value, so equal values are not
104 /// adjacent; in-order grouping (DISTINCT / LIMIT BY) cannot rely on it. Stop the prefix here.
105 if (sort_column_desc.collator)
106 break;
107
108 prefix.emplace_back(sort_column_desc);
109 }
110
111 return prefix;
112}
113
114#if USE_EMBEDDED_COMPILER
115

Callers 4

pushLimitByIntoSortFunction · 0.85
buildInputOrderInfoFunction · 0.85
applyOrderFunction · 0.85

Calls 4

beginMethod · 0.45
endMethod · 0.45
containsMethod · 0.45
emplace_backMethod · 0.45

Tested by

no test coverage detected