-
Notifications
You must be signed in to change notification settings - Fork 2.1k
[Fix][Connector-V2] Fix partitioning column selection logic #10236
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Conversation
davidzollo
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
|
@dybyte hi,Are all jdbc databases adapted to the leftmost principle? |
Yes. The leftmost column of a composite index is simply the first column defined in the index. |
.../connector-cdc/connector-cdc-base/src/test/java/jdbc/source/JdbcSourceChunkSplitterTest.java
Show resolved
Hide resolved
.../connector-cdc/connector-cdc-base/src/test/java/jdbc/source/JdbcSourceChunkSplitterTest.java
Outdated
Show resolved
Hide resolved
Carl-Zhou-CN
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
| if (isEvenlySplitColumn(firstColumn)) { | ||
| splitColumn = columnComparable(splitColumn, firstColumn); | ||
| if (sqlTypePriority(splitColumn) == 1) { | ||
| return splitColumn; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about printing a log after selecting the column, so that users can know some details.
| import java.util.Optional; | ||
|
|
||
| public class JdbcSourceChunkSplitterTest { | ||
| class JdbcSourceChunkSplitterTest { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is "public" deleted?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
JUnit5 does not require test classes to be public, so the modifier was removed as it is unnecessary.
Fixes: #9949
Purpose of this pull request
This PR fixes the partitioning column selection logic.
It ensures that when a primary/unique key is present, the first column of that key is correctly selected and used as the partitioning column.
Does this PR introduce any user-facing change?
No.
How was this patch tested?
Added
JdbcSourceChunkSplitterTest.splitColumnTestWithUniqueKey().Check list
New License Guide
incompatible-changes.mdto describe the incompatibility caused by this PR.