Test with default value used in row level policy

This commit is contained in:
Alexander Gololobov 2022-11-18 17:33:51 +01:00
parent 451fb07115
commit 4af8ef381b
2 changed files with 41 additions and 0 deletions

View File

@ -0,0 +1,16 @@
-- { echoOn }
SELECT a, c FROM test_rlp WHERE c%2 == 0 AND b < 5;
0 10
2 12
4 14
DROP POLICY IF EXISTS test_rlp_policy ON test_rlp;
CREATE ROW POLICY test_rlp_policy ON test_rlp FOR SELECT USING c%2 == 0 TO default;
SELECT a, c FROM test_rlp WHERE b < 5 SETTINGS optimize_move_to_prewhere = 0;
0 10
2 12
4 14
SELECT a, c FROM test_rlp PREWHERE b < 5;
0 10
2 12
4 14

View File

@ -0,0 +1,25 @@
DROP TABLE IF EXISTS test_rlp;
CREATE TABLE test_rlp (a Int32, b Int32) ENGINE=MergeTree() ORDER BY a SETTINGS index_granularity=5;
INSERT INTO test_rlp SELECT number, number FROM numbers(15);
ALTER TABLE test_rlp ADD COLUMN c Int32 DEFAULT b+10;
-- { echoOn }
SELECT a, c FROM test_rlp WHERE c%2 == 0 AND b < 5;
DROP POLICY IF EXISTS test_rlp_policy ON test_rlp;
CREATE ROW POLICY test_rlp_policy ON test_rlp FOR SELECT USING c%2 == 0 TO default;
SELECT a, c FROM test_rlp WHERE b < 5 SETTINGS optimize_move_to_prewhere = 0;
SELECT a, c FROM test_rlp PREWHERE b < 5;
-- { echoOff }
DROP POLICY test_rlp_policy ON test_rlp;
DROP TABLE test_rlp;