Skip to content

Commit 438a73f

Browse files
Backport ClickHouse#87029 to 25.8: Fix auto cluster functions schema handling
1 parent 25fc43f commit 438a73f

File tree

3 files changed

+13
-7
lines changed

3 files changed

+13
-7
lines changed

src/TableFunctions/TableFunctionURL.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -111,11 +111,11 @@ StoragePtr TableFunctionURL::getStorage(
111111
return std::make_shared<StorageURLCluster>(
112112
global_context,
113113
parallel_replicas_cluster_name,
114-
filename,
115-
format,
116-
compression_method,
114+
source,
115+
format_,
116+
compression_method_,
117117
StorageID(getDatabaseName(), table_name),
118-
columns,
118+
getActualTableStructure(global_context, true),
119119
ConstraintsDescription{},
120120
configuration);
121121
}

tests/queries/0_stateless/03275_auto_cluster_functions_with_parallel_replicas.reference

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ Expression ((Project names + Projection))
3333
ReadFromObjectStorage
3434
4
3535
4
36+
4
3637
Expression ((Project names + (Projection + Change column names to column identifiers)))
3738
ReadFromURL
3839
Expression ((Project names + (Projection + Change column names to column identifiers)))

tests/queries/0_stateless/03275_auto_cluster_functions_with_parallel_replicas.sql

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,15 @@ EXPLAIN SELECT number FROM system.numbers n JOIN (SELECT * FROM s3('http://local
2020
SELECT count() FROM s3('http://localhost:11111/test/a.tsv', 'TSV');
2121

2222
DROP TABLE IF EXISTS dupe_test_with_auto_functions;
23-
CREATE TABLE dupe_test_with_auto_functions (c1 String, c2 String, c3 String) ENGINE = MergeTree ORDER BY c1;
23+
CREATE TABLE dupe_test_with_auto_functions (n1 String, n2 String, n3 String) ENGINE = MergeTree ORDER BY n1;
2424
INSERT INTO dupe_test_with_auto_functions SELECT * FROM s3('http://localhost:11111/test/a.tsv', 'TSV');
2525
SELECT count() FROM dupe_test_with_auto_functions;
2626

27+
DROP TABLE IF EXISTS insert_with_url_function;
28+
CREATE TABLE insert_with_url_function (n1 String, n2 String, n3 String) ENGINE = MergeTree ORDER BY n1;
29+
INSERT INTO insert_with_url_function SELECT * FROM url('http://localhost:11111/test/a.tsv', 'TSV');
30+
SELECT count() FROM insert_with_url_function;
31+
2732

2833
SET parallel_replicas_for_cluster_engines=false;
2934

@@ -33,11 +38,11 @@ EXPLAIN SELECT * FROM s3('http://localhost:11111/test/a.tsv', 'TSV');
3338
SELECT count() FROM s3('http://localhost:11111/test/a.tsv', 'TSV');
3439

3540
DROP TABLE IF EXISTS dupe_test_without_cluster_functions;
36-
CREATE TABLE dupe_test_without_cluster_functions (c1 String, c2 String, c3 String) ENGINE = MergeTree ORDER BY c1;
41+
CREATE TABLE dupe_test_without_cluster_functions (n1 String, n2 String, n3 String) ENGINE = MergeTree ORDER BY n1;
3742
INSERT INTO dupe_test_without_cluster_functions SELECT * FROM s3('http://localhost:11111/test/a.tsv', 'TSV');
3843
SELECT count() FROM dupe_test_without_cluster_functions;
3944

4045
DROP TABLE IF EXISTS dupe_test_with_cluster_function;
41-
CREATE TABLE dupe_test_with_cluster_function (c1 String, c2 String, c3 String) ENGINE = MergeTree ORDER BY c1;
46+
CREATE TABLE dupe_test_with_cluster_function (n1 String, n2 String, n3 String) ENGINE = MergeTree ORDER BY n1;
4247
INSERT INTO dupe_test_with_cluster_function SELECT * FROM s3Cluster('test_cluster_two_shards', 'http://localhost:11111/test/a.tsv', 'TSV');
4348
SELECT count() FROM dupe_test_with_cluster_function;

0 commit comments

Comments
 (0)