[ 
https://issues.apache.org/jira/browse/NIFI-14448?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17941843#comment-17941843
 ] 

Sascha Huk commented on NIFI-14448:
-----------------------------------

Using my own tests with MySQL doubles, I discovered that the given types of 
Shyiko's binlog data are not always as expected (e.g., instances of the Java 
type `int` are not returned for TINYINT type columns, I expected `byte`).

*I have to release one more fix* to replace the "instanceof" checks on Shyiko 
data in your JSON writers by type/cast inference on the base of the type of the 
data's corresponding org.apache.nifi.cdc.event.ColumnDefinition.

> nifi-cdc: Fix integer serialization to respect SQL UNSIGNED type semantics
> --------------------------------------------------------------------------
>
>                 Key: NIFI-14448
>                 URL: https://issues.apache.org/jira/browse/NIFI-14448
>             Project: Apache NiFi
>          Issue Type: Bug
>          Components: Extensions
>    Affects Versions: 2.3.0
>            Reporter: Sascha Huk
>            Priority: Critical
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> The processor CaptureChangeMySQL changes the value of larger sql-unsigned 
> integer values - for example in the following way: UNSIGNED TINYINT 179 gets 
> thrown on -77. 
> For more context:
>  * see the [current Implementation notes of the Shyiko Binlog 
> Connector|https://github.com/shyiko/mysql-binlog-connector-java/tree/0.21.0?tab=readme-ov-file#implementation-notes]:
>  _data of numeric types (tinyint, etc) always returned signed(!) regardless 
> of whether column definition includes "unsigned" keyword or not._
>  * There are no unsigned integer types in Java
> Therefore, your org.apache.nifi.cdc.event.ColumnDefinition has to memorize 
> isSigned from java.sql.ResultSetMetaData und use this information for the 
> correct interpretation of Shyiko's Java integer types, at least during 
> serialization in your JSON writers.
> I will offer a MergeRequest, while preserving the author's design and coding 
> style as unchanged as possible: https://github.com/apache/nifi/pull/9857



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to