diff --git a/src/Interpreters/GinFilter.cpp b/src/Interpreters/GinFilter.cpp index 5d8233183132..3a1a5fb403e6 100644 --- a/src/Interpreters/GinFilter.cpp +++ b/src/Interpreters/GinFilter.cpp @@ -166,6 +166,10 @@ bool GinFilter::match(const GinPostingsCache & postings_cache) const if (hasEmptyPostingsList(postings_cache)) return false; + /// If there is only one non-empty posting list, it is a match. + if (postings_cache.size() == 1) + return true; + /// Check for each row ID ranges for (const auto & rowid_range: rowid_ranges) if (matchInRange(postings_cache, rowid_range.segment_id, rowid_range.range_start, rowid_range.range_end))