shmily created FLINK-27807:
------------------------------

             Summary: 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.14.4, 1.15.0
            Reporter: shmily


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)

Reply via email to