You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Here we check that projection rebuild does not create too many temporary parts.
23
+
# The size of temporary projection part is limited by min_insert_block_size_bytes/min_insert_block_size_rows, so they are changed in the config.
24
+
22
25
node1.query("drop table if exists tab")
23
26
node1.query("create table tab (x UInt64, y UInt64, data String codec(NONE), v UInt8, projection p (select _part_offset order by y)) engine = ReplacingMergeTree(v) order by x settings allow_part_offset_column_in_projections=1, deduplicate_merge_projection_mode='rebuild';")
24
-
node1.query("insert into tab select number, number, rightPad('', 100, 'a'), 0 from numbers(30000);")
27
+
# Here we expect 3 parts to be inserted, contrilled by max_block_size=min_insert_block_size_rows=10000
28
+
node1.query("insert into tab select number, number, rightPad('', 100, 'a'), 0 from numbers(30000) settings max_block_size=10000;")
29
+
# Here we merge parts, and projections should be rebuild
30
+
# Initially we kept `data` column in projection squash, ~10 temporary parts were created by min_insert_block_size_bytes limit
25
31
node1.query("optimize table tab final settings mutations_sync=2, alter_sync=2;")
26
32
node1.query("system flush logs;")
27
33
28
34
uuid=node1.query("select uuid from system.tables where table = 'tab';").strip()
29
35
cnt=node1.query("select count() from system.text_log where query_id like '{}::all_%_2' and message like '%Reading%from part p_%from the beginning of the part%'".format(uuid))
30
-
assert (cnt=='2\n')
31
-
36
+
# One projection part per source part
37
+
assert (cnt=='3\n')
38
+
# Here we check that _parent_part_offset is calculated properly. It was fixed in https://github.com/ClickHouse/ClickHouse/pull/93827
39
+
assert(node1.query("select min(_parent_part_offset), max(_parent_part_offset) from mergeTreeProjection(default, tab, 'p')") =='0\t29999\n')
INSERT INTO test SELECTnumber*3, rand() FROM numbers(100000);
21
+
INSERT INTO test SELECTnumber*3+1, rand() FROM numbers(100000);
22
+
SELECTsum(l._part_offset=r._parent_part_offset) FROM test l JOIN mergeTreeProjection(currentDatabase(), test, p) r USING (a) SETTINGS enable_analyzer =1;
23
+
24
+
OPTIMIZE TABLE test FINAL;
25
+
26
+
SELECTsum(l._part_offset=r._parent_part_offset) FROM test l JOIN mergeTreeProjection(currentDatabase(), test, p) r USING (a) SETTINGS enable_analyzer =1;
0 commit comments