-
Notifications
You must be signed in to change notification settings - Fork 6.6k
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 #62993 from ClickHouse/backport/24.3/62811
Backport #62811 to 24.3: Fix FINAL modifier is not respected in CTE with analyzer
- Loading branch information
Showing
3 changed files
with
55 additions
and
1 deletion.
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
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,24 @@ | ||
QUERY id: 0 | ||
PROJECTION COLUMNS | ||
key Int64 | ||
someCol String | ||
eventTime DateTime | ||
PROJECTION | ||
LIST id: 1, nodes: 3 | ||
COLUMN id: 2, column_name: key, result_type: Int64, source_id: 3 | ||
COLUMN id: 4, column_name: someCol, result_type: String, source_id: 3 | ||
COLUMN id: 5, column_name: eventTime, result_type: DateTime, source_id: 3 | ||
JOIN TREE | ||
QUERY id: 3, alias: __table1, is_subquery: 1, is_cte: 1, cte_name: merged_test | ||
PROJECTION COLUMNS | ||
key Int64 | ||
someCol String | ||
eventTime DateTime | ||
PROJECTION | ||
LIST id: 6, nodes: 3 | ||
COLUMN id: 7, column_name: key, result_type: Int64, source_id: 8 | ||
COLUMN id: 9, column_name: someCol, result_type: String, source_id: 8 | ||
COLUMN id: 10, column_name: eventTime, result_type: DateTime, source_id: 8 | ||
JOIN TREE | ||
TABLE id: 8, alias: __table2, table_name: default.t, final: 1 | ||
1 first 2024-04-19 01:01:01 |
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,28 @@ | ||
DROP TABLE IF EXISTS t; | ||
|
||
CREATE TABLE t | ||
( | ||
`key` Int64, | ||
`someCol` String, | ||
`eventTime` DateTime | ||
) | ||
ENGINE = ReplacingMergeTree(eventTime) | ||
ORDER BY key; | ||
|
||
INSERT INTO t Values (1, 'first', '2024-04-19 01:01:01'); | ||
INSERT INTO t Values (1, 'first', '2024-04-19 01:01:01'); | ||
|
||
SET allow_experimental_analyzer = 1; | ||
|
||
EXPLAIN QUERY TREE passes=1 | ||
WITH merged_test AS( | ||
SELECT * FROM t Final | ||
) | ||
SELECT * FROM merged_test; | ||
|
||
WITH merged_test AS( | ||
SELECT * FROM t Final | ||
) | ||
SELECT * FROM merged_test; | ||
|
||
DROP TABLE t; |