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

Function extractOrderBy

programs/copier/Internals.cpp:167–190  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

165
166
167ASTPtr 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.
193std::string wrapIdentifiersWithBackticks(const ASTPtr & root)

Callers 1

Calls 5

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

Tested by

no test coverage detected