| 139 | } |
| 140 | |
| 141 | ASTPtr extractPrimaryKey(const ASTPtr & storage_ast) |
| 142 | { |
| 143 | String storage_str = queryToString(storage_ast); |
| 144 | |
| 145 | const auto & storage = storage_ast->as<ASTStorage &>(); |
| 146 | const auto & engine = storage.engine->as<ASTFunction &>(); |
| 147 | |
| 148 | if (!endsWith(engine.name, "MergeTree")) |
| 149 | { |
| 150 | throw Exception("Unsupported engine was specified in " + storage_str + ", only *MergeTree engines are supported", |
| 151 | ErrorCodes::BAD_ARGUMENTS); |
| 152 | } |
| 153 | |
| 154 | if (!isExtendedDefinitionStorage(storage_ast)) |
| 155 | { |
| 156 | throw Exception("Is not extended deginition storage " + storage_str + " Will be fixed later.", |
| 157 | ErrorCodes::BAD_ARGUMENTS); |
| 158 | } |
| 159 | |
| 160 | if (storage.primary_key) |
| 161 | return storage.primary_key->clone(); |
| 162 | |
| 163 | return nullptr; |
| 164 | } |
| 165 | |
| 166 | |
| 167 | ASTPtr extractOrderBy(const ASTPtr & storage_ast) |
no test coverage detected