数据仓库服务 GAUSSDB(DWS)-Roaring Bitmap函数:rb_build(array)

时间:2024-01-26 16:15:24

rb_build(array)

描述:将int数组转成roaringbitmap类型。

返回值类型:roaringbitmap

示例:

1
2
3
4
5
SELECT rb_build('{1,2,3}');
rb_build
------------------------------------------------
\x3a300000010000000000020010000000010002000300
(1 row)
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
CREATE TABLE r_row (a int, b text, c roaringbitmap);
NOTICE:  The 'DISTRIBUTE BY' clause is not specified. Using round-robin as the distribution mode by default.
HINT:  Please use 'DISTRIBUTE BY' clause to specify suitable data distribution column.
CREATE TABLE

INSERT INTO r_row values (1, 'a', rb_build('{1,2,3}'));
INSERT 0 1

SELECT * FROM r_row;
 a | b |                       c
---+---+------------------------------------------------
 1 | a | \x3a300000010000000000020010000000010002000300
(1 row)

INSERT INTO r_row values (2, 'b', rb_build('{}'));
INSERT 0 1

SELECT * FROM r_row;
 a | b |                       c
---+---+------------------------------------------------
 2 | b | \x3a30000000000000
 1 | a | \x3a300000010000000000020010000000010002000300
(2 rows)
support.huaweicloud.com/sqlreference-820-dws/dws_06_0323.html