以下sql中 select bitmapBuild([1,2,3,4]) 代表不同的表查询得到的bitmap结果
单节点查询正常
with
(select bitmapBuild([1,2,3,4]) ) as u1,
(select bitmapBuild([1,2,3,4]) ) as u2,
(select bitmapBuild([1,2,3,4]) ) as u3,
(select bitmapBuild([1,2,3,4]) ) as u4,
(select bitmapBuild([1,2,3,4]) ) as u5,
(select bitmapAnd(bitmapAnd(bitmapAnd(bitmapAnd(u1,u2),u3),u4),u5) ) as u
select bitmapCardinality(u)
放在集群里面
select sum(b) from cluster('ck_rep2',
view(
with
(select bitmapBuild([1,2,3,4]) ) as u1,
(select bitmapBuild([1,2,3,4]) ) as u2,
(select bitmapBuild([1,2,3,4]) ) as u3,
(select bitmapBuild([1,2,3,4]) ) as u4,
(select bitmapBuild([1,2,3,4]) ) as u5,
(select bitmapAnd(bitmapAnd(bitmapAnd(bitmapAnd(u1,u2),u3),u4),u5) ) as u
select bitmapCardinality(u) as b
)
)
;
报错
Code: 241, e.displayText() = DB::Exception: Memory limit (for query) exceeded: would use 9.34 GiB (attempt to allocate chunk of 4194320 bytes)
减少一个表查询
select sum(b)
from cluster('ck_rep2',
view(
with
(select bitmapBuild([1,2,3,4]) ) as u1,
(select bitmapBuild([1,2,3,4]) ) as u2,
(select bitmapBuild([1,2,3,4]) ) as u3,
(select bitmapBuild([1,2,3,4]) ) as u4,
(select bitmapAnd(bitmapAnd(bitmapAnd(u1,u2),u3),u4) ) as u
select bitmapCardinality(u) as b
)
)
;
Code: 168, e.displayText() = DB::Exception: AST is too big. Maximum: 500000: (after expansion of aliases) (version 21.8.10.19 (official build))
再减少一个表查询
select sum(b)
from cluster('ck_rep2',
view(
with
(select bitmapBuild([1,2,3,4]) ) as u1,
(select bitmapBuild([1,2,3,4]) ) as u2,
(select bitmapBuild([1,2,3,4]) ) as u3,
(select bitmapAnd(bitmapAnd(u1,u2),u3) ) as u
select bitmapCardinality(u) as b
)
)
;
Code: 241, e.displayText() = DB::Exception: Memory limit (for query) exceeded: would use 9.32 GiB (attempt to allocate chunk of 4194512 bytes), maximum: 9.31 GiB (version 21.8.10.19 (official build))
继续减少
select sum(b)
from cluster('ck_rep2',
view(
with
(select bitmapBuild([1,2,3,4]) ) as u1,
(select bitmapBuild([1,2,3,4]) ) as u2,
(select bitmapAnd(u1,u2) ) as u
select bitmapCardinality(u) as b
)
);
可以得到结果
我能理解这个clickhouse的一个bug吗,有哪位能解答一下为什么