CalvinKirs commented on code in PR #1791:
URL: 
https://github.com/apache/incubator-seatunnel/pull/1791#discussion_r866432140


##########
seatunnel-connectors/seatunnel-connectors-flink/seatunnel-connector-flink-jdbc/src/main/java/org/apache/seatunnel/flink/jdbc/sink/JdbcSink.java:
##########
@@ -151,4 +178,44 @@ public void outputBatch(FlinkEnvironment env, DataSet<Row> 
dataSet) {
                 .finish();
         dataSet.output(format);
     }
+
+    @Override
+    public void close() throws Exception {
+        executePostSql();
+    }
+
+    private void executePreSql() {
+        if (StringUtils.isNotBlank(preSql)) {
+            LOGGER.info("Starting to execute pre sql: \n {}", preSql);
+            try {
+                executeSql(preSql);
+            } catch (SQLException e) {
+                LOGGER.error(String.format("Execute pre sql failed, pre sql is 
: \n %s \n", preSql), e);

Review Comment:
   Please pay attention to your log format, we just only use 
log.error(".....{}",preSql,e). Because printf-style format strings are 
interpreted at runtime, rather than validated by the compiler, they can contain 
errors that result in the wrong strings being created.



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