| 91 | } |
| 92 | |
| 93 | SortDescription 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 |
no test coverage detected