← Back to Pull requests

fix(table): treat lone UPDATE_BEFORE as retraction in partial-update #1434

Closed
unknown closed this pull request without merging on Nov 17, 2026 15:35 UTC
View on GitHub
unknown unknown commented on Nov 17, 2026 06:51 UTC
Author

Purpose

Linked issue: close #1430

With partial-update.remove-record-on-delete, a key whose last message is a lone UPDATE_BEFORE (-U) now reads no row, as in Java with apache/paimon PR 11178. Before this change the Rust merge ignored -U under this option.

The rules follow the Java PartialUpdateMergeFunction of that PR:

  • A -U marks the row removed and does not re-initialize it. It also writes its own non-null fields, as an INSERT does, so a later +I or +U brings the row back with the fields of other writers.

  • A merge result removed only by -U is UPDATE_BEFORE, including a key with only -U records. If a DELETE re-initialized the row in the same merge, the result is DELETE as before.

  • partial-update.remove-record-on-sequence-group and sequence groups keep their current behavior.
  • The gap has been reproduced against apache/paimon PR 11178: on a fixed-bucket Parquet table with this option, a committed +I(1, 10, 20) followed by a lone -U(1, 10, NULL) reads no row in Java and (1, 10, 20) through the PyPaimon Native reader on pypaimon-rust 0.5.0.

    Brief change log

  • PartialUpdateMergeFunction applies the -U rules above and reports UPDATE_BEFORE or DELETE through MergeResult::MaterializedRetractRow, which now carries the row kind.

  • The write pre-merge in kv_file_writer stores that row kind instead of always DELETE, so merging a pre-merged -U again does not re-initialize the row and drop older columns. Reads still drop both kinds.

  • Primary key compaction rejects only compound DELETE states with field aggregators, so UPDATE_BEFORE states are compacted instead of failing.
  • Tests

  • For every split of the events into commits, each flushed through the write pre-merge, another writer's column is kept across a -U and +U pair.

  • A key that ends with a lone -U reads no row until another writer restores it with the kept fields. This fails on the old code.

  • A key with only -U records keeps older columns. This fails on the old code and when a -U-only pre-merge writes DELETE.

  • With last_non_null_value, compaction of +I and -U in one or two commits succeeds under the none and lookup producers, the row stays removed, and a later +U restores the other writer's column. It fails without the compaction fix and when the merge result is DELETE again. Without a field aggregator the same cases pass, and a DELETE result instead drops the other writer's column when +I and -U are pre-merged in one commit.

  • Existing expectations that relied on -U being ignored now follow the Java rules: a lone -U removes the row on read, and a -U after a DELETE applies its fields while the result stays DELETE.
  • API and Format

    No public API or file format change.

    Documentation

    docs/src/compaction.md documents this rule.

    AI Disclosure

    Human-led contribution. Grok Bot, working for dragonknightk, assisted with this change, including the code, tests, and description. All submitted content was reviewed by a human before submission.

    (๑•̀ㅂ•́)و✧

    Diff: 387 lines (+290 / -97) across 4 files Reviewer: JeonDaehong Review duration: 524m
    All Vouch review confidence checks passed
    Residual risk 0.17 = Change Risk (0.43) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.43 · 387 lines diff across 4 files
    0.43
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    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
    Diff Size diff_size
    0.357
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #1434"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% 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: 43% (MEDIUM) · Higher = larger blast radius
    43%
    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: 60.5% · Lower = rushed or shallow review
    60.5%
    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: 17% · Safe to merge
    17%