Skip to content

Commit c006d54

Browse files
Beauuu-0826claude
andcommitted
[BugFix] Keep non-null rows for negated empty-literal MATCH in inverted-index seek
seek_inverted_index cleared the row bitmap whenever the match literal was empty (read_inverted_index returned nullopt), regardless of negation. That dropped every row for NOT (col MATCH ''), even though MATCH '' matches nothing and its negation is TRUE for all non-null rows. This surfaced once the OR-MATCH fallback started reusing seek_inverted_index. Substitute an empty posting set for the nullopt case and reuse the shared with_not / intersect path, so col MATCH '' keeps no rows while NOT (col MATCH '') keeps every non-null row (only NULLs stay out). Fixes the same latent bug on the AND filtering path. Add SQL regression for both the AND and OR-MATCH fallback paths. Signed-off-by: eason <1569163626@qq.com> Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 5d475ea commit c006d54

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

be/src/storage_primitive/column_expr_predicate.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -392,8 +392,7 @@ Status ColumnExprPredicate::seek_inverted_index(const std::string& column_name,
392392

393393
// nullopt means an empty match string, which matches no rows. Fall through
394394
// with an empty posting set so the shared logic below produces the right
395-
// result: col MATCH '' keeps nothing (&= empty), while NOT (col MATCH '')
396-
// keeps every non-null row (-= empty, then -= nulls).
395+
// result
397396
if (!roaring_opt.has_value()) {
398397
roaring_opt.emplace();
399398
}

0 commit comments

Comments
 (0)