kafka-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sagar Rao (JIRA)" <j...@apache.org>
Subject [jira] [Created] (KAFKA-4342) Kafka-connect- support tinyint values
Date Tue, 25 Oct 2016 17:10:58 GMT
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:


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

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:


This message was sent by Atlassian JIRA

View raw message