You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "blackpighe (Jira)" <ji...@apache.org> on 2024/01/17 07:48:00 UTC

[jira] [Commented] (FLINK-34128) oracle jdbc connector bug. When the oracle table field is of type float, the type obtained by jdbc is bigdecimal. error is 'java.lang.ClassCastException: java.math.BigDecimal cannot be cast to java.lang.Float'

    [ https://issues.apache.org/jira/browse/FLINK-34128?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17807613#comment-17807613 ] 

blackpighe commented on FLINK-34128:
------------------------------------

https://github.com/apache/flink-connector-jdbc/pull/91

> oracle jdbc connector bug. When the oracle table field is of type float, the type obtained by jdbc is bigdecimal. error is  'java.lang.ClassCastException: java.math.BigDecimal cannot be cast to java.lang.Float'
> ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: FLINK-34128
>                 URL: https://issues.apache.org/jira/browse/FLINK-34128
>             Project: Flink
>          Issue Type: Bug
>          Components: Connectors / JDBC
>    Affects Versions: jdbc-3.0.0, jdbc-3.1.0
>         Environment: All current versions of flinks-jdbc-connector
>            Reporter: blackpighe
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: jdbc-3.0.0, jdbc-3.1.1
>
>         Attachments: image-2024-01-17-14-33-05-713.png
>
>
> create oracle table contain float field and execute sql occurred error.
> java.lang.ClassCastException: java.math.BigDecimal cannot be cast to java.lang.Float
>  
> Locate the cause of the error:
> org/apache/flink/connector/jdbc/converter/AbstractJdbcRowConverter.java
> !image-2024-01-17-14-33-05-713.png!
> Object field = resultSet.getObject(pos + 1);
> this method for oracle jdbc produce bug. 
> expect:float value
> actual: bigdecimal value
>  
> Suggest this modification:
> Object field =
> resultSet.getObject(pos + 1, rowType.getTypeAt(pos).getDefaultConversion());
> Specify the type explicitly according to the schema.but mock test case is error.Let's talk about it and see what we can do about it.
>  
>  
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)