Skip to content

Instantly share code, notes, and snippets.

@den-crane
Created February 1, 2025 16:06
Show Gist options
  • Save den-crane/193974d76e136652514777fe44b49ab4 to your computer and use it in GitHub Desktop.
Save den-crane/193974d76e136652514777fe44b49ab4 to your computer and use it in GitHub Desktop.
https://fiddle.clickhouse.com/afd6bac1-a4c1-4d51-bed8-2043012861c1
insert into function file(currentDatabase()||'_parallelize_output_from_storages_dedup_test.tsv', 'TSV')
select number, toString(arrayMap(x->cityHash64(x), range(number%11)))
from numbers(10000) order by cityHash64(number);
set min_insert_block_size_bytes=1000000,
min_chunk_bytes_for_parallel_parsing = 10000;
set parallelize_output_from_storages = 0;
create table t (a Int64, b String) Engine=MergeTree order by tuple();
create table t1 as t Engine=MergeTree order by tuple();
system stop merges;
insert into t select * from file(currentDatabase()||'_parallelize_output_from_storages_dedup_test.tsv');
insert into t1 select * from file(currentDatabase()||'_parallelize_output_from_storages_dedup_test.tsv');
select count()
from
(select name,
rows r,
hash_of_uncompressed_files h,
hash_of_all_files ha,
uncompressed_hash_of_compressed_files uhc
from system.parts
where table like 't' and database = currentDatabase()) t
join
(select name,
rows r1,
hash_of_uncompressed_files h1,
hash_of_all_files ha1,
uncompressed_hash_of_compressed_files uhc1
from system.parts
where table like 't1' and database = currentDatabase()) t1
using name
where h1 <> h or r1 <> r or ha1 <> ha or uhc1 <> uhc
format PrettyCompactMonoBlock;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment