跳到主要内容
版本: 最新版本-3.5

bitmap_hash

计算任何类型输入的 32 位哈希值,并返回包含哈希值的 Bitmap。它主要用于 Stream Load 任务,将非整数字段导入到 StarRocks 表的 Bitmap 字段中。例如

cat data | curl --location-trusted -u user:passwd -T - \
-H "columns: dt,page,device_id, device_id=bitmap_hash(device_id)" \
http://host:8410/api/test/testDb/_stream_load

语法

BITMAP BITMAP_HASH(expr)

示例

MySQL > select bitmap_count(bitmap_hash('hello'));
+------------------------------------+
| bitmap_count(bitmap_hash('hello')) |
+------------------------------------+
| 1 |
+------------------------------------+

select bitmap_to_string(bitmap_hash('hello'));
+----------------------------------------+
| bitmap_to_string(bitmap_hash('hello')) |
+----------------------------------------+
| 1321743225 |
+----------------------------------------+

关键词

BITMAP_HASH,BITMAP