Skip to content

feat(core): support partial updates in PK realtime writes - #525

Open
HaHaJeff wants to merge 2 commits into
apache:mainfrom
HaHaJeff:codex/pk-realtime-partial-update
Open

HaHaJeff wants to merge 2 commits into
apache:mainfrom
HaHaJeff:codex/pk-realtime-partial-update

Conversation

@HaHaJeff

@HaHaJeff HaHaJeff commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

Purpose

Enable partial-update for primary-key realtime writes by reusing the existing merge functions and options used by the ordinary Writer.

Related issue (tracked separately): #524

  • Allow PARTIAL_UPDATE alongside DEDUPLICATE, preserving the existing deduplicate ignore-delete restrictions. Standalone aggregation and first-row engines remain unsupported.
  • Reuse framework merge logic for prepared readers, sequence groups, field aggregation, and configured delete handling. The store only stores, sorts, and spills; merging remains the framework's responsibility.
  • Pass full table primary keys to the merge factory; retain trimmed keys for physical keys and sorting.
  • Keep realtime Noop compaction unchanged.
  • Preserve non-realtime merge/read behavior; the merge-factory change is limited to the realtime creation call.

Known Issues

This PR aligns realtime partial-update merging with the existing ordinary Writer behavior by reusing the same merge functions. It does not fix the existing staged-merge defects or change non-realtime merge/read behavior. The ordinary Writer reproductions are tracked separately in #524 and will be addressed independently. Realtime may inherit these limitations; this PR does not establish correctness for all affected combinations.

Tests

Previously completed validation for feature commit 2e2f194ccdab76831b2988a9b749f5d8c299d8f7: 9 realtime integration tests and 20 core tests passed (29 total). These tests were not rerun when publishing this PR.

The four new integration tests are:

  • RealtimeWriteInteTest.TestPkPartialUpdateDeleteAcrossCommits
  • RealtimeWriteInteTest.TestPkPartialUpdateSequenceGroups
  • RealtimeWriteInteTest.TestPkPartialUpdateAggregationSpillAndRecovery
  • RealtimeWriteInteTest.TestPkPartialUpdatePartitionedDefaultAggregationRetract

The other five integration tests cover existing primary-key reads, recovery, writer handoff, and multiple batches. Core coverage includes KeyValueFileStoreWriteTest.* and FileStoreWriteTest.*.

Coverage exercises real memory queries, prepare/commit and normal disk reads, spill, reopen, and replay. This is focused validation, not exhaustive partial-update semantics, full CI, Java interoperability, or all repository tests.

API and Format

No public include/paimon/ API, storage format, or protocol changes.

Documentation

Updated the realtime user guide to document partial-update support and its scope.

Generative AI tooling

Generated-by: OpenAI Codex (CLI 0.160.0)

if (options.GetMergeEngine() != MergeEngine::DEDUPLICATE &&
options.GetMergeEngine() != MergeEngine::PARTIAL_UPDATE) {
return Status::NotImplemented(
"PK realtime supports only the DEDUPLICATE and PARTIAL_UPDATE merge engines");

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With partial-update and DVs enabled, pushing value predicates into high-level disk files can discard rows needed to complete an in-memory partial update.

For example:

Disk (after compaction): (id=1, a="old", b="keep")
Memory partial update:  (id=1, a="new", b=null)
Query: WHERE a = 'new'

Expected: (id=1, a="new", b="keep")
Actual:   (id=1, a="new", b=null)

The disk row is filtered out before merging, so b="keep" is lost.

Please either push down only primary-key predicates across all disk levels and evaluate value predicates after merging, or reject the combination of realtime partial-update and DVs for now.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants