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

[jira] [Commented] (FLINK-19423) Primary key position cause JDBC SQL upsert sink ArrayIndexOutOfBoundsException

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

limbo commented on FLINK-19423:
-------------------------------

I'm trying to fix the code, and do some test, but find that the table API not support DELETE , is there any function to test this case

> Primary key position cause JDBC SQL upsert sink ArrayIndexOutOfBoundsException
> ------------------------------------------------------------------------------
>
>                 Key: FLINK-19423
>                 URL: https://issues.apache.org/jira/browse/FLINK-19423
>             Project: Flink
>          Issue Type: Bug
>          Components: Connectors / JDBC, Table SQL / Ecosystem
>    Affects Versions: 1.11.1
>            Reporter: limbo
>            Priority: Major
>
> We found  that the primary key position can cause  ArrayIndexOutOfBoundsException
> the sink like that( the primary key select the position of 1, 3):
> {code:java}
> CREATE TABLE `test`(
>   col1 STRING, 
>   col2 STRING, 
>   col3 STRING, 
>   PRIMARY KEY (col1, col3) NOT ENFORCED ) WITH (
>   'connector' = 'jdbc',
>   ...
> ){code}
> when the DELETE (cdc message) come , it will raise ArrayIndexOutOfBoundsException:
> {code:java}
> Caused by: java.lang.RuntimeException: Writing records to JDBC failed.    ... 10 moreCaused by: java.lang.ArrayIndexOutOfBoundsException: 2    at org.apache.flink.table.data.GenericRowData.getString(GenericRowData.java:169)    at org.apache.flink.table.data.RowData.lambda$createFieldGetter$245ca7d1$1(RowData.java:310)    at org.apache.flink.connector.jdbc.table.JdbcDynamicOutputFormatBuilder.getPrimaryKey(JdbcDynamicOutputFormatBuilder.java:216)    at org.apache.flink.connector.jdbc.table.JdbcDynamicOutputFormatBuilder.lambda$createRowKeyExtractor$7(JdbcDynamicOutputFormatBuilder.java:193)    at org.apache.flink.connector.jdbc.table.JdbcDynamicOutputFormatBuilder.lambda$createKeyedRowExecutor$3fd497bb$1(JdbcDynamicOutputFormatBuilder.java:128)    at org.apache.flink.connector.jdbc.internal.executor.KeyedBatchStatementExecutor.executeBatch(KeyedBatchStatementExecutor.java:71)    at org.apache.flink.connector.jdbc.internal.executor.BufferReduceStatementExecutor.executeBatch(BufferReduceStatementExecutor.java:99)    at org.apache.flink.connector.jdbc.internal.JdbcBatchingOutputFormat.attemptFlush(JdbcBatchingOutputFormat.java:200)    at org.apache.flink.connector.jdbc.internal.JdbcBatchingOutputFormat.flush(JdbcBatchingOutputFormat.java:171)    ... 8 more
> {code}
>  



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