메인 콘텐츠로 건너뛰기

groupBitmapOr

도입 버전: v20.1.0 비트맵 컬럼에 대해 OR 연산을 수행하고 카디널리티를 반환합니다. 접미사 combinator -State를 추가하면 비트맵 객체를 반환합니다. 이는 groupBitmapMerge(groupBitmap-Merge combinator 접미사를 적용한 것)와 동일합니다. 구문
groupBitmapOr(expr)
groupBitmapOrState(expr)
인수 반환 값 UInt64 타입의 개수를 반환하거나, -State를 사용하는 경우 비트맵 객체를 반환합니다. UInt64 예시 사용 예시
Query
CREATE TABLE bitmap_column_expr_test2
(
    tag_id String,
    z AggregateFunction(groupBitmap, UInt32)
)
ENGINE = MergeTree
ORDER BY tag_id;

INSERT INTO bitmap_column_expr_test2 VALUES ('tag1', bitmapBuild(cast([1,2,3,4,5,6,7,8,9,10] AS Array(UInt32))));
INSERT INTO bitmap_column_expr_test2 VALUES ('tag2', bitmapBuild(cast([6,7,8,9,10,11,12,13,14,15] AS Array(UInt32))));
INSERT INTO bitmap_column_expr_test2 VALUES ('tag3', bitmapBuild(cast([2,4,6,8,10,12] AS Array(UInt32))));

SELECT groupBitmapOr(z) FROM bitmap_column_expr_test2 WHERE like(tag_id, 'tag%');
Response
┌─groupBitmapOr(z)─┐
│             15   │
└──────────────────┘
-State combinator 사용하기
Query
SELECT arraySort(bitmapToArray(groupBitmapOrState(z))) FROM bitmap_column_expr_test2 WHERE like(tag_id, 'tag%');
Response
┌─arraySort(bitmapToArray(groupBitmapOrState(z)))─┐
│ [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]           │
└─────────────────────────────────────────────────┘
마지막 수정일 2026년 6월 10일