我想截取bitmap,发现文档中有这个函数。 我想截取bitmap中比给定数字大的元素。 但是不知道这么获取offset。
BITMAP sub_bitmap(BITMAP src, BIGINT offset, BIGINT len)
我想截取bitmap,发现文档中有这个函数。 我想截取bitmap中比给定数字大的元素。 但是不知道这么获取offset。
BITMAP sub_bitmap(BITMAP src, BIGINT offset, BIGINT len)
https://docs.starrocks.io/zh-cn/latest/sql-reference/sql-functions/bitmap-functions/sub_bitmap 可以参考这部分的实例
我想要的是类似clickhouse中 bitmapSubsetLimit 的功能。 通过给定数值进行截取。 而不是通过offset截取。
类似doris中 bitmap_subset_limit 的功能
用了一个及其恶心的办法。 先把bitmap转成数组。 然后再用array_position定位offset。再从数组中获取。
select arr[array_position(arr,2) + 1] from
(select bitmap_to_array(bitmap_or(bitmap_from_string('1,4,5,7,9'), to_bitmap(2))) as arr) as _t1 ;