You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "ASF GitHub Bot (Jira)" <ji...@apache.org> on 2022/05/27 03:59:00 UTC
[jira] [Updated] (FLINK-27807) The improvement of addBatch is empty when jdbc batch submit
[ https://issues.apache.org/jira/browse/FLINK-27807?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
ASF GitHub Bot updated FLINK-27807:
-----------------------------------
Labels: pull-request-available (was: )
> The improvement of addBatch is empty when jdbc batch submit
> -----------------------------------------------------------
>
> Key: FLINK-27807
> URL: https://issues.apache.org/jira/browse/FLINK-27807
> Project: Flink
> Issue Type: Improvement
> Components: Connectors / JDBC
> Affects Versions: 1.15.0, 1.14.4
> Reporter: shmily
> Priority: Minor
> Labels: pull-request-available
>
> Extending the DM database dialect through JDBC, when executing Upsert semantics, a "parameter not bound" exception will be thrown, and it is found that the following code can be improved:
> {code:java}
> for (Map.Entry<RowData, Tuple2<Boolean, RowData>> entry : reduceBuffer.entrySet()) {
> if (entry.getValue().f0) {
> upsertExecutor.addToBatch(entry.getValue().f1);
> } else {
> // delete by key
> deleteExecutor.addToBatch(entry.getKey());
> }
> }
> upsertExecutor.executeBatch();
> deleteExecutor.executeBatch();
> reduceBuffer.clear();{code}
> That is to say, when the size of reduceBuffer is 1, only one of the if-else statement blocks is executed, which will cause
> {code:java}
> upsertExecutor().executeBatch() {code}
> or
> {code:java}
> deleteExecutor.executeBatch(){code}
> to have an empty batch executed, however, this will cause some jdbc driver implementations to throw exceptions, as described above
--
This message was sent by Atlassian Jira
(v8.20.7#820007)