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

NullPointerException when accessing null array from postgres in JDBC Connector

    XMLWordPrintableJSON

    Details

      Description

      When trying to utilize the JDBC Connector for Postgres, I tried to read in a text array. When a row that was null was attempted to be read in, the connector threw an exception and execution stopped. It appears looking at the source code that if the row is null that it will still attempt to grab the contents out: https://github.com/apache/flink/blob/release-1.11.2/flink-connectors/flink-connector-jdbc/src/main/java/org/apache/flink/connector/jdbc/internal/converter/PostgresRowConverter.java#L97

      The stack trace is as follows:

      [error] Caused by: java.io.IOException: Couldn't access resultSet
      [error]   at org.apache.flink.connector.jdbc.table.JdbcRowDataInputFormat.nextRecord(JdbcRowDataInputFormat.java:266)
      [error]   at org.apache.flink.connector.jdbc.table.JdbcRowDataInputFormat.nextRecord(JdbcRowDataInputFormat.java:57)
      [error]   at org.apache.flink.streaming.api.functions.source.InputFormatSourceFunction.run(InputFormatSourceFunction.java:91)
      [error]   at org.apache.flink.streaming.api.operators.StreamSource.run(StreamSource.java:100)
      [error]   at org.apache.flink.streaming.api.operators.StreamSource.run(StreamSource.java:63)
      [error]   at org.apache.flink.streaming.runtime.tasks.SourceStreamTask$LegacySourceFunctionThread.run(SourceStreamTask.java:213)
      [error] Caused by: java.lang.NullPointerException
      [error]   at org.apache.flink.connector.jdbc.internal.converter.PostgresRowConverter.lambda$createPostgresArrayConverter$c06ce9f4$2(PostgresRowConverter.java:97)
      [error]   at org.apache.flink.connector.jdbc.internal.converter.AbstractJdbcRowConverter.toInternal(AbstractJdbcRowConverter.java:79)
      [error]   at org.apache.flink.connector.jdbc.table.JdbcRowDataInputFormat.nextRecord(JdbcRowDataInputFormat.java:259)
      [error]   ... 5 more 

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                dforciea Dylan Forciea
                Reporter:
                dforciea Dylan Forciea
              • Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: