Repository navigation
[core] Negate predicates like Java so NULL rows stay excluded - #1145
Open
JeonDaehong wants to merge 1 commit into
Open
JeonDaehong wants to merge 1 commit into
JeonDaehong wants to merge 1 commit into
Conversation
Predicate::negate wrapped leaves in Not, which was evaluated as !inner, so NOT(p = 'a') selected rows where p is NULL. Reads returned them and delete_by_predicate deleted them. Flip the leaf operator and push through AND/OR like Java Predicate.negate. Leaves without a negated operator stay as Not, which now evaluates to false for NULL input. Closes apache#1143
Author
|
@JingsongLi @leaves12138 could you take a look when you have time? Fixes #1143: |
JeonDaehong
marked this pull request as draft
October 17, 2026 06:24
Author
|
Moved to draft until CI is green. I couldn't run the docker fixtures and the Go/Python suites locally. Will mark it ready once they pass. |
JeonDaehong
marked this pull request as ready for review
October 17, 2026 06:42
Author
|
CI is green, ready for review. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Purpose
Linked issue: close #1143
Predicate::negatewrapped leaves inNot, andNotwas evaluated as!inner, so a NULL input madeNOT(p = 'a')true. Reads returned those rows anddelete_by_predicatedeleted them. Java flips the leaf instead (Equal.negate()isNotEqual), which is false for NULL.Brief change log
Predicate::negatenow does what JavaPredicate.negatedoes: flip the leaf operator (=/!=,</>=,<=/>,IS NULL/IS NOT NULL,IN/NOT IN,BETWEEN/NOT BETWEEN) and push through AND/OR with De Morgan.scan.rsnow matches the new shape of the negated filter (x < lo OR x > hiinstead ofNOT(x >= lo AND x <= hi)).STARTS_WITH,ENDS_WITH,CONTAINS,LIKE, array ops) stay asNot(leaf).eval_rowand the residual row filter now return false for those when the input is NULL, same as JavaNotStartsWith/NotLike/... .Tests
negated_predicates_keep_null_rowsandnegated_data_predicate_keeps_null_rowscover the cases from the issue on the partition and DV delete paths and on reads. Both fail on main.negateand for NULL evaluation ineval_rowand the residual filter.test_file_index_nested_not_with_added_column_falls_backnow expects[1]instead of[1, 2].addedis NULL in the old file, so for id 2 the predicate isNOT(true AND unknown). Java drops that row too.test_not/test_display_not, three DataFusion pushdown tests, the global index exactness test and the stats fail-open test asserted the oldNotshape. The last two now buildPredicate::Notdirectly so they keep testing theNotbranch.fmt and clippy (1.98.0,
-D warnings) pass.cargo test --no-fail-fast -p paimon -p paimon-datafusion -p paimon-c: 5804 passed. The 39 failures are allTableNotExist/ table not found for the fixture tables CI provisions, plus 2 that need the lumina library. The ones I checked fail the same way on main.Not covered here: a
Predicate::Notaround AND/OR built by hand (not throughnegate) is still evaluated as!inner. Nothing in core builds that today, but I can add it if you'd like.API and Format
No API change.
Predicate::negatereturns a different but equivalent tree for non-NULL inputs.Documentation
None.