You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "Jingsong Lee (Jira)" <ji...@apache.org> on 2019/12/31 07:41:00 UTC
[jira] [Comment Edited] (FLINK-15443) Use JDBC connector write
FLOAT value occur ClassCastException
[ https://issues.apache.org/jira/browse/FLINK-15443?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17005969#comment-17005969 ]
Jingsong Lee edited comment on FLINK-15443 at 12/31/19 7:40 AM:
----------------------------------------------------------------
Thanks [~yesorno] for your reporting.Yes, there is a bug when use float in JDBC sink.
NOTE:
* In flink SQL, we regard float as java float.
* But in JDBC, real type is java float, float/double are java double.
We have dealt with data very well in JDBCUtils, but mismatch in JDBCTypeUtil to match java float to JDBC float.
was (Author: lzljs3620320):
Thanks [~yesorno] for your reporting.Yes, there is a bug when use float in JDBC sink.
NOTE:
* In flink SQL, we regard float as java float.
* But in JDBC, real type is java float, float/double are java double.
We have dealt with data very well in JDBCUtils, but mismatch in JDBCTypeUtil to match java float to JDBC float.
> Use JDBC connector write FLOAT value occur ClassCastException
> -------------------------------------------------------------
>
> Key: FLINK-15443
> URL: https://issues.apache.org/jira/browse/FLINK-15443
> Project: Flink
> Issue Type: Bug
> Components: Connectors / JDBC
> Affects Versions: 1.9.1
> Environment: flink version is 1.9.1
> Reporter: Xianxun Ye
> Priority: Major
> Fix For: 1.9.2, 1.10.0
>
>
> I defined a float type field in mysql table, when I use jdbc connector write float value into db, there are ClassCastException occurs.
> {code:java}
> //代码占位符
> 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)
> {code}
>
--
This message was sent by Atlassian Jira
(v8.3.4#803005)