-
Notifications
You must be signed in to change notification settings - Fork 2.2k
[Bug][Connector-V2] fix NPE when decimal type precision is incompatible for Paimon #9452
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
Conversation
| RowConverter.reconvert(data, sourceType, sinkSchema); | ||
| } catch (Exception e) { | ||
| Assertions.assertEquals( | ||
| "ErrorCode:[PAIMON-11], ErrorDescription:[deciaml type precision is incompatible. ] - `f0` field value is: 123.4, except filed schema of sink is `f0` DECIMAL(4, 1), but the filed in sink table which actual schema is `f0` DECIMAL(4, 2).Please check schema of sink table.", |
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.
Can we convert the precision of data dynamically before insert it?
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.
yes ,but need to modify the table schema
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.
Pull Request Overview
This pull request fixes a bug in the Paimon connector to address a NullPointerException that occurs when the decimal type precision is incompatible. Key changes include:
- Updating the RowConverter to validate and handle decimal field values properly.
- Adding a dedicated test case in RowConverterTest to verify the new error message.
- Introducing a new error code and updating error messages in PaimonConnectorErrorCode.
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| seatunnel-connectors-v2/connector-paimon/src/test/java/org/apache/seatunnel/connectors/seatunnel/paimon/utils/RowConverterTest.java | Adds test case for decimal conversions and validates error message content |
| seatunnel-connectors-v2/connector-paimon/src/main/java/org/apache/seatunnel/connectors/seatunnel/paimon/utils/RowConverter.java | Modifies decimal conversion logic and error message generation to correctly detect incompatible precision |
| seatunnel-connectors-v2/connector-paimon/src/main/java/org/apache/seatunnel/connectors/seatunnel/paimon/exception/PaimonConnectorErrorCode.java | Introduces a new error code with an associated message for decimal type precision incompatibility |
...n/src/test/java/org/apache/seatunnel/connectors/seatunnel/paimon/utils/RowConverterTest.java
Outdated
Show resolved
Hide resolved
...aimon/src/main/java/org/apache/seatunnel/connectors/seatunnel/paimon/utils/RowConverter.java
Outdated
Show resolved
Hide resolved
...ava/org/apache/seatunnel/connectors/seatunnel/paimon/exception/PaimonConnectorErrorCode.java
Outdated
Show resolved
Hide resolved
…che/seatunnel/connectors/seatunnel/paimon/utils/RowConverterTest.java Co-authored-by: Copilot <[email protected]>
…che/seatunnel/connectors/seatunnel/paimon/exception/PaimonConnectorErrorCode.java Co-authored-by: Copilot <[email protected]>
…che/seatunnel/connectors/seatunnel/paimon/utils/RowConverter.java Co-authored-by: Copilot <[email protected]>
Purpose of this pull request
source : mysql
sink : paimon flink
conf
Exception before the fix : the exception information is unclear, which is not convenient to locate the problem
Exception after the fix :
Does this PR introduce any user-facing change?
How was this patch tested?
Check list
New License Guide