eldenmoon commented on code in PR #32620:
URL: https://github.com/apache/doris/pull/32620#discussion_r1582147202


##########
be/src/vec/exprs/vcompound_pred.h:
##########
@@ -53,6 +53,74 @@ class VCompoundPred : public VectorizedFnCall {
 
     const std::string& expr_name() const override { return _expr_name; }
 
+    //   1. when meet 'or' conjunct: a or b, if b can apply index, return all 
rows, so b should not be extracted
+    //   2. when meet 'and' conjunct, function with column b can not apply 
inverted index
+    //      eg. a and hash(b)=1, if b can apply index, but hash(b)=1 is not 
for index, so b should not be extracted
+    //          but a and array_contains(b, 1), b can be applied inverted 
index, which b can be extracted
+    Status eval_inverted_index(
+            VExprContext* context,
+            const std::unordered_map<ColumnId, 
std::pair<vectorized::NameAndTypePair,
+                                                         
segment_v2::InvertedIndexIterator*>>&
+                    colid_to_inverted_index_iter,
+            uint32_t num_rows, roaring::Roaring* bitmap) const override {
+        std::shared_ptr<roaring::Roaring> res = 
std::make_shared<roaring::Roaring>();
+        if (_op == TExprOpcode::COMPOUND_OR) {
+            for (auto child : _children) {
+                std::shared_ptr<roaring::Roaring> child_roaring =
+                        std::make_shared<roaring::Roaring>();
+                Status st = child->eval_inverted_index(context, 
colid_to_inverted_index_iter,
+                                                       num_rows, 
child_roaring.get());
+                if (!st.ok()) {
+                    bitmap->addRange(0, num_rows);

Review Comment:
   maybe some return OK, some return NOT_IMPLEMENT, so addRange(0, num_rows) 
maybe wrong?



-- 
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-unsubscr...@doris.apache.org

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


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

Reply via email to