You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@seatunnel.apache.org by "jackyyyyyssss (via GitHub)" <gi...@apache.org> on 2023/07/17 08:41:46 UTC
[GitHub] [seatunnel] jackyyyyyssss opened a new pull request, #5097: [Improve][Connector-v2][Jdbc] check url not null throw friendly message
jackyyyyyssss opened a new pull request, #5097:
URL: https://github.com/apache/seatunnel/pull/5097
<!--
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/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
if jdbc source don't set url the matchingFactories first is DB2DialectFactory acceptsURL method throw npe unfriendly so if url is null Don't run it afterwards
code modify message friendly
<!-- 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/seatunnel/blob/dev/docs/en/contribution/new-license.md)
* [ ] If necessary, please update the documentation to describe the new feature. https://github.com/apache/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/seatunnel/tree/dev/docs/en/connector-v2)
2. Update [plugin-mapping.properties](https://github.com/apache/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/seatunnel/blob/dev/seatunnel-dist/pom.xml)
* [ ] Update the [`release-note`](https://github.com/apache/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] [seatunnel] Hisoka-X commented on a diff in pull request #5097: [Improve][Connector-v2][Jdbc] check url not null throw friendly message
Posted by "Hisoka-X (via GitHub)" <gi...@apache.org>.
Hisoka-X commented on code in PR #5097:
URL: https://github.com/apache/seatunnel/pull/5097#discussion_r1271667467
##########
seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/source/JdbcSource.java:
##########
@@ -93,6 +98,19 @@ public String getPluginName() {
@Override
public void prepare(Config pluginConfig) throws PrepareFailException {
+ CheckResult checkResult =
Review Comment:
This is a little weird. We use ReadonlyConfig for now, if some required config not be setted, we should use
```java
ConfigValidator.of(config).validate(new JdbcSourceFactory().optionRule());
```
to check it.
Also this is a temporary solution. cc @hailin0 @EricJoy2048 @TyrantLucifer
--
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] [seatunnel] Hisoka-X commented on a diff in pull request #5097: [Improve][Connector-v2][Jdbc] check url not null throw friendly message
Posted by "Hisoka-X (via GitHub)" <gi...@apache.org>.
Hisoka-X commented on code in PR #5097:
URL: https://github.com/apache/seatunnel/pull/5097#discussion_r1278692039
##########
seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/source/JdbcSource.java:
##########
@@ -93,6 +98,19 @@ public String getPluginName() {
@Override
public void prepare(Config pluginConfig) throws PrepareFailException {
+ CheckResult checkResult =
Review Comment:
Please replace your code to
```java
ConfigValidator.of(config).validate(new JdbcSourceFactory().optionRule());
```
--
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] [seatunnel] liugddx commented on a diff in pull request #5097: [Improve][Connector-v2][Jdbc] check url not null throw friendly message
Posted by "liugddx (via GitHub)" <gi...@apache.org>.
liugddx commented on code in PR #5097:
URL: https://github.com/apache/seatunnel/pull/5097#discussion_r1267912054
##########
seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/dialect/JdbcDialectLoader.java:
##########
@@ -46,6 +48,8 @@ private JdbcDialectLoader() {}
* @return The loaded dialect.
*/
public static JdbcDialect load(String url, String compatibleMode) {
+ Preconditions.checkNotNull(
+ url, "Miss <Source> Jdbc config url ! Please check the config file.");
Review Comment:
Why check whether the parameter exists here?
--
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] [seatunnel] jackyyyyyssss commented on a diff in pull request #5097: [Improve][Connector-v2][Jdbc] check url not null throw friendly message
Posted by "jackyyyyyssss (via GitHub)" <gi...@apache.org>.
jackyyyyyssss commented on code in PR #5097:
URL: https://github.com/apache/seatunnel/pull/5097#discussion_r1278726381
##########
seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/source/JdbcSource.java:
##########
@@ -93,6 +98,19 @@ public String getPluginName() {
@Override
public void prepare(Config pluginConfig) throws PrepareFailException {
+ CheckResult checkResult =
Review Comment:
done PTAL @Hisoka-X
--
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] [seatunnel] jackyyyyyssss commented on pull request #5097: [Improve][Connector-v2][Jdbc] check url not null throw friendly message
Posted by "jackyyyyyssss (via GitHub)" <gi...@apache.org>.
jackyyyyyssss commented on PR #5097:
URL: https://github.com/apache/seatunnel/pull/5097#issuecomment-1643500321
> Can be checked with this method, `CheckConfigUtil.checkAllExists`.
>
> https://github.com/apache/seatunnel/blob/86b1b7e31a351dafc31404f1b3262f0bc0ee70be/seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/source/JdbcSource.java#L96
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] [seatunnel] liugddx commented on pull request #5097: [Improve][Connector-v2][Jdbc] check url not null throw friendly message
Posted by "liugddx (via GitHub)" <gi...@apache.org>.
liugddx commented on PR #5097:
URL: https://github.com/apache/seatunnel/pull/5097#issuecomment-1643505420
Wait for CI.
--
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] [seatunnel] jackyyyyyssss commented on a diff in pull request #5097: [Improve][Connector-v2][Jdbc] check url not null throw friendly message
Posted by "jackyyyyyssss (via GitHub)" <gi...@apache.org>.
jackyyyyyssss commented on code in PR #5097:
URL: https://github.com/apache/seatunnel/pull/5097#discussion_r1268868352
##########
seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/dialect/JdbcDialectLoader.java:
##########
@@ -46,6 +48,8 @@ private JdbcDialectLoader() {}
* @return The loaded dialect.
*/
public static JdbcDialect load(String url, String compatibleMode) {
+ Preconditions.checkNotNull(
+ url, "Miss <Source> Jdbc config url ! Please check the config file.");
Review Comment:
There are three reasons for this
1.if the URL is empty, the following code will throw a null pointer exception. Running the following code is meaningless
2. Check in advance that the URL provides a customized exception message that is clearer than the original error prompt. The original code runs to the final List<JdbcDialectFactory>matchingFactories=
FoundFactories. stream(). filter (f ->f. acceptsURL (URL)). collect (Collectors. toList()); Will throw a null pointer exception and display the information of DB2, causing confusion for users issues #5094
3. This is about the entry method for loading the JdbcDialect dialect. Personally, I feel that the starting check parameter of the method is more suitable
--
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] [seatunnel] TyrantLucifer commented on a diff in pull request #5097: [Improve][Connector-v2][Jdbc] check url not null throw friendly message
Posted by "TyrantLucifer (via GitHub)" <gi...@apache.org>.
TyrantLucifer commented on code in PR #5097:
URL: https://github.com/apache/seatunnel/pull/5097#discussion_r1271684571
##########
seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/source/JdbcSource.java:
##########
@@ -93,6 +98,19 @@ public String getPluginName() {
@Override
public void prepare(Config pluginConfig) throws PrepareFailException {
+ CheckResult checkResult =
Review Comment:
This logic will invoke at factory. It's a best choice.
--
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] [seatunnel] liugddx commented on pull request #5097: [Improve][Connector-v2][Jdbc] check url not null throw friendly message
Posted by "liugddx (via GitHub)" <gi...@apache.org>.
liugddx commented on PR #5097:
URL: https://github.com/apache/seatunnel/pull/5097#issuecomment-1643252371
Can be checked with this method, `CheckConfigUtil.checkAllExists`.
https://github.com/apache/seatunnel/blob/86b1b7e31a351dafc31404f1b3262f0bc0ee70be/seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/source/JdbcSource.java#L96
--
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] [seatunnel] liugddx merged pull request #5097: [Improve][Connector-v2][Jdbc] check url not null throw friendly message
Posted by "liugddx (via GitHub)" <gi...@apache.org>.
liugddx merged PR #5097:
URL: https://github.com/apache/seatunnel/pull/5097
--
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] [seatunnel] jackyyyyyssss commented on a diff in pull request #5097: [Improve][Connector-v2][Jdbc] check url not null throw friendly message
Posted by "jackyyyyyssss (via GitHub)" <gi...@apache.org>.
jackyyyyyssss commented on code in PR #5097:
URL: https://github.com/apache/seatunnel/pull/5097#discussion_r1272165143
##########
seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/source/JdbcSource.java:
##########
@@ -93,6 +98,19 @@ public String getPluginName() {
@Override
public void prepare(Config pluginConfig) throws PrepareFailException {
+ CheckResult checkResult =
Review Comment:
I found that KuduSource CassandraSource uses this method, or do you have any better suggestions for me to make some modifications @Hisoka-X
--
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] [seatunnel] jackyyyyyssss commented on a diff in pull request #5097: [Improve][Connector-v2][Jdbc] check url not null throw friendly message
Posted by "jackyyyyyssss (via GitHub)" <gi...@apache.org>.
jackyyyyyssss commented on code in PR #5097:
URL: https://github.com/apache/seatunnel/pull/5097#discussion_r1278816405
##########
seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/source/JdbcSource.java:
##########
@@ -93,6 +98,19 @@ public String getPluginName() {
@Override
public void prepare(Config pluginConfig) throws PrepareFailException {
+ CheckResult checkResult =
Review Comment:
please help rebuild ci https://github.com/apache/seatunnel/actions/workflows/backend.yml 502
--
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