[
https://issues.apache.org/jira/browse/FLINK-22042?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17311399#comment-17311399
]
jingzi commented on FLINK-22042:
--------------------------------
https://github.com/apache/flink/pull/15431
> Fix reading bigint(20) UNSIGNED type field cannot be cast
> ----------------------------------------------------------
>
> Key: FLINK-22042
> URL: https://issues.apache.org/jira/browse/FLINK-22042
> Project: Flink
> Issue Type: Bug
> Components: API / Core
> Affects Versions: 1.12.0, 1.12.2
> Reporter: jingzi
> Priority: Major
> Fix For: 1.13.0
>
> Attachments: error.txt
>
> Original Estimate: 8h
> Remaining Estimate: 8h
>
> I use flink-clinet read mysql table,but run failed
> Caused by: java.lang.ClassCastException: java.math.BigInteger cannot be cast
> to java.lang.Long
>
> mysql table:
> `
> CREATE TABLE `testlxone` (
> `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT 'id',
> PRIMARY KEY (`id`) USING BTREE
> ) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC
> `
> mysql data
> `
> 1
> 2
> 3
> `
> code:
> `
> val create ="create table testOne(\n id DECIMAL(20,0)\n)WITH (\n
> 'connector.type' = 'jdbc',\n 'connector.url' =
> 'jdbc:mysql://localhost:3306/flink_db?characterEncoding=UTF-8&useSSL=false',\n
> 'connector.table' = 'testlxone',\n 'connector.username' = 'root',\n
> 'connector.password' = '123456', \n 'connector.write.flush.max-rows' = '1'
> \n)"
> System.out.println(create)
> val create2 ="create table testTwo(\n id DECIMAL(20,0)\n)WITH (\n
> 'connector.type' = 'jdbc',\n 'connector.url' =
> 'jdbc:mysql://localhost:3306/flink_db?characterEncoding=UTF-8&useSSL=false',\n
> 'connector.table' = 'testlxone',\n 'connector.username' = 'root',\n
> 'connector.password' = '123456', \n 'connector.write.flush.max-rows' = '1'
> \n)"
> val query = "INSERT INTO testTwo select * from testOne"
>
> bsTableEnv.executeSql(create)
> bsTableEnv.executeSql(create2)
> bsTableEnv.executeSql(query)
> `
>
>
--
This message was sent by Atlassian Jira
(v8.3.4#803005)