[Function] add BE bitmap function bitmap_max (#6942)

Support bitmap_max.
This commit is contained in:
zhuixun
2021-10-30 18:16:38 +08:00
committed by GitHub
parent c3b133bdb3
commit a842d41b87
9 changed files with 167 additions and 0 deletions

View File

@ -597,6 +597,19 @@ BooleanVal BitmapFunctions::bitmap_has_any(FunctionContext* ctx, const StringVal
return {bitmap.cardinality() != 0};
}
BigIntVal BitmapFunctions::bitmap_max(FunctionContext* ctx, const StringVal& src) {
if (src.is_null) {
return BigIntVal::null();
}
if (src.len == 0) {
return reinterpret_cast<BitmapValue*>(src.ptr)->maximum();
} else {
auto bitmap = BitmapValue((char*)src.ptr);
return bitmap.maximum();
}
}
template void BitmapFunctions::bitmap_update_int<TinyIntVal>(FunctionContext* ctx,
const TinyIntVal& src, StringVal* dst);
template void BitmapFunctions::bitmap_update_int<SmallIntVal>(FunctionContext* ctx,