You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@arrow.apache.org by "NinaPeng (via GitHub)" <gi...@apache.org> on 2024/11/26 19:16:47 UTC
[I] [Java][JDBC] JDBC Adapter execution failed for Mysql unsigned interger data [arrow-java]
NinaPeng opened a new issue, #182:
URL: https://github.com/apache/arrow-java/issues/182
**Summarize**
Arrow JDBC Adapter throw exception when wrapping the mysql driver with unsigned interger data.
**Example**
create a field with INT UNSIGNED type in Mysql, one of the field value is 4294967293. when use JDBC Adapter, it will throw:
```
Caused by: java.lang.RuntimeException: Error occurred while consuming data.
at org.apache.arrow.adapter.jdbc.ArrowVectorIterator.consumeData(ArrowVectorIterator.java:117)
ArrowVectorIterator.java:117
at org.apache.arrow.adapter.jdbc.ArrowVectorIterator.load(ArrowVectorIterator.java:159)
at org.apache.arrow.adapter.jdbc.ArrowVectorIterator.next(ArrowVectorIterator.java:177)
ArrowVectorIterator.java:177
... 76 more
Caused by: java.sql.SQLDataException: Value '4294967293' is outside of valid range for type java.lang.Integer
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:115)
SQLError.java:115
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:98)
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:90)
SQLError.java:90
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:64)
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:74)
SQLError.java:74
at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:92)
SQLExceptionsMapping.java:92
at com.mysql.cj.jdbc.result.ResultSetImpl.getObject(ResultSetImpl.java:1431)
ResultSetImpl.java:1431
at com.mysql.cj.jdbc.result.ResultSetImpl.getInt(ResultSetImpl.java:830)
ResultSetImpl.java:830
at org.apache.arrow.adapter.jdbc.consumer.IntConsumer$NullableIntConsumer.consume(IntConsumer.java:56)
IntConsumer.java:56
at org.apache.arrow.adapter.jdbc.consumer.CompositeJdbcConsumer.consume(CompositeJdbcConsumer.java:46)
CompositeJdbcConsumer.java:46
at org.apache.arrow.adapter.jdbc.ArrowVectorIterator.consumeData(ArrowVectorIterator.java:106)
ArrowVectorIterator.java:106
... 78 more
Caused by: com.mysql.cj.exceptions.NumberOutOfRange: Value '4294967293' is outside of valid range for type java.lang.Integer
at com.mysql.cj.result.IntegerValueFactory.createFromLong(IntegerValueFactory.java:62)
at com.mysql.cj.result.IntegerValueFactory.createFromLong(IntegerValueFactory.java:44)
at com.mysql.cj.protocol.a.MysqlTextValueDecoder.decodeUInt4(MysqlTextValueDecoder.java:110)
```
which is thrown from https://github.com/apache/arrow/blob/c9fbc88eccd56fda27d6bc655732ed17388317ac/java/adapter/jdbc/src/main/java/org/apache/arrow/adapter/jdbc/consumer/IntConsumer.java#L56
**Expected**
make jdbc adpater support unsigned datatype.
possible datatype mapping:
| SQL Type| Java Type |
|-|-|
|TINYINT UNSIGNED|java.lang.Integer|
|SMALLINT UNSIGNED|java.lang.Integer|
|MEDIUMINT UNSIGNED|java.lang.Long|
|INT UNSIGNED|java.lang.Long|
|BIGINT UNSIGNED|java.math.BigInteger|
### Component(s)
Java
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@arrow.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org