[fix](bitmap_intersect) fix bitmap_intersect result error (#13298)
This commit is contained in:
@ -104,7 +104,8 @@ void BitmapFunctions::bitmap_intersect(FunctionContext* ctx, const StringVal& sr
|
||||
if (UNLIKELY(dst->ptr == nullptr)) {
|
||||
dst->is_null = false;
|
||||
dst->len = sizeof(BitmapValue);
|
||||
dst->ptr = (uint8_t*)new BitmapValue((char*)src.ptr);
|
||||
dst->ptr = (uint8_t*)new BitmapValue();
|
||||
BitmapFunctions::bitmap_union(ctx, src, dst);
|
||||
return;
|
||||
}
|
||||
auto dst_bitmap = reinterpret_cast<BitmapValue*>(dst->ptr);
|
||||
|
||||
@ -11,6 +11,16 @@ xian 100.0
|
||||
beijing 100.0
|
||||
xian 100.0
|
||||
|
||||
-- !bitmap_intersect --
|
||||
20220201 10001
|
||||
20220202 10001
|
||||
20220203 10000,10001
|
||||
|
||||
-- !bitmap_intersect --
|
||||
20220201 10001
|
||||
20220202 10001
|
||||
20220203 10000,10001
|
||||
|
||||
-- !select4 --
|
||||
3
|
||||
|
||||
|
||||
@ -103,6 +103,12 @@ suite("test_aggregate_all_functions") {
|
||||
sql "insert into ${tableName_03} select dt,page,to_bitmap(user_id_int) user_id from ${tableName_04}"
|
||||
sql "insert into ${tableName_03} select dt,page,bitmap_hash(user_id_str) user_id from ${tableName_04}"
|
||||
|
||||
sql "set enable_vectorized_engine = false"
|
||||
qt_bitmap_intersect "select dt, bitmap_to_string(bitmap_intersect(user_id_bitmap)) from ${tableName_04} group by dt order by dt"
|
||||
|
||||
sql "set enable_vectorized_engine = true"
|
||||
qt_bitmap_intersect "select dt, bitmap_to_string(bitmap_intersect(user_id_bitmap)) from ${tableName_04} group by dt order by dt"
|
||||
|
||||
qt_select4 "select bitmap_union_count(user_id) from ${tableName_03}"
|
||||
qt_select5 "select bitmap_count(bitmap_union(user_id)) FROM ${tableName_03}"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user