Uploaded image for project: 'Flink'
  1. Flink
  2. FLINK-22042

Fix reading bigint(20) UNSIGNED type field cannot be cast

    XMLWordPrintableJSON

Details

    • Patch

    Description

      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)

      `

       

       

      Attachments

        1. error.txt
          4 kB
          jingzi

        Issue Links

          Activity

            People

              Unassigned Unassigned
              jingzi jingzi
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - 8h
                  8h
                  Remaining:
                  Remaining Estimate - 8h
                  8h
                  Logged:
                  Time Spent - Not Specified
                  Not Specified