MCPcopy Create free account
hub / github.com/ByConity/ByConity / getSortDescription

Function getSortDescription

src/Interpreters/InterpreterSelectQuery.cpp:1045–1068  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1043}
1044
1045static 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
1070static SortDescription getSortDescriptionFromGroupBy(const ASTSelectQuery & query)
1071{

Callers 6

executeImplMethod · 0.70
executeFetchColumnsMethod · 0.70
executeOrderMethod · 0.70
executeMergeSortedMethod · 0.70
executeWithFillMethod · 0.70
executeLimitMethod · 0.70

Calls 6

frontMethod · 0.80
reserveMethod · 0.45
sizeMethod · 0.45
orderByMethod · 0.45
getColumnNameMethod · 0.45
emplace_backMethod · 0.45

Tested by

no test coverage detected