[jira] [Created] (FLINK-18580) Incomplete conversion for MySQL types

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[jira] [Created] (FLINK-18580) Incomplete conversion for MySQL types

Shang Yuanchun (Jira)
Dawid Wysakowicz created FLINK-18580:
----------------------------------------

             Summary: 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


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)