mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-24 08:32:02 +00:00
Fix arguments parsing for object storage functions
This commit is contained in:
parent
03352372e9
commit
3ff22e3fc1
@ -86,7 +86,9 @@ void StorageObjectStorageCluster::updateQueryToSendIfNeeded(
|
||||
const DB::StorageSnapshotPtr & storage_snapshot,
|
||||
const ContextPtr & context)
|
||||
{
|
||||
ASTExpressionList * expression_list = extractTableFunctionArgumentsFromSelectQuery(query);
|
||||
auto * table_function = extractTableFunctionFromSelectQuery(query);
|
||||
auto * expression_list = table_function->arguments->as<ASTExpressionList>();
|
||||
|
||||
if (!expression_list)
|
||||
{
|
||||
throw Exception(
|
||||
@ -105,10 +107,16 @@ void StorageObjectStorageCluster::updateQueryToSendIfNeeded(
|
||||
configuration->getEngineName());
|
||||
}
|
||||
|
||||
if (table_function->name == configuration->getTypeName())
|
||||
configuration->addStructureAndFormatToArgsIfNeeded(args, structure, configuration->format, context);
|
||||
else
|
||||
{
|
||||
ASTPtr cluster_name_arg = args.front();
|
||||
args.erase(args.begin());
|
||||
configuration->addStructureAndFormatToArgsIfNeeded(args, structure, configuration->format, context);
|
||||
args.insert(args.begin(), cluster_name_arg);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
RemoteQueryExecutor::Extension StorageObjectStorageCluster::getTaskIteratorExtension(
|
||||
|
@ -10,21 +10,6 @@
|
||||
namespace DB
|
||||
{
|
||||
|
||||
ASTExpressionList * extractTableFunctionArgumentsFromSelectQuery(ASTPtr & query)
|
||||
{
|
||||
auto * select_query = query->as<ASTSelectQuery>();
|
||||
if (!select_query || !select_query->tables())
|
||||
return nullptr;
|
||||
|
||||
auto * tables = select_query->tables()->as<ASTTablesInSelectQuery>();
|
||||
auto * table_expression = tables->children[0]->as<ASTTablesInSelectQueryElement>()->table_expression->as<ASTTableExpression>();
|
||||
if (!table_expression->table_function)
|
||||
return nullptr;
|
||||
|
||||
auto * table_function = table_expression->table_function->as<ASTFunction>();
|
||||
return table_function->arguments->as<ASTExpressionList>();
|
||||
}
|
||||
|
||||
ASTFunction * extractTableFunctionFromSelectQuery(ASTPtr & query)
|
||||
{
|
||||
auto * select_query = query->as<ASTSelectQuery>();
|
||||
|
@ -35,7 +35,7 @@ public:
|
||||
if (args.empty())
|
||||
throw Exception(ErrorCodes::LOGICAL_ERROR, "Unexpected empty list of arguments for {}Cluster table function", Base::name);
|
||||
|
||||
if (table_function-> name == Base::name)
|
||||
if (table_function->name == Base::name)
|
||||
Base::updateStructureAndFormatArgumentsIfNeeded(args, structure_, format_, context);
|
||||
else
|
||||
{
|
||||
|
@ -151,8 +151,6 @@ StoragePtr TableFunctionObjectStorage<Definition, Configuration>::executeImpl(
|
||||
&& !parallel_replicas_cluster_name.empty()
|
||||
&& !context->isDistributed();
|
||||
|
||||
LOG_DEBUG(&Poco::Logger::get("TableFunctionObjectStorage"), "Is distributed: {}", context->isDistributed());
|
||||
|
||||
if (can_use_parallel_replicas)
|
||||
{
|
||||
storage = std::make_shared<StorageObjectStorageCluster>(
|
||||
|
@ -159,8 +159,6 @@ StoragePtr TableFunctionURL::getStorage(
|
||||
&& !parallel_replicas_cluster_name.empty()
|
||||
&& !global_context->isDistributed();
|
||||
|
||||
LOG_DEBUG(&Poco::Logger::get("TableFunctionURL"), "Is distributed: {}", global_context->isDistributed());
|
||||
|
||||
if (can_use_parallel_replicas)
|
||||
{
|
||||
return std::make_shared<StorageURLCluster>(
|
||||
|
Loading…
Reference in New Issue
Block a user