| 2251 | } |
| 2252 | |
| 2253 | bool 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 | |
| 2282 | bool isAsyncMode(ContextMutablePtr context) |
| 2283 | { |
no test coverage detected