add failing tests with materialized columns #2900 [#CLICKHOUSE-3911]

This commit is contained in:
Alexey Zatelepin 2018-08-22 15:42:18 +03:00
parent 4c0b30fb7d
commit 19ec609d36
4 changed files with 19 additions and 15 deletions

View File

@ -1,13 +1,14 @@
Query should fail 1
Query should fail 2
Query involving aliases should fail on submission
2000-01-01 2 b
2000-01-01 5 e
2000-02-01 2 b
2000-02-01 5 e
2000-01-01 2 b 4
2000-01-01 5 e 7
2000-02-01 2 b 4
2000-02-01 5 e 7
mutation_1.txt DELETE WHERE x = 1 [''] [1] 0 1
mutation_5.txt DELETE WHERE (x % 2) = 1 [''] [5] 0 1
mutation_6.txt DELETE WHERE s = \'d\' [''] [6] 0 1
mutation_7.txt DELETE WHERE m = 3 [''] [7] 0 1
*** Test mutations cleaner ***
mutation_3.txt DELETE WHERE x = 2 1
mutation_4.txt DELETE WHERE x = 3 1

View File

@ -7,7 +7,7 @@ CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
${CLICKHOUSE_CLIENT} --query="DROP TABLE IF EXISTS test.mutations"
${CLICKHOUSE_CLIENT} --query="CREATE TABLE test.mutations(d Date, x UInt32, s String, a UInt32 ALIAS x + 1) ENGINE MergeTree(d, intDiv(x, 10), 8192)"
${CLICKHOUSE_CLIENT} --query="CREATE TABLE test.mutations(d Date, x UInt32, s String, a UInt32 ALIAS x + 1, m MATERIALIZED x + 2) ENGINE MergeTree(d, intDiv(x, 10), 8192)"
# Test a mutation on empty table
${CLICKHOUSE_CLIENT} --query="ALTER TABLE test.mutations DELETE WHERE x = 1"
@ -28,16 +28,17 @@ ${CLICKHOUSE_CLIENT} --query="ALTER TABLE test.mutations DELETE WHERE a = 0" 2>/
# Delete some values
${CLICKHOUSE_CLIENT} --query="ALTER TABLE test.mutations DELETE WHERE x % 2 = 1"
${CLICKHOUSE_CLIENT} --query="ALTER TABLE test.mutations DELETE WHERE s = 'd'"
${CLICKHOUSE_CLIENT} --query="ALTER TABLE test.mutations DELETE WHERE m = 3"
# Insert more data
${CLICKHOUSE_CLIENT} --query="INSERT INTO test.mutations(d, x, s) VALUES \
('2000-01-01', 5, 'e'), ('2000-02-01', 5, 'e')"
# Wait until the last mutation is done.
wait_for_mutation "mutations" "mutation_6.txt"
wait_for_mutation "mutations" "mutation_7.txt"
# Check that the table contains only the data that should not be deleted.
${CLICKHOUSE_CLIENT} --query="SELECT * FROM test.mutations ORDER BY d, x"
${CLICKHOUSE_CLIENT} --query="SELECT d, x, s, m FROM test.mutations ORDER BY d, x"
# Check the contents of the system.mutations table.
${CLICKHOUSE_CLIENT} --query="SELECT mutation_id, command, block_numbers.partition_id, block_numbers.number, parts_to_do, is_done \
FROM system.mutations WHERE table = 'mutations' ORDER BY mutation_id"

View File

@ -1,12 +1,13 @@
Query should fail 1
Query should fail 2
2000-01-01 2 b
2000-01-01 5 e
2000-02-01 2 b
2000-02-01 5 e
2000-01-01 2 b 4
2000-01-01 5 e 7
2000-02-01 2 b 4
2000-02-01 5 e 7
0000000000 DELETE WHERE x = 1 [] [] 0 1
0000000001 DELETE WHERE (x % 2) = 1 ['200001','200002'] [2,1] 0 1
0000000002 DELETE WHERE s = \'d\' ['200001','200002'] [3,2] 0 1
0000000003 DELETE WHERE m = 3 ['200001','200002'] [4,3] 0 1
*** Test mutations cleaner ***
0000000001 DELETE WHERE x = 2 1
0000000002 DELETE WHERE x = 3 1

View File

@ -8,8 +8,8 @@ CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
${CLICKHOUSE_CLIENT} --query="DROP TABLE IF EXISTS test.mutations_r1"
${CLICKHOUSE_CLIENT} --query="DROP TABLE IF EXISTS test.mutations_r2"
${CLICKHOUSE_CLIENT} --query="CREATE TABLE test.mutations_r1(d Date, x UInt32, s String) ENGINE ReplicatedMergeTree('/clickhouse/tables/test/mutations', 'r1', d, intDiv(x, 10), 8192)"
${CLICKHOUSE_CLIENT} --query="CREATE TABLE test.mutations_r2(d Date, x UInt32, s String) ENGINE ReplicatedMergeTree('/clickhouse/tables/test/mutations', 'r2', d, intDiv(x, 10), 8192)"
${CLICKHOUSE_CLIENT} --query="CREATE TABLE test.mutations_r1(d Date, x UInt32, s String, m MATERIALIZED x + 2) ENGINE ReplicatedMergeTree('/clickhouse/tables/test/mutations', 'r1', d, intDiv(x, 10), 8192)"
${CLICKHOUSE_CLIENT} --query="CREATE TABLE test.mutations_r2(d Date, x UInt32, s String, m MATERIALIZED x + 2) ENGINE ReplicatedMergeTree('/clickhouse/tables/test/mutations', 'r2', d, intDiv(x, 10), 8192)"
# Test a mutation on empty table
${CLICKHOUSE_CLIENT} --query="ALTER TABLE test.mutations_r1 DELETE WHERE x = 1"
@ -28,16 +28,17 @@ ${CLICKHOUSE_CLIENT} --query="ALTER TABLE test.mutations_r1 DELETE WHERE d = '11
# Delete some values
${CLICKHOUSE_CLIENT} --query="ALTER TABLE test.mutations_r1 DELETE WHERE x % 2 = 1"
${CLICKHOUSE_CLIENT} --query="ALTER TABLE test.mutations_r1 DELETE WHERE s = 'd'"
${CLICKHOUSE_CLIENT} --query="ALTER TABLE test.mutations_r1 DELETE WHERE m = 3"
# Insert more data
${CLICKHOUSE_CLIENT} --query="INSERT INTO test.mutations_r1(d, x, s) VALUES \
('2000-01-01', 5, 'e'), ('2000-02-01', 5, 'e')"
# Wait until the last mutation is done.
wait_for_mutation "mutations_r2" "0000000002"
wait_for_mutation "mutations_r2" "0000000003"
# Check that the table contains only the data that should not be deleted.
${CLICKHOUSE_CLIENT} --query="SELECT * FROM test.mutations_r2 ORDER BY d, x"
${CLICKHOUSE_CLIENT} --query="SELECT d, x, s, m FROM test.mutations_r2 ORDER BY d, x"
# Check the contents of the system.mutations table.
${CLICKHOUSE_CLIENT} --query="SELECT mutation_id, command, block_numbers.partition_id, block_numbers.number, parts_to_do, is_done \
FROM system.mutations WHERE table = 'mutations_r2' ORDER BY mutation_id"