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


##########
be/src/olap/rowset/segment_v2/segment_iterator.cpp:
##########
@@ -1209,6 +1226,33 @@ Status SegmentIterator::_apply_inverted_index() {
         }
     }
 
+    // support expr to evaluate inverted index
+    std::unordered_map<ColumnId, std::pair<vectorized::NameAndTypePair, 
InvertedIndexIterator*>>
+            iter_map;
+
+    for (auto col_id : _common_expr_columns) {
+        if (_check_apply_by_inverted_index(col_id)) {
+            iter_map[col_id] = std::make_pair(_storage_name_and_type[col_id],
+                                              
_inverted_index_iterators[col_id].get());
+        }
+    }
+    for (auto exprCtx : _common_expr_ctxs_push_down) {
+        // _inverted_index_iterators has all column ids which has inverted 
index
+        // _common_expr_columns has all column ids from 
_common_expr_ctxs_push_down
+        // if current bitmap is already empty just return
+        if (_row_bitmap.isEmpty()) {
+            break;
+        }
+        roaring::Roaring bitmap = _row_bitmap;
+        const Status st = exprCtx->eval_inverted_indexs(iter_map, num_rows(), 
&bitmap);
+        if (!st.ok()) {
+            LOG(WARNING) << "failed to evaluate index in expr" << 
exprCtx->root()->debug_string()
+                         << ", error msg: " << st;
+        } else {
+            _row_bitmap &= bitmap;

Review Comment:
   we should make sure result of every single expr ctx evaluted is & Semantics



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