Skip to content

Commit f6b6495

Browse files
authored
Merge pull request ClickHouse#78587 from ClickHouse/divanik/fix_bug_with_cluster_table_function_settings_parsing
Process table-level settings in ObjectStorage cluster table functions correctly
2 parents db482c4 + 7f6dea2 commit f6b6495

File tree

3 files changed

+24
-0
lines changed

3 files changed

+24
-0
lines changed

src/Storages/ObjectStorage/StorageObjectStorageCluster.cpp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
#include <Common/Exception.h>
44
#include <Common/StringUtils.h>
5+
#include <Parsers/ASTSetQuery.h>
56

67
#include <Core/Settings.h>
78
#include <Formats/FormatFactory.h>
@@ -116,6 +117,18 @@ void StorageObjectStorageCluster::updateQueryToSendIfNeeded(
116117
configuration->getEngineName());
117118
}
118119

120+
ASTPtr settings_temporary_storage = nullptr;
121+
for (auto * it = args.begin(); it != args.end(); ++it)
122+
{
123+
ASTSetQuery * settings_ast = (*it)->as<ASTSetQuery>();
124+
if (settings_ast)
125+
{
126+
settings_temporary_storage = std::move(*it);
127+
args.erase(it);
128+
break;
129+
}
130+
}
131+
119132
if (!endsWith(table_function->name, "Cluster"))
120133
configuration->addStructureAndFormatToArgsIfNeeded(args, structure, configuration->format, context, /*with_structure=*/true);
121134
else
@@ -125,6 +138,10 @@ void StorageObjectStorageCluster::updateQueryToSendIfNeeded(
125138
configuration->addStructureAndFormatToArgsIfNeeded(args, structure, configuration->format, context, /*with_structure=*/true);
126139
args.insert(args.begin(), cluster_name_arg);
127140
}
141+
if (settings_temporary_storage)
142+
{
143+
args.insert(args.end(), std::move(settings_temporary_storage));
144+
}
128145
}
129146

130147
RemoteQueryExecutor::Extension StorageObjectStorageCluster::getTaskIteratorExtension(
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
1 Mars
2+
1 Mars
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
-- Tags: no-fasttest
2+
-- Tag no-fasttest: Depends on AWS
3+
4+
SELECT * FROM icebergS3Cluster('test_cluster_two_shards_localhost', 'http://localhost:11111/test/est', 'clickhouse', 'clickhouse', SETTINGS iceberg_metadata_file_path = 'metadata/v2.metadata.json');
5+
SELECT * FROM icebergS3Cluster('test_cluster_two_shards_localhost', s3_conn, filename='est', SETTINGS iceberg_metadata_file_path = 'metadata/v2.metadata.json');

0 commit comments

Comments
 (0)