ruanwenjun commented on a change in pull request #1544:
URL: 
https://github.com/apache/incubator-seatunnel/pull/1544#discussion_r833391945



##########
File path: 
seatunnel-connectors/seatunnel-connectors-flink/seatunnel-connector-flink-jdbc/src/main/java/org/apache/seatunnel/flink/source/JdbcSource.java
##########
@@ -71,19 +80,17 @@
     private String password;
     private int fetchSize = DEFAULT_FETCH_SIZE;
     private Set<String> fields;
+    private int parallelism = 1;

Review comment:
       I find in the former code, the default value of parallelism in flink is 
-1. Why we change to 1?

##########
File path: 
seatunnel-connectors/seatunnel-connectors-flink/seatunnel-connector-flink-jdbc/src/main/java/org/apache/seatunnel/flink/source/JdbcSource.java
##########
@@ -116,41 +128,86 @@ public void prepare(FlinkEnvironment env) {
         if (config.hasPath(SOURCE_FETCH_SIZE)) {
             fetchSize = config.getInt(SOURCE_FETCH_SIZE);
         }
+        if (config.hasPath(PARALLELISM)) {
+            parallelism = config.getInt(PARALLELISM);
+        } else {
+            parallelism = env.getBatchEnvironment().getParallelism();
+        }
+        try {
+            Class.forName(driverName);
+            Connection connection = DriverManager.getConnection(dbUrl, 
username, password);

Review comment:
       The connection has not been closed here, it's better to close the 
connection in the finally or use try(Connection connection = xx)




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