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

Connectors/JDBC LookupFunction getFieldFromResultSet BUG

    XMLWordPrintableJSON

Details

    Description

      JDBCUtils.getFieldFromResultSet(int index, int type, ResultSet set) 

      this method have a bug,  ResultSet.wasNull() reports whether the last column read had a value of SQL NULL, NOT the current column , when  one colums's value is null then all colums value behind it  will be null , even if they are not null

      bug scene:

      1. I want to join a dimension table,  column is

      Id (INT), ProjectType(INT), Desp(VARCHAR),ProjectName(VARCHAR)
      

       

      2. select from database table is

      {"Id": 10, "ProjectType":100,"Desp":NULL,"ProjectName":"ProjectName"}
      

       

      3. org.apache.flink.api.java.io.jdbc.JDBCLookupFunction#convertToRowFromResultSet return the row is 

      {"Id": 10, "ProjectType":100,"Desp":NULL,"ProjectName":NULL}

      beause  JDBCUtils.getFieldFromResultSet(int index, int type, ResultSet set)  when index = 3, ResultSet.wasNull is true, then value of column ProjectName is null

       

      this operator will influence next opertator , then i can not get the column  ProjectName.

       

      Bug Fix:

      org.apache.flink.api.java.io.jdbc.JDBCUtils#getFieldFromResultSet can fix NULL judge to fix this bug

       

      Attachments

        Issue Links

          Activity

            People

              molsion molsion mo
              molsion molsion mo
              Votes:
              0 Vote for this issue
              Watchers:
              2 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 - 20m
                  20m