Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CLICKHOUSE-4523 Fix "Column '0' already exists" in SELECT .. PREWHERE…
… on column with DEFAULT (#5397) * CLICKHOUSE-4523 Fix "Column '0' already exists" in SELECT .. PREWHERE on column with DEFAULT * fix style * Fix build * Update iostream_debug_helpers.cpp * Update evaluateMissingDefaults.cpp
- Loading branch information
1 parent
10ed439
commit 6c1cb02
Showing
6 changed files
with
128 additions
and
3 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
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
7 changes: 7 additions & 0 deletions
7
dbms/tests/queries/0_stateless/00950_default_prewhere.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,7 @@ | ||
42 | ||
42 42 42 | ||
42 42 43 | ||
43 | ||
43 | ||
43 | ||
42 42 43 |
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,21 @@ | ||
|
||
DROP TABLE IF EXISTS test_generic_events_all; | ||
|
||
CREATE TABLE test_generic_events_all (APIKey UInt8, SessionType UInt8) ENGINE = MergeTree() PARTITION BY APIKey ORDER BY tuple(); | ||
INSERT INTO test_generic_events_all VALUES( 42, 42 ); | ||
ALTER TABLE test_generic_events_all ADD COLUMN OperatingSystem UInt64 DEFAULT 42; | ||
SELECT OperatingSystem FROM test_generic_events_all PREWHERE APIKey = 42 WHERE SessionType = 42; | ||
SELECT * FROM test_generic_events_all PREWHERE APIKey = 42 WHERE SessionType = 42; | ||
|
||
DROP TABLE IF EXISTS test_generic_events_all; | ||
|
||
CREATE TABLE test_generic_events_all (APIKey UInt8, SessionType UInt8) ENGINE = MergeTree() PARTITION BY APIKey ORDER BY tuple(); | ||
INSERT INTO test_generic_events_all VALUES( 42, 42 ); | ||
ALTER TABLE test_generic_events_all ADD COLUMN OperatingSystem UInt64 DEFAULT SessionType+1; | ||
SELECT * FROM test_generic_events_all WHERE APIKey = 42 AND SessionType = 42; | ||
SELECT OperatingSystem FROM test_generic_events_all WHERE APIKey = 42; | ||
SELECT OperatingSystem FROM test_generic_events_all WHERE APIKey = 42 AND SessionType = 42; | ||
SELECT OperatingSystem FROM test_generic_events_all PREWHERE APIKey = 42 WHERE SessionType = 42; | ||
SELECT * FROM test_generic_events_all PREWHERE APIKey = 42 WHERE SessionType = 42; | ||
|
||
DROP TABLE IF EXISTS test_generic_events_all; |
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,12 @@ | ||
DROP TABLE IF EXISTS test_generic_events_all; | ||
CREATE TABLE test_generic_events_all (APIKey UInt8, SessionType UInt8) ENGINE = MergeTree() PARTITION BY APIKey ORDER BY tuple(); | ||
INSERT INTO test_generic_events_all VALUES( 42, 42 ); | ||
ALTER TABLE test_generic_events_all ADD COLUMN OperatingSystem UInt64 DEFAULT APIKey+1; | ||
SELECT * FROM test_generic_events_all WHERE APIKey = 42 AND SessionType = 42; | ||
-- InterpreterSelectQuery: MergeTreeWhereOptimizer: condition "APIKey = 42" moved to PREWHERE | ||
SELECT OperatingSystem FROM test_generic_events_all WHERE APIKey = 42; | ||
SELECT OperatingSystem FROM test_generic_events_all WHERE APIKey = 42 AND SessionType = 42; | ||
SELECT OperatingSystem FROM test_generic_events_all PREWHERE APIKey = 42 WHERE SessionType = 42; | ||
SELECT * FROM test_generic_events_all PREWHERE APIKey = 42 WHERE SessionType = 42; | ||
|
||
DROP TABLE IF EXISTS test_generic_events_all; |