← Back to Pull requests

[core] Negate predicates like Java so NULL rows stay excluded #1145

Open
unknown opened this pull request with 300 lines diff across 3 files
View on GitHub
unknown unknown commented on Oct 17, 2026 06:21 UTC
Author

Purpose

Linked issue: close #1143

Predicate::negate wrapped leaves in Not, and Not was evaluated as !inner, so a NULL input made NOT(p = 'a') true. Reads returned those rows and delete_by_predicate deleted them. Java flips the leaf instead (Equal.negate() is NotEqual), which is false for NULL.

Brief change log

  • Predicate::negate now does what Java Predicate.negate does: flip the leaf operator (=/!=, </>=, <=/>, IS NULL/IS NOT NULL, IN/NOT IN, BETWEEN/NOT BETWEEN) and push through AND/OR with De Morgan.

  • DataFusion: the NOT BETWEEN coverage check in scan.rs now matches the new shape of the negated filter (x < lo OR x > hi instead of NOT(x >= lo AND x <= hi)).

  • Leaves with no negated operator here (STARTS_WITH, ENDS_WITH, CONTAINS, LIKE, array ops) stay as Not(leaf). eval_row and the residual row filter now return false for those when the input is NULL, same as Java NotStartsWith/NotLike/... .
  • Tests

  • negated_predicates_keep_null_rows and negated_data_predicate_keeps_null_rows cover the cases from the issue on the partition and DV delete paths and on reads. Both fail on main.

  • Unit tests for negate and for NULL evaluation in eval_row and the residual filter.

  • Changed existing tests:

  • - test_file_index_nested_not_with_added_column_falls_back now expects [1] instead of [1, 2]. added is NULL in the old file, so for id 2 the predicate is NOT(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 old Not shape. The last two now build Predicate::Not directly so they keep testing the Not branch.

    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 all TableNotExist / 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::Not around AND/OR built by hand (not through negate) 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::negate returns a different but equivalent tree for non-NULL inputs.

    Documentation

    None.

    Diff: 300 lines (+225 / -75) across 3 files Reviewer: JeonDaehong Review duration: 41921m
    All Vouch review confidence checks passed
    Residual risk 0.21 = Change Risk (0.40) × (1 − Review Confidence (0.47)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.40 · 300 lines diff across 3 files
    0.40
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    46%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Shallow Review Depth shallow_review_depth
    0.344
    Diff Size diff_size
    0.341
    Real PR Conversation Timeline
    1 comments
    "Review active on #1145"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 46.7% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 40.1% (MEDIUM) · Higher = larger blast radius
    40.1%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 46.7% · Lower = rushed or shallow review
    46.7%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 21.3% · Safe to merge
    21.3%