snuyanzin commented on code in PR #100:
URL: 
https://github.com/apache/flink-connector-jdbc/pull/100#discussion_r1539277654


##########
flink-connector-jdbc/src/main/java/org/apache/flink/connector/jdbc/internal/executor/TableBufferedStatementExecutor.java:
##########
@@ -52,11 +52,13 @@ public void addToBatch(RowData record) throws SQLException {
 
     @Override
     public void executeBatch() throws SQLException {
-        for (RowData value : buffer) {
-            statementExecutor.addToBatch(value);
+        if (!buffer.isEmpty()) {
+            for (RowData value : buffer) {
+                statementExecutor.addToBatch(value);
+            }
+            statementExecutor.executeBatch();
+            buffer.clear();
         }
-        statementExecutor.executeBatch();
-        buffer.clear();
     }

Review Comment:
   From one side yes from another side current change is done in a way of 
already existing style like e.g. similar existing code for 
   
`org.apache.flink.connector.jdbc.internal.executor.InsertOrUpdateJdbcExecutor#executeBatch`
   may be we need to refactor all of them at some point



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to