Uh oh!
There was an error while loading. Please reload this page.
Support bitmap_intersect - #3571
Conversation
Support aggregate function Bitmap Intersect, it is mainly used to take intersection of grouped data.
The function 'bitmap_intersect(expr)' calculates the intersection of bitmap columns and returns a bitmap object.
The defination is following:
FunctionName: bitmap_intersect,
InputType: bitmap,
OutputType: bitmap
The scenario is as follows:
Query which users satisfy the three tags a, b, and c at the same time.
```
select bitmap_to_string(bitmap_intersect(user_id)) from
(
select bitmap_union(user_id) user_id from bitmap_intersect_test
where tag in ('a', 'b', 'c')
group by tag
) a
```
Closedapache#3552.
Change-Id: I0d50c9bb6827f7319c4d854f621412343a3ece24EmmyMiao87
commented
May 12, 2020
I will add sql-reference later. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Co-authored-by: Mingyu Chen <morningman.cmy@gmail.com>
Uh oh!
There was an error while loading. Please reload this page.
Change-Id: I4a815eaa5aac07ab75bb07e13f518da59cbef952
…bator-doris into bitmap_intersect Change-Id: I2f5bee7dd9a14f687881af8038dbbff17b6b6590
Change-Id: Ibb9bdb236d4d850e3d732bb55c441b7f8b80abba
Change-Id: I8bd03f5344eafc89a7d617d10399c848006bf590
| return; | ||
| } | ||
| // if dst is null, the src input is the first value | ||
| if (dst->is_null) { |
There was a problem hiding this comment.
Would better add a UNLIKELY macros.
Uh oh!
There was an error while loading. Please reload this page.
| // this is the read init function for bitmap_intersect | ||
| void BitmapFunctions::bitmap_intersect_init_real(FunctionContext* ctx, StringVal* dst) { | ||
| dst->is_null = true; |
There was a problem hiding this comment.
why initial result bitmap as null? it seems that it will return empty bitmap when result bitmap is null
There was a problem hiding this comment.
The initial result bitmap must be null. Otherwise, the intersection between dst and src will be empty.
kangkaisen
commented
May 20, 2020
@EmmyMiao87 Hi. 按照SQL标准,sum(null), min(null), max(null)结果为 null. count(null)为0. 所以 对于 bitmap_intersect,bitmap_union 返回bitmap的函数,输入全是null时,应该返回null, 在之前最开始的时候,我认为所有hll,bitmap的函数都不需要返回null,对于输入是null,我们返回empty bitmap 或者empty hll 即可。(it's my fault...) 所以目前bitmap_init, bitmap_serialize, bitmap_finalize的实现都是not nullable的。 |
Uh oh!
There was an error while loading. Please reload this page.
Change-Id: I2d86d48dd5f5e836696b3d44620de41943052ee6
Change-Id: Ic21f0d500f464cee5d51e54858a18c89d080631b
kangpinghuang
commented
May 20, 2020
LGTM, +1 |
…fig disable auto start (apache#3571)
Support aggregate function Bitmap Intersect, it is mainly used to take intersection of grouped data.
The function 'bitmap_intersect(expr)' calculates the intersection of bitmap columns and returns a bitmap object.
The defination is following:
FunctionName: bitmap_intersect,
InputType: bitmap,
OutputType: bitmap
The scenario is as follows:
Query which users satisfy the three tags a, b, and c at the same time.
Closed#3552.
Change-Id: I0d50c9bb6827f7319c4d854f621412343a3ece24