You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "Nicholas Jiang (Jira)" <ji...@apache.org> on 2020/10/23 13:32:00 UTC

[jira] [Comment Edited] (FLINK-19771) NullPointerException when accessing null array from postgres in JDBC Connector

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

Nicholas Jiang edited comment on FLINK-19771 at 10/23/20, 1:31 PM:
-------------------------------------------------------------------

[~dforciea], IMO, PostgresRowConverter#createPostgresArrayConverter doesn't check whether the pgArray is null. If pgArray is null, the converter should return null. Therefore, createPostgresArrayConverter should the check whether the pgArray is null.
cc [~jark], [~Leonard Xu]


was (Author: nicholasjiang):
[~dforciea], IMO, PostgresRowConverter#createPostgresArrayConverter doesn't check whether the pgArray is null. If pgArray is null, the converter should return null. Therefore, createPostgresArrayConverter should the check whether the pgArray is null.
cc [~jark][~Leonard Xu]

> NullPointerException when accessing null array from postgres in JDBC Connector
> ------------------------------------------------------------------------------
>
>                 Key: FLINK-19771
>                 URL: https://issues.apache.org/jira/browse/FLINK-19771
>             Project: Flink
>          Issue Type: Bug
>          Components: Connectors / JDBC
>    Affects Versions: 1.11.2
>            Reporter: Dylan Forciea
>            Priority: Major
>
> 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:
> {code:java}
> [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 {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)