| 1043 | } |
| 1044 | |
| 1045 | static SortDescription getSortDescription(const ASTSelectQuery & query, ContextPtr ctx) |
| 1046 | { |
| 1047 | SortDescription order_descr; |
| 1048 | order_descr.reserve(query.orderBy()->children.size()); |
| 1049 | for (const auto & elem : query.orderBy()->children) |
| 1050 | { |
| 1051 | String name = elem->children.front()->getColumnName(); |
| 1052 | const auto & order_by_elem = elem->as<ASTOrderByElement &>(); |
| 1053 | |
| 1054 | std::shared_ptr<Collator> collator; |
| 1055 | if (order_by_elem.collation) |
| 1056 | collator = std::make_shared<Collator>(order_by_elem.collation->as<ASTLiteral &>().value.get<String>()); |
| 1057 | |
| 1058 | if (order_by_elem.with_fill) |
| 1059 | { |
| 1060 | FillColumnDescription fill_desc = InterpreterSelectQuery::getWithFillDescription(order_by_elem, ctx); |
| 1061 | order_descr.emplace_back(name, order_by_elem.direction, order_by_elem.nulls_direction, collator, true, fill_desc); |
| 1062 | } |
| 1063 | else |
| 1064 | order_descr.emplace_back(name, order_by_elem.direction, order_by_elem.nulls_direction, collator); |
| 1065 | } |
| 1066 | |
| 1067 | return order_descr; |
| 1068 | } |
| 1069 | |
| 1070 | static SortDescription getSortDescriptionFromGroupBy(const ASTSelectQuery & query) |
| 1071 | { |
no test coverage detected