Uploaded image for project: 'Flink'
  1. Flink
  2. 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'

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Won't Fix
    • jdbc-3.0.0, jdbc-3.1.0
    • None
    • Connectors / JDBC
    • All current versions of flinks-jdbc-connector

    Description

      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

      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.

       

       

       

      Attachments

        1. image-2024-01-17-14-33-05-713.png
          33 kB
          blackpighe
        2. image-2024-01-17-22-18-27-781.png
          26 kB
          blackpighe

        Issue Links

          Activity

            People

              Unassigned Unassigned
              blackpighe blackpighe
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: