-
Notifications
You must be signed in to change notification settings - Fork 7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #70868 from ClickHouse/cherrypick/24.7/688c9717db9…
…0cf1c8f242c3fe583d6add0a86718 Cherry pick #70103 to 24.7: Avoid reusing columns among different named tuples
- Loading branch information
Showing
3 changed files
with
56 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
tests/queries/0_stateless/03240_insert_select_named_tuple.reference
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
1 ('dete','ok') ('dete','ok') | ||
{"id":1,"a":{"col_a":"dete","type":"ok"},"b":{"col_b":"dete","type":"ok"}} | ||
{"id":1,"a":{"col_a":"dete","type":"ok"},"b":{"col_b":"dete","type":"ok"}} |
22 changes: 22 additions & 0 deletions
22
tests/queries/0_stateless/03240_insert_select_named_tuple.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
SET enable_analyzer = 1; | ||
SET enable_named_columns_in_function_tuple = 1; | ||
|
||
DROP TABLE IF EXISTS src; | ||
DROP TABLE IF EXISTS dst; | ||
|
||
CREATE TABLE src (id UInt32, type String, data String) ENGINE=MergeTree ORDER BY tuple(); | ||
CREATE TABLE dst (id UInt32, a Tuple (col_a Nullable(String), type String), b Tuple (col_b Nullable(String), type String)) ENGINE = MergeTree ORDER BY id; | ||
|
||
INSERT INTO src VALUES (1, 'ok', 'data'); | ||
INSERT INTO dst (id, a, b) SELECT id, tuple(replaceAll(data, 'a', 'e') AS col_a, type) AS a, tuple(replaceAll(data, 'a', 'e') AS col_b, type) AS b FROM src; | ||
SELECT * FROM dst; | ||
|
||
DROP TABLE src; | ||
DROP TABLE dst; | ||
|
||
DROP TABLE IF EXISTS src; | ||
CREATE TABLE src (id UInt32, type String, data String) ENGINE=MergeTree ORDER BY tuple(); | ||
INSERT INTO src VALUES (1, 'ok', 'data'); | ||
SELECT id, tuple(replaceAll(data, 'a', 'e') AS col_a, type) AS a, tuple(replaceAll(data, 'a', 'e') AS col_b, type) AS b FROM cluster(test_cluster_two_shards, currentDatabase(), src) SETTINGS prefer_localhost_replica=0 FORMAT JSONEachRow; | ||
|
||
DROP TABLE src; |