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 2021/11/01 03:03:31 UTC

[GitHub] [incubator-doris] qidaye commented on a change in pull request #6917: [Function] add BE bitmap function bitmap_subset_in_range

qidaye commented on a change in pull request #6917:
URL: https://github.com/apache/incubator-doris/pull/6917#discussion_r739930721



##########
File path: be/src/util/bitmap_value.h
##########
@@ -1451,6 +1451,26 @@ class BitmapValue {
         }
     }
 
+    /**
+     * Return new set with specified range (not include the range_end)
+     */
+    int64_t sub_range(const int64_t& range_start, const int64_t& range_end, BitmapValue* ret_bitmap) {
+        int64_t count = 0; 
+        for (auto it = _bitmap.begin(); it != _bitmap.end(); ++it) {
+            if (*it < range_start) {
+                continue;
+            }
+            if (*it < range_end) {
+                ret_bitmap->add(*it);
+                ++count;
+            } else {
+                break;
+            }
+        }
+        return count;

Review comment:
       When there is a error, it returns `null`. The case `range_start` greater than `bitmap_max` is a normal case, I think it's ok to return an empty result.




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

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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