You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by GitBox <gi...@apache.org> on 2020/01/06 13:29:46 UTC

[GitHub] [incubator-doris] imay commented on a change in pull request #2674: ADD BE UDF bitmap_and and bitmap_or

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_r363291818
 
 

 ##########
 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){
 
 Review comment:
   ```suggestion
       if (!src.is_null) {
   ```

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org