kangkaisen commented on a change in pull request #2319: Add Bitmap index reader
URL: https://github.com/apache/incubator-doris/pull/2319#discussion_r353144651
 
 

 ##########
 File path: be/src/olap/comparison_predicate.cpp
 ##########
 @@ -138,6 +140,90 @@ COMPARISON_PRED_COLUMN_BLOCK_EVALUATE(LessEqualPredicate, 
<=)
 COMPARISON_PRED_COLUMN_BLOCK_EVALUATE(GreaterPredicate, >)
 COMPARISON_PRED_COLUMN_BLOCK_EVALUATE(GreaterEqualPredicate, >=)
 
+#define BITMAP_COMPARE_EqualPredicate(s, exact_match, seeked_ordinal, 
iterator, bitmap, roaring) do { \
+    if (!s.is_not_found()) { \
+        if (!s.ok()) { return s; } \
+        if (exact_match) { \
+            RETURN_IF_ERROR(iterator->read_bitmap(seeked_ordinal, &roaring)); \
+        } \
+    } \
+    } while (0)
+
+#define BITMAP_COMPARE_NotEqualPredicate(s, exact_match, seeked_ordinal, 
iterator, bitmap, roaring) do { \
+    if (s.is_not_found()) { return Status::OK(); } \
+    if (!s.ok()) { return s; } \
+    if (!exact_match) { return Status::OK(); } \
+    RETURN_IF_ERROR(iterator->read_bitmap(seeked_ordinal, &roaring)); \
+    *bitmap -= roaring; \
+    return Status::OK(); \
+    } while (0)
+
+#define BITMAP_COMPARE_LessPredicate(s, exact_match, seeked_ordinal, iterator, 
bitmap, roaring) do { \
+    if (s.is_not_found()) { return Status::OK(); } \
+    if (!s.ok()) { return s; } \
+    RETURN_IF_ERROR(iterator->read_union_bitmap(0, seeked_ordinal, &roaring)); 
\
+    } while (0)
+
+#define BITMAP_COMPARE_LessEqualPredicate(s, exact_match, seeked_ordinal, 
iterator, bitmap, roaring) do { \
+    if (s.is_not_found()) { return Status::OK(); } \
+    if (!s.ok()) { return s; } \
+    if (exact_match) { \
+        seeked_ordinal++; \
+    } \
+    RETURN_IF_ERROR(iterator->read_union_bitmap(0, seeked_ordinal, &roaring)); 
\
+    } while (0)
+
+#define BITMAP_COMPARE_GreaterPredicate(s, exact_match, seeked_ordinal, 
iterator, bitmap, roaring) do { \
+    if (!s.is_not_found()) { \
+        if (!s.ok()) { return s; } \
+        if (exact_match) { \
+            seeked_ordinal++; \
+        } \
+        RETURN_IF_ERROR(iterator->read_union_bitmap(seeked_ordinal, 
ordinal_limit, &roaring)); \
+    } \
+    } while (0)
+
+#define BITMAP_COMPARE_GreaterEqualPredicate(s, exact_match, seeked_ordinal, 
iterator, bitmap, roaring) do { \
+    if (!s.is_not_found()) { \
+        if (!s.ok()) { return s; } \
+        RETURN_IF_ERROR(iterator->read_union_bitmap(seeked_ordinal, 
ordinal_limit, &roaring)); \
+    } \
+    } while (0)
+
+#define BITMAP_COMPARE(CLASS, s, exact_match, seeked_ordinal, iterator, 
bitmap, roaring) \
+        BITMAP_COMPARE_##CLASS(s, exact_match, seeked_ordinal, iterator, 
bitmap, roaring)
+
+#define COMPARISON_PRED_BITMAP_EVALUATE(CLASS, OP) \
+    template<class type> \
+    Status CLASS<type>::evaluate(const Schema& schema, const 
vector<BitmapIndexIterator*>& iterators, uint32_t num_rows, Roaring* bitmap) 
const { \
+        BitmapIndexIterator *iterator = iterators[_column_id]; \
 
 Review comment:
   done

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


With regards,
Apache Git Services

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

Reply via email to