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

[GitHub] [incubator-seatunnel] harveyyue opened a new pull request, #4000: [Bug][Connector-V2][Jdbc] Avoid to parse null value to long type exception

harveyyue opened a new pull request, #4000:
URL: https://github.com/apache/incubator-seatunnel/pull/4000

   Fix parsing null value exception.
   
   <!--
   
   Thank you for contributing to SeaTunnel! Please make sure that your code changes
   are covered with tests. And in case of new features or big changes
   remember to adjust the documentation.
   
   Feel free to ping committers for the review!
   
   ## Contribution Checklist
   
     - Make sure that the pull request corresponds to a [GITHUB issue](https://github.com/apache/incubator-seatunnel/issues).
   
     - Name the pull request in the form "[Feature] [component] Title of the pull request", where *Feature* can be replaced by `Hotfix`, `Bug`, etc.
   
     - Minor fixes should be named following this pattern: `[hotfix] [docs] Fix typo in README.md doc`.
   
   -->
   
   ## Purpose of this pull request
   
   <!-- Describe the purpose of this pull request. For example: This pull request adds checkstyle plugin.-->
   
   ## Check list
   
   * [ ] Code changed are covered with tests, or it does not need tests for reason:
   * [ ] If any new Jar binary package adding in your PR, please add License Notice according
     [New License Guide](https://github.com/apache/incubator-seatunnel/blob/dev/docs/en/contribution/new-license.md)
   * [ ] If necessary, please update the documentation to describe the new feature. https://github.com/apache/incubator-seatunnel/tree/dev/docs
   * [ ] If you are contributing the connector code, please check that the following files are updated:
     1. Update change log that in connector document. For more details you can refer to [connector-v2](https://github.com/apache/incubator-seatunnel/tree/dev/docs/en/connector-v2)
     2. Update [plugin-mapping.properties](https://github.com/apache/incubator-seatunnel/blob/dev/plugin-mapping.properties) and add new connector information in it
     3. Update the pom file of [seatunnel-dist](https://github.com/apache/incubator-seatunnel/blob/dev/seatunnel-dist/pom.xml)
   * [ ] Update the [`release-note`](https://github.com/apache/incubator-seatunnel/blob/dev/release-note.md).


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


[GitHub] [incubator-seatunnel] hailin0 closed pull request #4000: [Hotfix][Connector-V2][Jdbc] Fix convert null value to long type exception

Posted by "hailin0 (via GitHub)" <gi...@apache.org>.
hailin0 closed pull request #4000: [Hotfix][Connector-V2][Jdbc] Fix convert null value to long type exception
URL: https://github.com/apache/incubator-seatunnel/pull/4000


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


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

Posted by "liugddx (via GitHub)" <gi...@apache.org>.
liugddx commented on PR #4000:
URL: https://github.com/apache/incubator-seatunnel/pull/4000#issuecomment-1408107960

   To zero may not be good choice. Or direct exception?


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


[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

Posted by "EricJoy2048 (via GitHub)" <gi...@apache.org>.
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


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

Posted by "harveyyue (via GitHub)" <gi...@apache.org>.
harveyyue commented on code in PR #4000:
URL: https://github.com/apache/incubator-seatunnel/pull/4000#discussion_r1094171887


##########
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:
   done.



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


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

Posted by "harveyyue (via GitHub)" <gi...@apache.org>.
harveyyue commented on PR #4000:
URL: https://github.com/apache/incubator-seatunnel/pull/4000#issuecomment-1409608807

   > To zero may not be good choice. Or direct exception?
   
   Actually, we expect the job running successfully and print some warn message, not throw exception 


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


[GitHub] [incubator-seatunnel] hailin0 commented on pull request #4000: [Hotfix][Connector-V2][Jdbc] Fix convert null value to long type exception

Posted by "hailin0 (via GitHub)" <gi...@apache.org>.
hailin0 commented on PR #4000:
URL: https://github.com/apache/incubator-seatunnel/pull/4000#issuecomment-1554145501

   Sorry, because the code structure is outdated


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


[GitHub] [incubator-seatunnel] hailin0 commented on pull request #4000: [Hotfix][Connector-V2][Jdbc] Fix convert null value to long type exception

Posted by "hailin0 (via GitHub)" <gi...@apache.org>.
hailin0 commented on PR #4000:
URL: https://github.com/apache/incubator-seatunnel/pull/4000#issuecomment-1554148021

   This pr has been fixed
   https://github.com/apache/incubator-seatunnel/pull/4570


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


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

Posted by "hailin0 (via GitHub)" <gi...@apache.org>.
hailin0 commented on PR #4000:
URL: https://github.com/apache/incubator-seatunnel/pull/4000#issuecomment-1424402989

   update title: [Bug][Connector-V2][Jdbc] Fix ...


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


[GitHub] [incubator-seatunnel] harveyyue commented on pull request #4000: [Hotfix][Connector-V2][Jdbc] Fix convert null value to long type exception

Posted by "harveyyue (via GitHub)" <gi...@apache.org>.
harveyyue commented on PR #4000:
URL: https://github.com/apache/incubator-seatunnel/pull/4000#issuecomment-1425121600

   > update title: [Hotfix][Connector-V2][Jdbc] Fix ...
   
   done.


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