[BugFix] Fix NOT LIKE includes null/missing field rows (#5169)#5338
[BugFix] Fix NOT LIKE includes null/missing field rows (#5169)#5338songkant-aws wants to merge 6 commits intoopensearch-project:mainfrom
Conversation
…oject#5169) Signed-off-by: Songkan Tang <songkant@amazon.com>
Decision LogRoot Cause: Approach: Added Alternatives Rejected:
Pitfalls:
Things to Watch:
|
PR Reviewer Guide 🔍(Review updated until commit da780a9)Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Latest suggestions up to da780a9 Explore these optional code suggestions:
Previous suggestionsSuggestions up to commit dac4c42
Suggestions up to commit 89e1bc5
Suggestions up to commit 161375c
Suggestions up to commit 702b3f7
|
…dling Update the expected DSL output to include the exists filter for the NOT(LIKE(URL, pattern)) clause, matching the new behavior where must(exists(field)) is emitted alongside must_not(wildcard(...)). Signed-off-by: Songkan Tang <songkant@amazon.com>
|
Persistent review updated to latest commit 161375c |
…rant predicates only The blanket exists injection in SimpleQueryExpression.not() broke expressions like NOT(IS_NOT_NULL(a)), NOT(IS_TRUE(e)), and NOT(IS_FALSE(e)) by always adding an exists filter. This was incorrect because truth-test and null-test operators already encode null semantics. The fix reverts not() to its original mustNot-only behavior and moves the exists injection to the prefix() call site, where it is applied only when the inner operand is a null-intolerant predicate (LIKE, comparisons, SEARCH, etc.). Signed-off-by: Songkan Tang <songkant@amazon.com>
|
Persistent review updated to latest commit 89e1bc5 |
…PredicateAnalyzer Remove the getFieldExpression() accessor that exposed internal state and replace it with notWithExistsFilter(), which encapsulates the exists + mustNot logic inside SimpleQueryExpression. This produces a flatter DSL (must[exists] + mustNot[original]) instead of a nested bool wrapper, and keeps the same semantic behavior for null-intolerant predicate negation. Signed-off-by: Songkan Tang <songkant@amazon.com>
|
Persistent review updated to latest commit dac4c42 |
|
Persistent review updated to latest commit da780a9 |
Description
SimpleQueryExpression.not()inPredicateAnalyzer.javageneratedboolQuery().mustNot(builder())without anexistsQueryfilter. This caused OpenSearch'smust_notto match documents where the field doesn't exist (null/missing), leaking null rows into NOT LIKE results.Fixed by adding
.must(existsQuery(getFieldReference()))alongside themustNot, consistent with hownotLike()andnotEquals()are already correctly implemented in the same class.Related Issues
Resolves #5169
Check List
-s)spotlessCheckpassed