laglangyue commented on code in PR #4440:
URL: 
https://github.com/apache/incubator-seatunnel/pull/4440#discussion_r1153402548


##########
seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/source/JdbcSource.java:
##########
@@ -182,14 +186,18 @@ private PartitionParameter initPartitionParameter(String 
columnName, Connection
                                         "SELECT MAX(%s),MIN(%s) " + "FROM (%s) 
tt",
                                         columnName, columnName, query))) {
             if (rs.next()) {
-                max =
-                        jdbcSourceConfig.getPartitionUpperBound().isPresent()
-                                ? 
jdbcSourceConfig.getPartitionUpperBound().get()
-                                : Long.parseLong(rs.getString(1));
-                min =
-                        jdbcSourceConfig.getPartitionLowerBound().isPresent()
-                                ? 
jdbcSourceConfig.getPartitionLowerBound().get()
-                                : Long.parseLong(rs.getString(2));
+                if (rs.getString(1) != null && rs.getString(2) != null) {
+                    max =
+                            
jdbcSourceConfig.getPartitionUpperBound().isPresent()
+                                    ? 
jdbcSourceConfig.getPartitionUpperBound().get()
+                                    : Long.parseLong(rs.getString(1));
+                    min =
+                            
jdbcSourceConfig.getPartitionLowerBound().isPresent()
+                                    ? 
jdbcSourceConfig.getPartitionLowerBound().get()
+                                    : Long.parseLong(rs.getString(2));
+                } else {
+                    return null;

Review Comment:
   return null is ugly



##########
seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/source/JdbcSource.java:
##########
@@ -217,6 +225,11 @@ private PartitionParameter 
initPartitionParameterAndExtendSql(Connection connect
             }
             PartitionParameter partitionParameter =
                     initPartitionParameter(partitionColumn, connection);
+            if (partitionParameter == null) {
+                LOG.info(
+                        "The partition_column parameter is configured, but the 
result set is empty");
+                return null;

Review Comment:
   is there has some more better way solve the problem, because return null is 
ugly



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