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/14 03:52:20 UTC

[GitHub] [incubator-doris] DanyBin opened a new pull request #2752: Add be bitmap udf

DanyBin opened a new pull request #2752: Add be bitmap udf 
URL: https://github.com/apache/incubator-doris/pull/2752
 
 
   1. add bitmap_contains udf   https://github.com/apache/incubator-doris/issues/2540
   2. add bitmap_has_any udf   https://github.com/apache/incubator-doris/issues/2541

----------------------------------------------------------------
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


[GitHub] [incubator-doris] DanyBin commented on a change in pull request #2752: Add be bitmap udf

Posted by GitBox <gi...@apache.org>.
DanyBin commented on a change in pull request #2752: Add be bitmap udf 
URL: https://github.com/apache/incubator-doris/pull/2752#discussion_r366676104
 
 

 ##########
 File path: be/src/exprs/bitmap_function.cpp
 ##########
 @@ -465,6 +465,44 @@ StringVal BitmapFunctions::bitmap_from_string(FunctionContext* ctx, const String
     return result;
 }
 
+BooleanVal BitmapFunctions::bitmap_contains(FunctionContext* ctx, const StringVal& src, const BigIntVal& input) {
+    if (src.is_null || input.is_null) {
+        return BooleanVal::null();
+    }
+
+    RoaringBitmap bitmap;
+    if (src.len == 0) {
+        bitmap.merge(*reinterpret_cast<RoaringBitmap*>(src.ptr));
 
 Review comment:
   ok 

----------------------------------------------------------------
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


[GitHub] [incubator-doris] imay commented on a change in pull request #2752: Add be bitmap udf

Posted by GitBox <gi...@apache.org>.
imay commented on a change in pull request #2752: Add be bitmap udf 
URL: https://github.com/apache/incubator-doris/pull/2752#discussion_r366152801
 
 

 ##########
 File path: be/src/exprs/bitmap_function.cpp
 ##########
 @@ -465,6 +465,43 @@ StringVal BitmapFunctions::bitmap_from_string(FunctionContext* ctx, const String
     return result;
 }
 
+BooleanVal BitmapFunctions::bitmap_contains(FunctionContext *ctx, const StringVal &src, const IntVal &input) {
+    if (src.is_null || input.is_null) {
+        return BooleanVal::null();
+    }
+
+    if (src.len == 0) {
 
 Review comment:
   when src.len == 0, src.ptr points to a bitmap object. we should handle that case

----------------------------------------------------------------
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


[GitHub] [incubator-doris] imay commented on a change in pull request #2752: Add be bitmap udf

Posted by GitBox <gi...@apache.org>.
imay commented on a change in pull request #2752: Add be bitmap udf 
URL: https://github.com/apache/incubator-doris/pull/2752#discussion_r366152501
 
 

 ##########
 File path: be/src/exprs/bitmap_function.cpp
 ##########
 @@ -465,6 +465,43 @@ StringVal BitmapFunctions::bitmap_from_string(FunctionContext* ctx, const String
     return result;
 }
 
+BooleanVal BitmapFunctions::bitmap_contains(FunctionContext *ctx, const StringVal &src, const IntVal &input) {
 
 Review comment:
   ```suggestion
   BooleanVal BitmapFunctions::bitmap_contains(FunctionContext* ctx, const StringVal& src, const IntVal& input) {
   ```

----------------------------------------------------------------
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


[GitHub] [incubator-doris] imay commented on a change in pull request #2752: Add be bitmap udf

Posted by GitBox <gi...@apache.org>.
imay commented on a change in pull request #2752: Add be bitmap udf 
URL: https://github.com/apache/incubator-doris/pull/2752#discussion_r366153397
 
 

 ##########
 File path: be/src/exprs/bitmap_function.cpp
 ##########
 @@ -465,6 +465,43 @@ StringVal BitmapFunctions::bitmap_from_string(FunctionContext* ctx, const String
     return result;
 }
 
+BooleanVal BitmapFunctions::bitmap_contains(FunctionContext *ctx, const StringVal &src, const IntVal &input) {
 
 Review comment:
   Because we don't have unsigned int, but the bit value can exceede the max int. Better use BigIntValue as bit index

----------------------------------------------------------------
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


[GitHub] [incubator-doris] imay commented on a change in pull request #2752: Add be bitmap udf

Posted by GitBox <gi...@apache.org>.
imay commented on a change in pull request #2752: Add be bitmap udf 
URL: https://github.com/apache/incubator-doris/pull/2752#discussion_r366153129
 
 

 ##########
 File path: be/src/exprs/bitmap_function.cpp
 ##########
 @@ -465,6 +465,43 @@ StringVal BitmapFunctions::bitmap_from_string(FunctionContext* ctx, const String
     return result;
 }
 
+BooleanVal BitmapFunctions::bitmap_contains(FunctionContext *ctx, const StringVal &src, const IntVal &input) {
+    if (src.is_null || input.is_null) {
+        return BooleanVal::null();
+    }
+
+    if (src.len == 0) {
+        return BooleanVal(false);
+    }
+
+    RoaringBitmap bitmap;
+    bitmap.update(input.val);
+    bitmap.intersect(RoaringBitmap((char*)src.ptr));
 
 Review comment:
   RoaringBitmap has already had contains method, you can use it directly

----------------------------------------------------------------
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


[GitHub] [incubator-doris] kangkaisen commented on a change in pull request #2752: Add be bitmap udf

Posted by GitBox <gi...@apache.org>.
kangkaisen commented on a change in pull request #2752: Add be bitmap udf 
URL: https://github.com/apache/incubator-doris/pull/2752#discussion_r366153278
 
 

 ##########
 File path: be/src/exprs/bitmap_function.cpp
 ##########
 @@ -465,6 +465,43 @@ StringVal BitmapFunctions::bitmap_from_string(FunctionContext* ctx, const String
     return result;
 }
 
+BooleanVal BitmapFunctions::bitmap_contains(FunctionContext *ctx, const StringVal &src, const IntVal &input) {
+    if (src.is_null || input.is_null) {
+        return BooleanVal::null();
+    }
+
+    if (src.len == 0) {
 
 Review comment:
   zero size means the src input is a agg object

----------------------------------------------------------------
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


[GitHub] [incubator-doris] imay merged pull request #2752: Add be bitmap udf

Posted by GitBox <gi...@apache.org>.
imay merged pull request #2752: Add be bitmap udf 
URL: https://github.com/apache/incubator-doris/pull/2752
 
 
   

----------------------------------------------------------------
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


[GitHub] [incubator-doris] kangkaisen commented on a change in pull request #2752: Add be bitmap udf

Posted by GitBox <gi...@apache.org>.
kangkaisen commented on a change in pull request #2752: Add be bitmap udf 
URL: https://github.com/apache/incubator-doris/pull/2752#discussion_r366153338
 
 

 ##########
 File path: be/src/exprs/bitmap_function.cpp
 ##########
 @@ -465,6 +465,43 @@ StringVal BitmapFunctions::bitmap_from_string(FunctionContext* ctx, const String
     return result;
 }
 
+BooleanVal BitmapFunctions::bitmap_contains(FunctionContext *ctx, const StringVal &src, const IntVal &input) {
+    if (src.is_null || input.is_null) {
+        return BooleanVal::null();
+    }
+
+    if (src.len == 0) {
+        return BooleanVal(false);
+    }
+
+    RoaringBitmap bitmap;
+    bitmap.update(input.val);
+    bitmap.intersect(RoaringBitmap((char*)src.ptr));
+
+    if (bitmap.cardinality() == 1) {
+        return BooleanVal(true);
+    }
+    return BooleanVal(false);
+}
+
+BooleanVal BitmapFunctions::bitmap_has_any(FunctionContext *ctx, const StringVal &lhs, const StringVal &rhs) {
+    if (lhs.is_null || rhs.is_null) {
+        return BooleanVal::null();
+    }
+
+    if (lhs.len == 0 || rhs.len == 0) {
 
 Review comment:
   zero size means the src input is a object pointer

----------------------------------------------------------------
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


[GitHub] [incubator-doris] imay commented on a change in pull request #2752: Add be bitmap udf

Posted by GitBox <gi...@apache.org>.
imay commented on a change in pull request #2752: Add be bitmap udf 
URL: https://github.com/apache/incubator-doris/pull/2752#discussion_r366652566
 
 

 ##########
 File path: be/src/exprs/bitmap_function.cpp
 ##########
 @@ -465,6 +465,44 @@ StringVal BitmapFunctions::bitmap_from_string(FunctionContext* ctx, const String
     return result;
 }
 
+BooleanVal BitmapFunctions::bitmap_contains(FunctionContext* ctx, const StringVal& src, const BigIntVal& input) {
+    if (src.is_null || input.is_null) {
+        return BooleanVal::null();
+    }
+
+    RoaringBitmap bitmap;
+    if (src.len == 0) {
+        bitmap.merge(*reinterpret_cast<RoaringBitmap*>(src.ptr));
 
 Review comment:
   This operation is wasteful.
   It is efficient to operate with src.ptr.

----------------------------------------------------------------
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


[GitHub] [incubator-doris] kangkaisen commented on a change in pull request #2752: Add be bitmap udf

Posted by GitBox <gi...@apache.org>.
kangkaisen commented on a change in pull request #2752: Add be bitmap udf 
URL: https://github.com/apache/incubator-doris/pull/2752#discussion_r366153278
 
 

 ##########
 File path: be/src/exprs/bitmap_function.cpp
 ##########
 @@ -465,6 +465,43 @@ StringVal BitmapFunctions::bitmap_from_string(FunctionContext* ctx, const String
     return result;
 }
 
+BooleanVal BitmapFunctions::bitmap_contains(FunctionContext *ctx, const StringVal &src, const IntVal &input) {
+    if (src.is_null || input.is_null) {
+        return BooleanVal::null();
+    }
+
+    if (src.len == 0) {
 
 Review comment:
   zero size means the src input is a object pointer

----------------------------------------------------------------
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