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

Method visitASTSelectQuery

src/Optimizer/QueryUseOptimizerChecker.cpp:240–286  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

238}
239
240bool QueryUseOptimizerVisitor::visitASTSelectQuery(ASTPtr & node, QueryUseOptimizerContext & context)
241{
242 auto * select = node->as<ASTSelectQuery>();
243
244 if (select->limit_with_ties)
245 {
246 reason = "LIMIT/OFFSET FETCH WITH TIES not implemented";
247 return false;
248 }
249
250 if (context.disallow_subquery)
251 {
252 reason = "nullIn/globalNullIn/notNullIn/globalNotNullIn function with subquery not implemented";
253 return false;
254 }
255
256 if (select->group_by_with_totals && context.disallow_with_totals)
257 {
258 reason = "group by with totals only supports with totals at outmost select";
259 return false;
260 }
261 auto has_join = [](const auto & sel_query) { return sel_query.tables() && sel_query.tables()->children.size() > 1; };
262
263 QueryUseOptimizerContext child_context{.context = context.context, .ctes = context.ctes, .disallow_with_totals = has_join(*select)};
264 collectWithTableNames(*select, child_context.ctes);
265
266 for (const auto * table_expression : getTableExpressions(*select))
267 {
268 if (!checkDatabaseAndTable(*table_expression, child_context.context, child_context.ctes))
269 {
270 reason = "unsupported storage: " + table_expression->formatForErrorMessage();
271 return false;
272 }
273 if (table_expression->table_function)
274 {
275 const auto & function = table_expression->table_function->as<ASTFunction &>();
276
277 if (function.name == "fusionMerge")
278 return true;
279
280 reason = "table function";
281 return false;
282 }
283 }
284
285 return visitNode(node, child_context);
286}
287
288bool QueryUseOptimizerVisitor::visitASTTableJoin(ASTPtr & node, QueryUseOptimizerContext & context)
289{

Callers

nothing calls this directly

Calls 5

getTableExpressionsFunction · 0.85
checkDatabaseAndTableFunction · 0.85
formatForErrorMessageMethod · 0.80
tablesMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected