[Bug][Connector-V2] fix NPE when decimal type precision is incompatible for Paimon#9452
Merged
Merged
Conversation
Hisoka-X
reviewed
Jun 18, 2025
| 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.", |
Member
There was a problem hiding this comment.
Can we convert the precision of data dynamically before insert it?
Contributor
Author
There was a problem hiding this comment.
yes ,but need to modify the table schema
Contributor
There was a problem hiding this comment.
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 |
…che/seatunnel/connectors/seatunnel/paimon/utils/RowConverterTest.java Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…che/seatunnel/connectors/seatunnel/paimon/exception/PaimonConnectorErrorCode.java Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…che/seatunnel/connectors/seatunnel/paimon/utils/RowConverter.java Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Hisoka-X
approved these changes
Jun 24, 2025
corgy-w
approved these changes
Jun 24, 2025
chncaesar
pushed a commit
to chncaesar/seatunnel
that referenced
this pull request
Jun 30, 2025
dybyte
pushed a commit
to dybyte/seatunnel
that referenced
this pull request
Jul 23, 2025
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 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