[jira] [Commented] (FLINK-17657) jdbc not support read BIGINT UNSIGNED field
[ https://issues.apache.org/jira/browse/FLINK-17657?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17115886#comment-17115886 ] lun zhang commented on FLINK-17657: --- Awesome job!!! > jdbc not support read BIGINT UNSIGNED field > --- > > Key: FLINK-17657 > URL: https://issues.apache.org/jira/browse/FLINK-17657 > Project: Flink > Issue Type: Bug > Components: Connectors / JDBC >Affects Versions: 1.10.0, 1.10.1 >Reporter: lun zhang >Assignee: Leonard Xu >Priority: Major > Labels: pull-request-available > Fix For: 1.11.0 > > Attachments: env.yaml, excetion.txt > > > I use sql client read mysql table, but I found I can't read a table contain > `BIGINT UNSIGNED` field. It will > Caused by: java.lang.ClassCastException: java.math.BigInteger cannot be cast > to java.lang.Long > > MySQL table: > > create table tb > ( > id BIGINT UNSIGNED auto_increment > primary key, > cooper BIGINT(19) null , > user_sex VARCHAR(2) null > ); > > my env yaml is env.yaml . -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Commented] (FLINK-17657) jdbc not support read BIGINT UNSIGNED field
[ https://issues.apache.org/jira/browse/FLINK-17657?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17112897#comment-17112897 ] Leonard Xu commented on FLINK-17657: [~zhanglun] Thanks for the report, it's a bug from type mapping between mysql and flink sql type exists in JDBC connector. the root cause is that bigint unsigned range is {{0}} to {{18446744073709551615, }}{{bigint rang is }}{{-9223372036854775808}}{{ to }}{{9223372036854775807}}{{. so we cannot map a bigint unsigned to bigint(flink bigint has same range with mysql bigint)}}. [~JinxinTang] 's work around[1] is read String rather read the original BigInteger(jdbc treats bigint unsigned as java.math.BigInteger). [1][https://github.com/TJX2014/flink/blob/master-flink17657-jdbc-bigint/flink-examples/flink-examples-batch/src/main/java/org/apache/flink/examples/java/jdbc/JdbcReader.java#L49] > jdbc not support read BIGINT UNSIGNED field > --- > > Key: FLINK-17657 > URL: https://issues.apache.org/jira/browse/FLINK-17657 > Project: Flink > Issue Type: Bug > Components: Connectors / JDBC, Table SQL / Client >Affects Versions: 1.10.0, 1.10.1 >Reporter: lun zhang >Priority: Major > Attachments: env.yaml, excetion.txt > > > I use sql client read mysql table, but I found I can't read a table contain > `BIGINT UNSIGNED` field. It will > Caused by: java.lang.ClassCastException: java.math.BigInteger cannot be cast > to java.lang.Long > > MySQL table: > > create table tb > ( > id BIGINT UNSIGNED auto_increment > primary key, > cooper BIGINT(19) null , > user_sex VARCHAR(2) null > ); > > my env yaml is env.yaml . -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Commented] (FLINK-17657) jdbc not support read BIGINT UNSIGNED field
[ https://issues.apache.org/jira/browse/FLINK-17657?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17112698#comment-17112698 ] lun zhang commented on FLINK-17657: --- Hi [~JinxinTang]. Sorry I only can reproduce this in sql client. > jdbc not support read BIGINT UNSIGNED field > --- > > Key: FLINK-17657 > URL: https://issues.apache.org/jira/browse/FLINK-17657 > Project: Flink > Issue Type: Bug > Components: Connectors / JDBC, Table SQL / Client >Affects Versions: 1.10.0, 1.10.1 >Reporter: lun zhang >Priority: Major > Attachments: env.yaml, excetion.txt > > > I use sql client read mysql table, but I found I can't read a table contain > `BIGINT UNSIGNED` field. It will > Caused by: java.lang.ClassCastException: java.math.BigInteger cannot be cast > to java.lang.Long > > MySQL table: > > create table tb > ( > id BIGINT UNSIGNED auto_increment > primary key, > cooper BIGINT(19) null , > user_sex VARCHAR(2) null > ); > > my env yaml is env.yaml . -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Commented] (FLINK-17657) jdbc not support read BIGINT UNSIGNED field
[ https://issues.apache.org/jira/browse/FLINK-17657?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17112697#comment-17112697 ] lun zhang commented on FLINK-17657: --- Hi [~danny0405] , I don't know how to fix it.It's need change flink sql support data type. > jdbc not support read BIGINT UNSIGNED field > --- > > Key: FLINK-17657 > URL: https://issues.apache.org/jira/browse/FLINK-17657 > Project: Flink > Issue Type: Bug > Components: Connectors / JDBC, Table SQL / Client >Affects Versions: 1.10.0, 1.10.1 >Reporter: lun zhang >Priority: Major > Attachments: env.yaml, excetion.txt > > > I use sql client read mysql table, but I found I can't read a table contain > `BIGINT UNSIGNED` field. It will > Caused by: java.lang.ClassCastException: java.math.BigInteger cannot be cast > to java.lang.Long > > MySQL table: > > create table tb > ( > id BIGINT UNSIGNED auto_increment > primary key, > cooper BIGINT(19) null , > user_sex VARCHAR(2) null > ); > > my env yaml is env.yaml . -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Commented] (FLINK-17657) jdbc not support read BIGINT UNSIGNED field
[ https://issues.apache.org/jira/browse/FLINK-17657?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17111920#comment-17111920 ] Danny Chen commented on FLINK-17657: Hi [~zhanglun], would you plan to fix this in release 1.11.0 ? > jdbc not support read BIGINT UNSIGNED field > --- > > Key: FLINK-17657 > URL: https://issues.apache.org/jira/browse/FLINK-17657 > Project: Flink > Issue Type: Bug > Components: Connectors / JDBC, Table SQL / Client >Affects Versions: 1.10.0, 1.10.1 >Reporter: lun zhang >Priority: Major > Fix For: 1.11.0 > > Attachments: env.yaml, excetion.txt > > > I use sql client read mysql table, but I found I can't read a table contain > `BIGINT UNSIGNED` field. It will > Caused by: java.lang.ClassCastException: java.math.BigInteger cannot be cast > to java.lang.Long > > MySQL table: > > create table tb > ( > id BIGINT UNSIGNED auto_increment > primary key, > cooper BIGINT(19) null , > user_sex VARCHAR(2) null > ); > > my env yaml is env.yaml . -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Commented] (FLINK-17657) jdbc not support read BIGINT UNSIGNED field
[ https://issues.apache.org/jira/browse/FLINK-17657?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17107228#comment-17107228 ] JinxinTang commented on FLINK-17657: hi, [~zhanglun], Could you please provide code detail to reproduce this issus, it seems ok in my side, here is my code piece:[code piece|https://github.com/TJX2014/flink/blob/master-flink17657-jdbc-bigint/flink-examples/flink-examples-batch/src/main/scala/org/apache/flink/examples/scala/jdbc/ReadMysql.scala] > jdbc not support read BIGINT UNSIGNED field > --- > > Key: FLINK-17657 > URL: https://issues.apache.org/jira/browse/FLINK-17657 > Project: Flink > Issue Type: Bug > Components: Connectors / JDBC, Table SQL / Client >Affects Versions: 1.10.0, 1.10.1 >Reporter: lun zhang >Priority: Major > Fix For: 1.11.0 > > Attachments: env.yaml, excetion.txt > > > I use sql client read mysql table, but I found I can't read a table contain > `BIGINT UNSIGNED` field. It will > Caused by: java.lang.ClassCastException: java.math.BigInteger cannot be cast > to java.lang.Long > > MySQL table: > > create table tb > ( > id BIGINT UNSIGNED auto_increment > primary key, > cooper BIGINT(19) null , > user_sex VARCHAR(2) null > ); > > my env yaml is env.yaml . -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Commented] (FLINK-17657) jdbc not support read BIGINT UNSIGNED field
[ https://issues.apache.org/jira/browse/FLINK-17657?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17107084#comment-17107084 ] lun zhang commented on FLINK-17657: --- Thank for your replay. It seem not ok.I try and get the follow exception. [ERROR] Could not execute SQL statement. Reason: java.lang.ClassCastException: java.math.BigInteger cannot be cast to java.math.BigDecimal > jdbc not support read BIGINT UNSIGNED field > --- > > Key: FLINK-17657 > URL: https://issues.apache.org/jira/browse/FLINK-17657 > Project: Flink > Issue Type: Bug > Components: Connectors / JDBC, Table SQL / Client >Affects Versions: 1.10.0, 1.10.1 >Reporter: lun zhang >Priority: Major > Fix For: 1.11.0 > > Attachments: env.yaml, excetion.txt > > > I use sql client read mysql table, but I found I can't read a table contain > `BIGINT UNSIGNED` field. It will > Caused by: java.lang.ClassCastException: java.math.BigInteger cannot be cast > to java.lang.Long > > MySQL table: > > create table tb > ( > id BIGINT UNSIGNED auto_increment comment '自增主键' > primary key, > cooper BIGINT(19) null , > user_sex VARCHAR(2) null > ); > > my env yaml is env.yaml . -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Commented] (FLINK-17657) jdbc not support read BIGINT UNSIGNED field
[ https://issues.apache.org/jira/browse/FLINK-17657?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17106782#comment-17106782 ] JinxinTang commented on FLINK-17657: BigInt in mysql has a bigger range than Long in java, you could use Decimal instead in java to parse. > jdbc not support read BIGINT UNSIGNED field > --- > > Key: FLINK-17657 > URL: https://issues.apache.org/jira/browse/FLINK-17657 > Project: Flink > Issue Type: Bug > Components: Connectors / JDBC, Table SQL / Client >Affects Versions: 1.10.0, 1.10.1 >Reporter: lun zhang >Priority: Major > Fix For: 1.11.0 > > Attachments: env.yaml, excetion.txt > > > I use sql client read mysql table, but I found I can't read a table contain > `BIGINT UNSIGNED` field. It will > Caused by: java.lang.ClassCastException: java.math.BigInteger cannot be cast > to java.lang.Long > > MySQL table: > > create table tb > ( > id BIGINT UNSIGNED auto_increment comment '自增主键' > primary key, > cooper BIGINT(19) null , > user_sex VARCHAR(2) null > ); > > my env yaml is env.yaml . -- This message was sent by Atlassian Jira (v8.3.4#803005)