You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@seatunnel.apache.org by "EricJoy2048 (via GitHub)" <gi...@apache.org> on 2023/01/31 05:55:40 UTC

[GitHub] [incubator-seatunnel] EricJoy2048 commented on a diff in pull request #4000: [Bug][Connector-V2][Jdbc] Avoid to parse null value to long type exception

EricJoy2048 commented on code in PR #4000:
URL: https://github.com/apache/incubator-seatunnel/pull/4000#discussion_r1091480527


##########
seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/source/JdbcSource.java:
##########
@@ -163,10 +163,10 @@ private PartitionParameter initPartitionParameter(String columnName, Connection
             if (rs.next()) {
                 max = jdbcSourceOptions.getPartitionUpperBound().isPresent() ?
                     jdbcSourceOptions.getPartitionUpperBound().get() :
-                    Long.parseLong(rs.getString(1));
+                    rs.getString(1) == null ? 0L : Long.parseLong(rs.getString(1));

Review Comment:
   I suggest use `Long.MAX_VALUE` and `Long.MIN_VALUE` when `rs.getString(1) == null` or `rs.getString(2) == null `. And then we should add warning log too.



-- 
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: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org