mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-17 20:02:05 +00:00
Stricter checks
This commit is contained in:
parent
07821a576d
commit
5b1f7c258b
@ -87,8 +87,15 @@ void StorageObjectStorageCluster::updateQueryToSendIfNeeded(
|
||||
const ContextPtr & context)
|
||||
{
|
||||
auto * table_function = extractTableFunctionFromSelectQuery(query);
|
||||
auto * expression_list = table_function->arguments->as<ASTExpressionList>();
|
||||
if (!table_function)
|
||||
{
|
||||
throw Exception(
|
||||
ErrorCodes::LOGICAL_ERROR,
|
||||
"Expected SELECT query from table function {}, got '{}'",
|
||||
configuration->getEngineName(), queryToString(query));
|
||||
}
|
||||
|
||||
auto * expression_list = table_function->arguments->as<ASTExpressionList>();
|
||||
if (!expression_list)
|
||||
{
|
||||
throw Exception(
|
||||
@ -109,13 +116,15 @@ void StorageObjectStorageCluster::updateQueryToSendIfNeeded(
|
||||
|
||||
if (table_function->name == configuration->getTypeName())
|
||||
configuration->addStructureAndFormatToArgsIfNeeded(args, structure, configuration->format, context);
|
||||
else
|
||||
else if (table_function->name == fmt::format("{}Cluster", configuration->getTypeName()))
|
||||
{
|
||||
ASTPtr cluster_name_arg = args.front();
|
||||
args.erase(args.begin());
|
||||
configuration->addStructureAndFormatToArgsIfNeeded(args, structure, configuration->format, context);
|
||||
args.insert(args.begin(), cluster_name_arg);
|
||||
}
|
||||
else
|
||||
throw Exception(ErrorCodes::LOGICAL_ERROR, "Unexpected table function name: {}", table_function->name);
|
||||
|
||||
}
|
||||
|
||||
|
@ -83,6 +83,12 @@ StorageURLCluster::StorageURLCluster(
|
||||
void StorageURLCluster::updateQueryToSendIfNeeded(ASTPtr & query, const StorageSnapshotPtr & storage_snapshot, const ContextPtr & context)
|
||||
{
|
||||
auto * table_function = extractTableFunctionFromSelectQuery(query);
|
||||
if (!table_function)
|
||||
throw Exception(ErrorCodes::LOGICAL_ERROR, "Expected SELECT query from table function urlCluster, got '{}'", queryToString(query));
|
||||
|
||||
auto * expression_list = table_function->arguments->as<ASTExpressionList>();
|
||||
if (!expression_list)
|
||||
throw Exception(ErrorCodes::LOGICAL_ERROR, "Expected SELECT query from table function urlCluster, got '{}'", queryToString(query));
|
||||
|
||||
TableFunctionURLCluster::updateStructureAndFormatArgumentsIfNeeded(
|
||||
table_function,
|
||||
|
@ -35,13 +35,15 @@ public:
|
||||
|
||||
if (table_function->name == Base::name)
|
||||
Base::updateStructureAndFormatArgumentsIfNeeded(args, structure_, format_, context);
|
||||
else
|
||||
else if (table_function->name == fmt::format("{}Cluster", Base::name))
|
||||
{
|
||||
ASTPtr cluster_name_arg = args.front();
|
||||
args.erase(args.begin());
|
||||
Base::updateStructureAndFormatArgumentsIfNeeded(args, structure_, format_, context);
|
||||
args.insert(args.begin(), cluster_name_arg);
|
||||
}
|
||||
else
|
||||
throw Exception(ErrorCodes::LOGICAL_ERROR, "Unexpected table function name: {}", table_function->name);
|
||||
}
|
||||
|
||||
protected:
|
||||
|
Loading…
Reference in New Issue
Block a user