A test for combined condition node

This commit is contained in:
Alexander Gololobov 2023-02-13 22:50:22 +01:00
parent 0fe080cc6f
commit 67565aaa79
2 changed files with 18 additions and 0 deletions

View File

@ -38,3 +38,9 @@ SELECT cast(id1 as UInt16) AS cond1, (id2 % 40000) AS cond2, (cond1 AND cond2) A
SELECT cast(id1 as UInt16) AS cond1 FROM test_02559 PREWHERE cond1 LIMIT 10; -- { serverError ILLEGAL_TYPE_OF_COLUMN_FOR_FILTER }
SELECT count() FROM test_02559 PREWHERE id2>=0 AND (1 OR ignore(id1)) WHERE ignore(id1)=0;
10
CREATE ROW POLICY 02559_filter_1 ON test_02559 USING id2=2 AS permissive TO ALL;
SELECT * FROM test_02559;
2 2
CREATE ROW POLICY 02559_filter_2 ON test_02559 USING id2<=2 AS restrictive TO ALL;
SELECT * FROM test_02559;
2 2

View File

@ -4,6 +4,9 @@ CREATE TABLE test_02559 (id1 UInt64, id2 UInt64) ENGINE=MergeTree ORDER BY id1;
INSERT INTO test_02559 SELECT number, number FROM numbers(10);
DROP ROW POLICY IF EXISTS 02559_filter_1 ON test_02559;
DROP ROW POLICY IF EXISTS 02559_filter_2 ON test_02559;
SET enable_multiple_prewhere_read_steps=true, move_all_conditions_to_prewhere=true;
-- { echoOn }
@ -22,6 +25,15 @@ SELECT cast(id1 as UInt16) AS cond1 FROM test_02559 PREWHERE cond1 LIMIT 10; --
SELECT count() FROM test_02559 PREWHERE id2>=0 AND (1 OR ignore(id1)) WHERE ignore(id1)=0;
CREATE ROW POLICY 02559_filter_1 ON test_02559 USING id2=2 AS permissive TO ALL;
SELECT * FROM test_02559;
CREATE ROW POLICY 02559_filter_2 ON test_02559 USING id2<=2 AS restrictive TO ALL;
SELECT * FROM test_02559;
-- { echoOff }
DROP ROW POLICY IF EXISTS 02559_filter_1 ON test_02559;
DROP ROW POLICY IF EXISTS 02559_filter_2 ON test_02559;
DROP TABLE test_02559;