drop table if EXISTS test_bm2; drop table if EXISTS test_bm_join2; create table test_bm2( dim UInt64, id UInt64) ENGINE = MergeTree() ORDER BY( dim ) SETTINGS index_granularity = 8192; create table test_bm_join2( dim UInt64, ids AggregateFunction(groupBitmap, UInt64) ) ENGINE = MergeTree() ORDER BY(dim) SETTINGS index_granularity = 8192; insert into test_bm2 SELECT 1,number FROM numbers(0, 1000) insert into test_bm_join2 SELECT 1, bitmapBuild(range(toUInt64(0),toUInt64(11000000))) select a.dim,bitmapCardinality(b.ids) from test_bm2 a left join test_bm_join2 b using(dim) drop table if exists test_bm2 drop table if exists test_bm_join2