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

Function isDDLQuery

src/Interpreters/executeQuery.cpp:2253–2280  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2251}
2252
2253bool isDDLQuery( [[maybe_unused]] const ContextPtr & context, const ASTPtr & query)
2254{
2255 auto * alter = query->as<ASTAlterQuery>();
2256 if (alter)
2257 {
2258 auto * command_list = alter->command_list;
2259 /// ATTACH PARTS FROM `dir` and ATTACH DETACHED PARTITION can be considered as DML
2260 if (command_list && command_list->children.size() == 1
2261 && (command_list->children[0]->as<ASTAlterCommand>()->attach_from_detached || command_list->children[0]->as<ASTAlterCommand>()->parts))
2262 return false;
2263
2264 /// DROP PARTITION and DROP PARTITION WHERE without DETACH can be considered as DML
2265 if (command_list && command_list->children.size() == 1
2266 && ((command_list->children[0]->as<ASTAlterCommand>()->type == ASTAlterCommand::Type::DROP_PARTITION
2267 || command_list->children[0]->as<ASTAlterCommand>()->type == ASTAlterCommand::Type::DROP_PARTITION_WHERE)
2268 && !command_list->children[0]->as<ASTAlterCommand>()->detach))
2269 return false;
2270
2271 /// All other ATTACH considered DDL
2272 return true;
2273 }
2274
2275 auto * create = query->as<ASTCreateQuery>();
2276 auto * drop = query->as<ASTDropQuery>();
2277 auto * rename = query->as<ASTRenameQuery>();
2278
2279 return create || (drop && drop->kind != ASTDropQuery::Kind::Truncate) || rename;
2280}
2281
2282bool isAsyncMode(ContextMutablePtr context)
2283{

Callers 1

executeQueryImplFunction · 0.85

Calls 1

sizeMethod · 0.45

Tested by

no test coverage detected