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

Function getLimitForSorting

src/Interpreters/InterpreterSelectQuery.cpp:1119–1131  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1117
1118
1119static UInt64 getLimitForSorting(const ASTSelectQuery & query, ContextPtr context)
1120{
1121 /// Partial sort can be done if there is LIMIT but no DISTINCT or LIMIT BY, neither ARRAY JOIN.
1122 if (!query.distinct && !query.limitBy() && !query.limit_with_ties && !query.arrayJoinExpressionList() && query.limitLength())
1123 {
1124 auto [limit_length, limit_offset] = getLimitLengthAndOffset(query, context);
1125 if (limit_length > std::numeric_limits<UInt64>::max() - limit_offset)
1126 return 0;
1127
1128 return limit_length + limit_offset;
1129 }
1130 return 0;
1131}
1132
1133
1134static bool hasWithTotalsInAnySubqueryInFromClause(const ASTSelectQuery & query)

Callers 2

executeOrderMethod · 0.85
executeMergeSortedMethod · 0.85

Calls 5

getLimitLengthAndOffsetFunction · 0.85
limitByMethod · 0.80
maxFunction · 0.50
limitLengthMethod · 0.45

Tested by

no test coverage detected