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

Dylan Forciea commented on FLINK-19771:
---------------------------------------

I wouldn't mind taking this one on... but I would have a question about adding 
unit tests for this bug. Digging in, I don't see anything that directly tests 
out the {{PostgresRowConverter}}. It looks like the existing tests only test 
the dialect itself, and otherwise just uses Derby.

Should a unit test for {{PostgresRowConverter}} be added? Or did I miss seeing 
an end to end test that spins up a postgres container to perform validation?

> 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)

Reply via email to