Skip to content

[AURON #2451] Add Paimon COW multi-commit correctness coverage - #2452

Open
weimingdiit wants to merge 1 commit into
apache:masterfrom
weimingdiit:test/paimon-cow-upsert-correctness
Open

[AURON #2451] Add Paimon COW multi-commit correctness coverage#2452
weimingdiit wants to merge 1 commit into
apache:masterfrom
weimingdiit:test/paimon-cow-upsert-correctness

Conversation

@weimingdiit

Copy link
Copy Markdown
Contributor

Which issue does this PR close?

Closes #2451

Rationale for this change

The existing Paimon COW test verifies only a single commit. It does not protect against stale rows being returned after a later commit updates an existing primary key.

This change adds multi-commit correctness coverage while keeping the native scan implementation unchanged.

What changes are included in this PR?

Updates the existing Paimon COW primary-key integration test to:

  • Write the initial rows.
  • Write a newer value for an existing primary key in a second commit.
  • Verify that only the latest value is returned.
  • Verify that the query still uses NativePaimonV2TableScan.

Are there any user-facing changes?

No user-facing changes.

How was this patch tested?

UT.

Signed-off-by: weimingdiit <weimingdiit@gmail.com>
@weimingdiit
weimingdiit force-pushed the test/paimon-cow-upsert-correctness branch from 1b655c2 to 61fcc87 Compare August 8, 2026 04:05
@weimingdiit
weimingdiit marked this pull request as ready for review August 9, 2026 02:48
sql("insert into paimon.db.t_cow_multi_commit values (1, 'a'), (2, 'b')")
sql("insert into paimon.db.t_cow_multi_commit values (1, 'updated')")
val df = sql("select * from paimon.db.t_cow_multi_commit")
checkAnswer(df, Seq(Row(1, "updated"), Row(2, "b")))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The PR description says this test checks that the query still uses NativePaimonV2TableScan, but checkAnswer is the only assertion here.

The catch is that the answer comes out the same either way. If the native scan bails out, Spark falls back to its own Paimon reader, which merges by primary key and returns those same two rows, so the test stays green even if it never touches the native path. t_mor at line 234 is exactly that combination: no native scan, correct answer.

And the bail-out is a real possibility here. PaimonScanSupport.scala:162-173 drops the native plan when a split isn't raw-readable, and PaimonConvertProvider.scala:52 and :95 then quietly leave Spark's own scan in place.

Every other test in this suite that expects a native scan says so, directly (lines 49, 59, 73, 91, 105, 116, 142, 169, 408) or through checkSparkAnswerAndNativePaimonScan and executedNativeScan. Would it be worth doing the same here? It would also make this the first test pinning the native path for a COW primary-key table past its first commit.

One line, in case it helps:

Suggested change
checkAnswer(df, Seq(Row(1, "updated"), Row(2, "b")))
checkAnswer(df, Seq(Row(1, "updated"), Row(2, "b")))
assertNativePaimonScanApplied(df)

And if the scan turns out not to stay native after a second commit, that feels worth knowing too.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Paimon COW multi-commit correctness coverage

2 participants