mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 15:12:02 +00:00
Merge pull request #41175 from ClickHouse/tautological_if_index
Add a test for #4242
This commit is contained in:
commit
3da8d2e9d4
@ -0,0 +1,2 @@
|
||||
1
|
||||
1
|
19
tests/queries/0_stateless/02418_tautological_if_index.sql
Normal file
19
tests/queries/0_stateless/02418_tautological_if_index.sql
Normal file
@ -0,0 +1,19 @@
|
||||
DROP TABLE IF EXISTS constCondOptimization;
|
||||
|
||||
CREATE TABLE constCondOptimization
|
||||
(
|
||||
d Date DEFAULT today(),
|
||||
time DateTime DEFAULT now(),
|
||||
n Int64
|
||||
)
|
||||
ENGINE = MergeTree ORDER BY (time, n) SETTINGS index_granularity = 1;
|
||||
|
||||
INSERT INTO constCondOptimization (n) SELECT number FROM system.numbers LIMIT 10000;
|
||||
|
||||
-- The queries should use index.
|
||||
SET max_rows_to_read = 2;
|
||||
|
||||
SELECT count() FROM constCondOptimization WHERE if(0, 1, n = 1000);
|
||||
SELECT count() FROM constCondOptimization WHERE if(0, 1, n = 1000) AND 1 = 1;
|
||||
|
||||
DROP TABLE constCondOptimization;
|
Loading…
Reference in New Issue
Block a user