Skip to content

Commit

Permalink
[Enhancement](inverted index) apply inverted index when has any #41547 (
Browse files Browse the repository at this point in the history
#41585)

cherry pick from #41547
  • Loading branch information
airborne12 authored Oct 9, 2024
1 parent 74aece4 commit ba825ef
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
3 changes: 2 additions & 1 deletion be/src/olap/rowset/segment_v2/segment_iterator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,8 @@ Status SegmentIterator::_get_row_ranges_by_column_conditions() {
RETURN_IF_ERROR(_apply_bitmap_index());
{
if (_opts.runtime_state &&
_opts.runtime_state->query_options().enable_inverted_index_query) {
_opts.runtime_state->query_options().enable_inverted_index_query &&
has_inverted_index_in_iterators()) {
SCOPED_RAW_TIMER(&_opts.stats->inverted_index_filter_timer);
size_t input_rows = _row_bitmap.cardinality();
RETURN_IF_ERROR(_apply_inverted_index());
Expand Down
5 changes: 5 additions & 0 deletions be/src/olap/rowset/segment_v2/segment_iterator.h
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,11 @@ class SegmentIterator : public RowwiseIterator {
return _inverted_index_iterators;
}

bool has_inverted_index_in_iterators() const {
return std::any_of(_inverted_index_iterators.begin(), _inverted_index_iterators.end(),
[](const auto& iterator) { return iterator != nullptr; });
}

private:
Status _next_batch_internal(vectorized::Block* block);

Expand Down

0 comments on commit ba825ef

Please sign in to comment.