Skip to content

[client] Fix early termination in SortMergeReader on changelog deletes#3135

Merged
luoyuxia merged 3 commits into
apache:mainfrom
luoyuxia:fix-sort-merge-delete-iterator
Apr 20, 2026
Merged

[client] Fix early termination in SortMergeReader on changelog deletes#3135
luoyuxia merged 3 commits into
apache:mainfrom
luoyuxia:fix-sort-merge-delete-iterator

Conversation

@luoyuxia

@luoyuxia luoyuxia commented Apr 20, 2026

Copy link
Copy Markdown
Contributor

Purpose

Linked issue: close #3134

Fix SortMergeReader returning early when changelog deletes match snapshot rows during sort-merge reading.

Brief change log

  • update SnapshotMergedRowIteratorWrapper#hasNext() to skip empty merge results instead of treating them as end-of-input
  • continue advancing until a non-empty merged row is available or the snapshot iterator is actually exhausted
  • add a regression test that covers snapshot rows deleted by changelog records and verifies later snapshot rows are still returned

Tests

  • ./mvnw -pl fluss-client spotless:check -DskipTests -Dmaven.test.skip=true
  • ./mvnw -pl fluss-client checkstyle:check -DskipTests -Dmaven.test.skip=true
  • attempted ./mvnw test -pl fluss-client -Dtest=SortMergeReaderTest -Dcheckstyle.skip=true -Dpmd.skip=true -Dspotless.check.skip=true -Dmaven.javadoc.skip=true, but module test compilation is currently blocked by pre-existing errors in fluss-client/src/test/java/org/apache/fluss/client/table/LakeEnableTableITCase.java referencing DATALAKE_ENABLED

API and Format

No API or storage format changes.

Documentation

No documentation changes are required.

@luoyuxia luoyuxia changed the title [client] Skip deleted snapshot rows in SortMergeReader [client] Fix early termination in SortMergeReader on changelog deletes Apr 20, 2026

Copilot AI left a comment

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.

Pull request overview

Fixes SortMergeReader early termination when a snapshot row is deleted by changelog during sort-merge reading (issue #3134), ensuring iteration continues until snapshot input is actually exhausted.

Changes:

  • Update SnapshotMergedRowIteratorWrapper#hasNext() to skip SortMergeRows.EMPTY results instead of treating them as end-of-input.
  • Add a regression test that verifies deleted snapshot keys are skipped while later snapshot rows are still returned.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
fluss-client/src/main/java/org/apache/fluss/client/table/scanner/SortMergeReader.java Adjusts iterator hasNext() to advance past empty merge results caused by deletes.
fluss-client/src/test/java/org/apache/fluss/client/table/scanner/SortMergeReaderTest.java Adds coverage for snapshot rows deleted by changelog deletes (ensures scan doesn’t stop early).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@beryllw

beryllw commented Apr 20, 2026

Copy link
Copy Markdown
Contributor

LGTM!

@luoyuxia luoyuxia merged commit 776102c into apache:main Apr 20, 2026
11 of 13 checks passed
luoyuxia added a commit to luoyuxia/fluss that referenced this pull request Apr 20, 2026
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.

[client] SortMergeReader stops after deleted snapshot rows

3 participants