ClickHouse/tests/queries/0_stateless/02418_tautological_if_index.sql

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

22 lines
657 B
MySQL
Raw Normal View History

2024-03-04 11:27:12 +00:00
SET merge_tree_read_split_ranges_into_intersecting_and_non_intersecting_injection_probability = 0.0;
2022-09-10 03:32:23 +00:00
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;