You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the file MySqlDDLParserListenerImpl.java, at line 339, there is an issue with how the precision and scale are determined based on the presence of (, ), and , in parsedDataType.
The issue arises because parsedDataType is derived from colDefTree.getText(), which includes column comments. If the comment contains characters like (, ), or ,, it incorrectly triggers the precision and scale parsing logic, even though the actual column definition does not contain these characters.
Example Scenario
Consider a column definition like the following:
`col1`varchar(45) NOT NULL COMMENT 'a column, test'
Here, the parsedDataType will contain the comment as well as:
"varchar(45)NOTNULLCOMMENT'a column, test'"
potentially causing incorrect parsing due to the extra , characters in the comment, so it will cause a Exception.
Suggested Solution
To prevent this issue, the logic should be adjusted to ensure that only the actual datatype segment is used for precision and scale determination, excluding any comments. This can be achieved by extracting only the datatype portion of parsedDataType without comments.
Proposed Code Change
One way to handle this is to sanitize parsedDataType before checking for (, ), and ,. Here is a suggested approach:
This ensures that only the datatype itself is analyzed for precision and scale, avoiding issues caused by comments.
Environment
ClickHouse Sink Connector version: [2.3]
Debezium version: [3.0]
Steps to Reproduce
Define a MySQL column with a datatype containing precision and scale and a comment with (, ), and ,.
Observe how the ClickHouse Sink Connector processes this column and note any parsing errors in the logs.
Expected Behavior
The connector should correctly parse the precision and scale based only on the actual datatype and ignore any characters in comments.
Actual Behavior
The connector incorrectly includes comment characters in the precision and scale parsing, potentially leading to incorrect ClickHouse datatype assignments.
Additional Information
N/A
The text was updated successfully, but these errors were encountered:
Description
In the file
MySqlDDLParserListenerImpl.java
, at line 339, there is an issue with how the precision and scale are determined based on the presence of(
,)
, and,
inparsedDataType
.The issue arises because
parsedDataType
is derived fromcolDefTree.getText()
, which includes column comments. If the comment contains characters like(
,)
, or,
, it incorrectly triggers the precision and scale parsing logic, even though the actual column definition does not contain these characters.Example Scenario
Consider a column definition like the following:
Here, the
parsedDataType
will contain the comment as well as:potentially causing incorrect parsing due to the extra
,
characters in the comment, so it will cause a Exception.Suggested Solution
To prevent this issue, the logic should be adjusted to ensure that only the actual datatype segment is used for precision and scale determination, excluding any comments. This can be achieved by extracting only the datatype portion of
parsedDataType
without comments.Proposed Code Change
One way to handle this is to sanitize
parsedDataType
before checking for(
,)
, and,
. Here is a suggested approach:This ensures that only the datatype itself is analyzed for precision and scale, avoiding issues caused by comments.
Environment
Steps to Reproduce
(
,)
, and,
.Expected Behavior
The connector should correctly parse the precision and scale based only on the actual datatype and ignore any characters in comments.
Actual Behavior
The connector incorrectly includes comment characters in the precision and scale parsing, potentially leading to incorrect ClickHouse datatype assignments.
Additional Information
N/A
The text was updated successfully, but these errors were encountered: