You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@kafka.apache.org by "Sagar Rao (JIRA)" <ji...@apache.org> on 2016/10/25 17:10:58 UTC

[jira] [Created] (KAFKA-4342) Kafka-connect- support tinyint values

Sagar Rao created KAFKA-4342:
--------------------------------

             Summary: Kafka-connect- support tinyint values
                 Key: KAFKA-4342
                 URL: https://issues.apache.org/jira/browse/KAFKA-4342
             Project: Kafka
          Issue Type: Bug
            Reporter: Sagar Rao


We have been using Kafka-connect-jdbc  actively for one of our projects and one of the issues that we have noticed is the way it handles the tinyint values.

Our database is on mysql and mysql allows both signed and unsigned values to be stored. So, it can have values going upto 255 but when kafka-connect sees values beyond 128, it fails. 

Reason being, in the ConnectSchema class, the INT8 maps to a Byte which is a signed value. If we look at the jdbc docs then this is what they say about handling tinyint values:

https://docs.oracle.com/javase/6/docs/technotes/guides/jdbc/getstart/mapping.html

8.3.4 TINYINT
The JDBC type TINYINT represents an 8-bit integer value between 0 and 255 that may be signed or unsigned.

The corresponding SQL type, TINYINT, is currently supported by only a subset of the major databases. Portable code may therefore prefer to use the JDBC SMALLINT type, which is widely supported.

The recommended Java mapping for the JDBC TINYINT type is as either a Java byte or a Java short. The 8-bit Java byte type represents a signed value from -128 to 127, so it may not always be appropriate for larger TINYINT values, whereas the 16-bit Java short will always be able to hold all TINYINT values.

I had submitted a PR for this last week. But it failed in the jenkins build for unrelated test case. So, if someone can take a look at this or suggest something then it would be great:

https://github.com/apache/kafka/pull/2044



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)