imay commented on a change in pull request #2674: ADD BE UDF bitmap_and and
bitmap_or
URL: https://github.com/apache/incubator-doris/pull/2674#discussion_r363292511
##########
File path: be/src/exprs/bitmap_function.cpp
##########
@@ -388,6 +388,51 @@ BigIntVal
BitmapFunctions::bitmap_intersect_finalize(FunctionContext* ctx, const
return result;
}
+StringVal BitmapFunctions::bitmap_or(FunctionContext* ctx, const StringVal&
src, const StringVal& dst){
+ RoaringBitmap bitmap;
+ if(!src.is_null){
+ if(src.len == 0 ){
+ bitmap.merge(*reinterpret_cast<RoaringBitmap*>(src.ptr));
+ } else{
+ bitmap.merge(RoaringBitmap ((char*)src.ptr));
+ }
+ }
+
+ if(!dst.is_null){
+ if(dst.len == 0){
+ bitmap.merge(*reinterpret_cast<RoaringBitmap*>(dst.ptr));
+ } else{
+ bitmap.merge(RoaringBitmap ((char*)dst.ptr));
+ }
+ }
+
+ StringVal result(ctx,bitmap.size());
+ bitmap.serialize((char*)result.ptr);
+ return result;
+}
+StringVal BitmapFunctions::bitmap_and(FunctionContext* ctx, const StringVal&
src, const StringVal& dst){
+ RoaringBitmap bitmap;
+ if(!src.is_null){
+ if(src.len == 0 ){
Review comment:
```suggestion
if (src.len == 0) {
```
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]