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

Function extractPrimaryKey

programs/copier/Internals.cpp:141–164  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

139}
140
141ASTPtr 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
167ASTPtr extractOrderBy(const ASTPtr & storage_ast)

Callers 1

Calls 5

queryToStringFunction · 0.85
endsWithFunction · 0.50
ExceptionClass · 0.50
cloneMethod · 0.45

Tested by

no test coverage detected