JingsongLi commented on a change in pull request #11223: [FLINK-16281][Table 
SQL / Ecosystem] parameter 'maxRetryTimes' can not work in JDBCUpsertTableSink.
URL: https://github.com/apache/flink/pull/11223#discussion_r385045512
 
 

 ##########
 File path: 
flink-connectors/flink-jdbc/src/main/java/org/apache/flink/api/java/io/jdbc/writer/AppendOnlyWriter.java
 ##########
 @@ -47,19 +50,28 @@ public AppendOnlyWriter(String insertSQL, int[] 
fieldTypes) {
 
        @Override
        public void open(Connection connection) throws SQLException {
+               this.cachedRows = new ArrayList<>();
                this.statement = connection.prepareStatement(insertSQL);
        }
 
        @Override
-       public void addRecord(Tuple2<Boolean, Row> record) throws SQLException {
+       public void addRecord(Tuple2<Boolean, Row> record) {
                checkArgument(record.f0, "Append mode can not receive 
retract/delete message.");
-               setRecordToStatement(statement, fieldTypes, record.f1);
-               statement.addBatch();
+               //deep copy, add record to buffer
+               Row row = Row.copy(record.f1);
 
 Review comment:
   See `UpsertWriter.addRecord`.
   `Tuple2<Boolean, Row> tuple2 = objectReuse ? new Tuple2<>(record.f0, 
Row.copy(record.f1)) : record;`

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to