[Enhancement](inverted index) apply inverted index when has any #41547 (#41584)

cherry pick from #41547
This commit is contained in:
airborne12
2024-10-09 14:13:38 +08:00
committed by GitHub
parent 5a6517ba45
commit 9fe77b335c
2 changed files with 7 additions and 1 deletions

View File

@ -504,7 +504,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());

View File

@ -157,6 +157,11 @@ public:
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);