[ 
https://issues.apache.org/jira/browse/FLINK-19423?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Jark Wu updated FLINK-19423:
----------------------------
    Component/s: Table SQL / Ecosystem

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

Reply via email to