You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "Dawid Wysakowicz (Jira)" <ji...@apache.org> on 2020/07/13 08:21:00 UTC
[jira] [Comment Edited] (FLINK-18580) Incomplete conversion for
MySQL types
[ https://issues.apache.org/jira/browse/FLINK-18580?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17156544#comment-17156544 ]
Dawid Wysakowicz edited comment on FLINK-18580 at 7/13/20, 8:20 AM:
--------------------------------------------------------------------
It should be possible to use {{DECIMAL(20,0)}} for MySQL's {{BIGINT UNSIGNED}} for now.
EDIT: Actually it might be the only option? In that case it should be documented. We could also throw a more helpful exception in that case.
was (Author: dawidwys):
It should be possible to use {{DECIMAL(20,0)}} for MySQL's {{BIGINT UNSIGNED}} for now.
> Incomplete conversion for MySQL types
> -------------------------------------
>
> Key: FLINK-18580
> URL: https://issues.apache.org/jira/browse/FLINK-18580
> Project: Flink
> Issue Type: Bug
> Components: Connectors / JDBC, Table SQL / Ecosystem
> Affects Versions: 1.11.0
> Reporter: Dawid Wysakowicz
> Priority: Critical
>
> The mapping of types returned from MySQL jdbc driver is incomplete according to the table: https://dev.mysql.com/doc/connector-j/5.1/en/connector-j-reference-type-conversions.html
> E.g. the {{BIGINT}} does not account for {{java.math.BigInteger}}.
> User reported problem with it:
> {code}
> CREATE TABLE user_account(
> uid BIGINT,
> system_unique_id STRING,
> name STRING,
> account STRING,
> passwd STRING,
> salt STRING,
> type INT,
> avatar STRING,
> source STRING,
> ksjk_existing TINYINT,
> created_at INT,
> updated_at INT,
> deleted_at INT,
> PRIMARY KEY (uid) NOT ENFORCED
> ) WITH (
> 'connector' = 'jdbc',
> 'url' = 'jdbc:mysql://xxx:3306/xxxx',
> 'table-name' = 'user_account',
> 'driver' = 'com.mysql.jdbc.Driver',
> 'username' = 'xxx',
> 'password' = 'xxx'
> );
> {code}
> {code}
> Caused by: java.lang.ClassCastException: java.math.BigInteger cannot be cast to java.lang.LongCaused by: java.lang.ClassCastException: java.math.BigInteger cannot be cast to java.lang.Long at org.apache.flink.table.data.GenericRowData.getLong(GenericRowData.java:154) ~[flink-table_2.12-1.11.0.jar:1.11.0] at org.apache.flink.table.data.RowData.get(RowData.java:260) ~[flink-table_2.12-1.11.0.jar:1.11.0] at org.apache.flink.table.runtime.typeutils.RowDataSerializer.toBinaryRow(RowDataSerializer.java:194) ~[flink-table-blink_2.12-1.11.0.jar:1.11.0] at org.apache.flink.table.runtime.typeutils.RowDataSerializer.serialize(RowDataSerializer.java:97) ~[flink-table-blink_2.12-1.11.0.jar:1.11.0] at org.apache.flink.table.runtime.typeutils.RowDataSerializer.serialize(RowDataSerializer.java:50) ~[flink-table-blink_2.12-1.11.0.jar:1.11.0] at org.apache.flink.streaming.runtime.streamrecord.StreamElementSerializer.serialize(StreamElementSerializer.java:175) ~[flink-dist_2.12-1.11.0.jar:1.11.0] at org.apache.flink.streaming.runtime.streamrecord.StreamElementSerializer.serialize(StreamElementSerializer.java:46) ~[flink-dist_2.12-1.11.0.jar:1.11.0] at org.apache.flink.runtime.plugable.SerializationDelegate.write(SerializationDelegate.java:54) ~[flink-dist_2.12-1.11.0.jar:1.11.0] at org.apache.flink.runtime.io.network.api.serialization.SpanningRecordSerializer.serializeRecord(SpanningRecordSerializer.java:71) ~[flink-dist_2.12-1.11.0.jar:1.11.0] at org.apache.flink.runtime.io.network.api.writer.RecordWriter.emit(RecordWriter.java:117) ~[flink-dist_2.12-1.11.0.jar:1.11.0] at org.apache.flink.runtime.io.network.api.writer.ChannelSelectorRecordWriter.emit(ChannelSelectorRecordWriter.java:60) ~[flink-dist_2.12-1.11.0.jar:1.11.0] at org.apache.flink.streaming.runtime.io.RecordWriterOutput.pushToRecordWriter(RecordWriterOutput.java:107) ~[flink-dist_2.12-1.11.0.jar:1.11.0] at org.apache.flink.streaming.runtime.io.RecordWriterOutput.collect(RecordWriterOutput.java:89) ~[flink-dist_2.12-1.11.0.jar:1.11.0]
> {code}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)