xinyiZzz commented on code in PR #15917: URL: https://github.com/apache/doris/pull/15917#discussion_r1116607158
########## be/src/olap/rowset/segment_v2/segment_iterator.cpp: ########## @@ -1160,58 +1189,86 @@ void SegmentIterator::_vec_init_lazy_materialization() { _is_need_short_eval = true; } - // Step 2: check non-predicate read costs to determine whether need lazy materialization - // fill _non_predicate_columns. - // After some optimization, we suppose lazy materialization is better performance. + // make _schema_block_id_map + _schema_block_id_map.resize(_schema.columns().size()); + for (int i = 0; i < _schema.num_column_ids(); i++) { + auto cid = _schema.column_id(i); + _schema_block_id_map[cid] = i; + } + + // Step2: extract columns that can execute expr context + _is_remaining_expr_column.resize(_schema.columns().size(), false); + if (_enable_remaining_expr_pushdown && _remaining_vconjunct_root != nullptr) { + _extract_remaining_expr_columns(_remaining_vconjunct_root); + if (!_remaining_expr_columns.empty()) { + _is_need_expr_eval = true; + for (auto cid : _schema.column_ids()) { + // pred column also needs to be filtered by expr + if (_is_remaining_expr_column[cid] || _is_pred_column[cid]) { + auto loc = _schema_block_id_map[cid]; + _columns_to_filter.push_back(loc); + } + } + } + } + + // Step 3: fill non predicate columns and second read columns if (_schema.column_ids().size() > pred_column_ids.size()) { for (auto cid : _schema.column_ids()) { if (!_is_pred_column[cid]) { - _non_predicate_columns.push_back(cid); + if (!_is_remaining_expr_column[cid]) { + _non_predicate_columns.push_back(cid); + } else { + _second_read_column_ids.push_back(cid); + } if (_is_need_vec_eval || _is_need_short_eval) { _lazy_materialization_read = true; } } } } Review Comment: fixed -- 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