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

Use JDBC connector write FLOAT value occur ClassCastException

    XMLWordPrintableJSON

    Details

      Description

      I defined a float type field in mysql table, when I use jdbc connector write float value into db, there are ClassCastException occurs.

      //代码占位符
      Caused by: java.lang.ClassCastException: java.lang.Float cannot be cast to java.lang.Double, field index: 6, field value: 0.1.Caused by: java.lang.ClassCastException: java.lang.Float cannot be cast to java.lang.Double, field index: 6, field value: 0.1. Caused by: java.lang.ClassCastException: java.lang.Float cannot be cast to java.lang.Double, field index: 6, field value: 0.1.Caused by: java.lang.ClassCastException: java.lang.Float cannot be cast to java.lang.Double, field index: 6, field value: 0.1.  at org.apache.flink.api.java.io.jdbc.JDBCUtils.setField(JDBCUtils.java:106)  at org.apache.flink.api.java.io.jdbc.JDBCUtils.setRecordToStatement(JDBCUtils.java:63) at org.apache.flink.api.java.io.jdbc.writer.AppendOnlyWriter.addRecord(AppendOnlyWriter.java:56) at org.apache.flink.api.java.io.jdbc.JDBCUpsertOutputFormat.writeRecord(JDBCUpsertOutputFormat.java:144)
      
      

       

        Attachments

          Activity

            People

            • Assignee:
              lzljs3620320 Jingsong Lee
              Reporter:
              yesorno Xianxun Ye
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0h
                0h
                Logged:
                Time Spent - 40m
                40m