| 165 | |
| 166 | |
| 167 | ASTPtr extractOrderBy(const ASTPtr & storage_ast) |
| 168 | { |
| 169 | String storage_str = queryToString(storage_ast); |
| 170 | |
| 171 | const auto & storage = storage_ast->as<ASTStorage &>(); |
| 172 | const auto & engine = storage.engine->as<ASTFunction &>(); |
| 173 | |
| 174 | if (!endsWith(engine.name, "MergeTree")) |
| 175 | { |
| 176 | throw Exception("Unsupported engine was specified in " + storage_str + ", only *MergeTree engines are supported", |
| 177 | ErrorCodes::BAD_ARGUMENTS); |
| 178 | } |
| 179 | |
| 180 | if (!isExtendedDefinitionStorage(storage_ast)) |
| 181 | { |
| 182 | throw Exception("Is not extended deginition storage " + storage_str + " Will be fixed later.", |
| 183 | ErrorCodes::BAD_ARGUMENTS); |
| 184 | } |
| 185 | |
| 186 | if (storage.order_by) |
| 187 | return storage.order_by->clone(); |
| 188 | |
| 189 | throw Exception("ORDER BY cannot be empty", ErrorCodes::BAD_ARGUMENTS); |
| 190 | } |
| 191 | |
| 192 | /// Wraps only identifiers with backticks. |
| 193 | std::string wrapIdentifiersWithBackticks(const ASTPtr & root) |
no test coverage detected