Files
doris/docs/en/sql-manual/sql-functions/bitmap-functions/sub_bitmap.md
jiafeng.zhang 267e8b67c2 [refactor][doc]The new version of the document is online (#9272)
replace the `docs/` with `new-docs/`
2022-04-28 15:22:34 +08:00

1.5 KiB

title, language
title language
sub_bitmap en

sub_bitmap

description

Syntax

BITMAP SUB_BITMAP(BITMAP src, BIGINT offset, BIGINT cardinality_limit)

Starting from the position specified by offset, intercept cardinality_limit bitmap elements and return a bitmap subset.

example

mysql> select bitmap_to_string(sub_bitmap(bitmap_from_string('1,0,1,2,3,1,5'), 0, 3)) value;
+-------+
| value |
+-------+
| 0,1,2 |
+-------+

mysql> select bitmap_to_string(sub_bitmap(bitmap_from_string('1,0,1,2,3,1,5'), -3, 2)) value;
+-------+
| value |
+-------+
| 2,3   |
+-------+

mysql> select bitmap_to_string(sub_bitmap(bitmap_from_string('1,0,1,2,3,1,5'), 2, 100)) value;
+-------+
| value |
+-------+
| 2,3,5 |
+-------+

keyword

SUB_BITMAP,BITMAP_SUBSET,BITMAP