[spark][bugfix] Use pk index for comparator align with SortMergeReader#2987
Merged
Conversation
db7b8a6 to
c3483f5
Compare
Contributor
Author
|
@YannByron @wuchong please help review this pr, thank you! |
YannByron
reviewed
Apr 7, 2026
| val pkRowType = new RowType(pkFields) | ||
| val keyEncoder = | ||
| encode.KeyEncoder.ofPrimaryKeyEncoder( | ||
| rowType, |
Contributor
There was a problem hiding this comment.
I think what is needed here is the row type of input data, not just the row type of primary key.
Contributor
Author
There was a problem hiding this comment.
actually only pk col is needed, ut already covered this case.
YannByron
reviewed
Apr 7, 2026
| private val sortedLogRecords = logRecords.sortWith { | ||
| case (record1, record2) => | ||
| val keyComparison = comparator.compare(record1.getRow, record2.getRow) | ||
| val keyComparison = comparator.compare( |
Contributor
There was a problem hiding this comment.
Can you explain why this change is needed?
Contributor
Author
There was a problem hiding this comment.
SortMergeReader compare row with pk, but here compare with full row, so ut failed when pk col was not at begining.
Contributor
|
+1. |
Ugbot
pushed a commit
to Ugbot/fluss
that referenced
this pull request
Apr 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Purpose
Linked issue: close #2986
Brief change log
Tests
Spark Read: primary key table with random projectAPI and Format
Documentation