You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@seatunnel.apache.org by GitBox <gi...@apache.org> on 2022/04/30 17:08:04 UTC
[GitHub] [incubator-seatunnel] gleiyu opened a new pull request, #1781: [Bug] [flink-connector-jdbc]change jdbc Source connector to get fields from jdbc meta data and support oracle database
gleiyu opened a new pull request, #1781:
URL: https://github.com/apache/incubator-seatunnel/pull/1781
<!--
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
1. support to get fields from jdbc database metadata
2. support oracle database
3. remove functions with regex
4. change extend partition function to support complex sql
related issue: https://github.com/apache/incubator-seatunnel/issues/1779 https://github.com/apache/incubator-seatunnel/issues/1709
## Check list
* [x] Code changed are covered with tests, or it does not need tests for reason:
* [x] 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)
* [x] If necessary, please update the documentation to describe the new feature. https://github.com/apache/incubator-seatunnel/tree/dev/docs
--
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] ruanwenjun commented on a diff in pull request #1781: [Bug] [flink-connector-jdbc]change jdbc Source connector to get fields from jdbc meta data and support oracle database
Posted by GitBox <gi...@apache.org>.
ruanwenjun commented on code in PR #1781:
URL: https://github.com/apache/incubator-seatunnel/pull/1781#discussion_r866502233
##########
seatunnel-connectors/seatunnel-connectors-flink/seatunnel-connector-flink-jdbc/src/main/java/org/apache/seatunnel/flink/jdbc/source/JdbcSource.java:
##########
@@ -235,11 +235,11 @@ private RowTypeInfo getRowTypeInfo() {
}
private TypeInformationMap getTypeInformationMap(String databaseDialect) {
- if ("mysql".equalsIgnoreCase(databaseDialect)) {
+ if (databaseDialect.toLowerCase().contains("mysql")) {
Review Comment:
```suggestion
if (StringUtils.containsIgnoreCase(databaseDialect, "mysql")) {
```
--
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] gleiyu commented on pull request #1781: [Bug] [flink-connector-jdbc]change jdbc Source connector to get fields from jdbc meta data and support oracle database
Posted by GitBox <gi...@apache.org>.
gleiyu commented on PR #1781:
URL: https://github.com/apache/incubator-seatunnel/pull/1781#issuecomment-1118835211
fixed getRowInfo function to get the missing field
--
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] BenJFan commented on a diff in pull request #1781: [Bug] [flink-connector-jdbc]change jdbc Source connector to get fields from jdbc meta data and support oracle database
Posted by GitBox <gi...@apache.org>.
BenJFan commented on code in PR #1781:
URL: https://github.com/apache/incubator-seatunnel/pull/1781#discussion_r866456376
##########
seatunnel-connectors/seatunnel-connectors-flink/seatunnel-connector-flink-jdbc/src/main/java/org/apache/seatunnel/flink/jdbc/source/JdbcSource.java:
##########
@@ -273,12 +234,13 @@ private RowTypeInfo getRowTypeInfo() {
return new RowTypeInfo(typeInformation, names);
}
- private TypeInformationMap getTypeInformationMap(String driverName) {
- driverName = driverName.toLowerCase();
- if (driverName.contains("mysql")) {
+ private TypeInformationMap getTypeInformationMap(String databaseDialect) {
+ if ("mysql".equalsIgnoreCase(databaseDialect)) {
return new MysqlTypeInformationMap();
- } else if (driverName.contains("postgresql")) {
+ } else if ("postgresql".equalsIgnoreCase(databaseDialect)) {
return new PostgresTypeInformationMap();
+ } else if ("oracle".equalsIgnoreCase(databaseDialect)) {
+ return new OracleTypeInformationMap();
Review Comment:
Maybe use equal is fine in here, but use contains will alway more safer.
--
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] ruanwenjun commented on a diff in pull request #1781: [Bug] [flink-connector-jdbc]change jdbc Source connector to get fields from jdbc meta data and support oracle database
Posted by GitBox <gi...@apache.org>.
ruanwenjun commented on code in PR #1781:
URL: https://github.com/apache/incubator-seatunnel/pull/1781#discussion_r866453937
##########
seatunnel-connectors/seatunnel-connectors-flink/seatunnel-connector-flink-jdbc/src/main/java/org/apache/seatunnel/flink/jdbc/source/JdbcSource.java:
##########
@@ -273,12 +234,13 @@ private RowTypeInfo getRowTypeInfo() {
return new RowTypeInfo(typeInformation, names);
}
- private TypeInformationMap getTypeInformationMap(String driverName) {
- driverName = driverName.toLowerCase();
- if (driverName.contains("mysql")) {
+ private TypeInformationMap getTypeInformationMap(String databaseDialect) {
+ if ("mysql".equalsIgnoreCase(databaseDialect)) {
return new MysqlTypeInformationMap();
- } else if (driverName.contains("postgresql")) {
+ } else if ("postgresql".equalsIgnoreCase(databaseDialect)) {
return new PostgresTypeInformationMap();
+ } else if ("oracle".equalsIgnoreCase(databaseDialect)) {
+ return new OracleTypeInformationMap();
Review Comment:
I find an answer in [stackflow](https://stackoverflow.com/questions/6097231/how-to-check-that-we-are-using-oracle-8i-database-in-jdbc), I just worry some corner case.
--
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] gleiyu commented on a diff in pull request #1781: [Bug] [flink-connector-jdbc]change jdbc Source connector to get fields from jdbc meta data and support oracle database
Posted by GitBox <gi...@apache.org>.
gleiyu commented on code in PR #1781:
URL: https://github.com/apache/incubator-seatunnel/pull/1781#discussion_r866436704
##########
seatunnel-connectors/seatunnel-connectors-flink/seatunnel-connector-flink-jdbc/src/main/java/org/apache/seatunnel/flink/jdbc/source/JdbcSource.java:
##########
@@ -273,12 +234,13 @@ private RowTypeInfo getRowTypeInfo() {
return new RowTypeInfo(typeInformation, names);
}
- private TypeInformationMap getTypeInformationMap(String driverName) {
- driverName = driverName.toLowerCase();
- if (driverName.contains("mysql")) {
+ private TypeInformationMap getTypeInformationMap(String databaseDialect) {
+ if ("mysql".equalsIgnoreCase(databaseDialect)) {
return new MysqlTypeInformationMap();
- } else if (driverName.contains("postgresql")) {
+ } else if ("postgresql".equalsIgnoreCase(databaseDialect)) {
return new PostgresTypeInformationMap();
+ } else if ("oracle".equalsIgnoreCase(databaseDialect)) {
+ return new OracleTypeInformationMap();
Review Comment:
I checked it in ojdbc source

--
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] BenJFan commented on pull request #1781: [Bug] [flink-connector-jdbc]change jdbc Source connector to get fields from jdbc meta data and support oracle database
Posted by GitBox <gi...@apache.org>.
BenJFan commented on PR #1781:
URL: https://github.com/apache/incubator-seatunnel/pull/1781#issuecomment-1118113716
Nice done. Please make build pass.
--
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] ruanwenjun merged pull request #1781: [Bug] [flink-connector-jdbc]change jdbc Source connector to get fields from jdbc meta data and support oracle database
Posted by GitBox <gi...@apache.org>.
ruanwenjun merged PR #1781:
URL: https://github.com/apache/incubator-seatunnel/pull/1781
--
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] gleiyu commented on pull request #1781: [Bug] [flink-connector-jdbc]change jdbc Source connector to get fields from jdbc meta data and support oracle database
Posted by GitBox <gi...@apache.org>.
gleiyu commented on PR #1781:
URL: https://github.com/apache/incubator-seatunnel/pull/1781#issuecomment-1118189195
please check again
--
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] ruanwenjun commented on a diff in pull request #1781: [Bug] [flink-connector-jdbc]change jdbc Source connector to get fields from jdbc meta data and support oracle database
Posted by GitBox <gi...@apache.org>.
ruanwenjun commented on code in PR #1781:
URL: https://github.com/apache/incubator-seatunnel/pull/1781#discussion_r866431270
##########
seatunnel-connectors/seatunnel-connectors-flink/seatunnel-connector-flink-jdbc/src/main/java/org/apache/seatunnel/flink/jdbc/source/JdbcSource.java:
##########
@@ -273,12 +234,13 @@ private RowTypeInfo getRowTypeInfo() {
return new RowTypeInfo(typeInformation, names);
}
- private TypeInformationMap getTypeInformationMap(String driverName) {
- driverName = driverName.toLowerCase();
- if (driverName.contains("mysql")) {
+ private TypeInformationMap getTypeInformationMap(String databaseDialect) {
+ if ("mysql".equalsIgnoreCase(databaseDialect)) {
return new MysqlTypeInformationMap();
- } else if (driverName.contains("postgresql")) {
+ } else if ("postgresql".equalsIgnoreCase(databaseDialect)) {
return new PostgresTypeInformationMap();
+ } else if ("oracle".equalsIgnoreCase(databaseDialect)) {
+ return new OracleTypeInformationMap();
Review Comment:
I didn't test on all database, but in my knowledge, the result of `getDatabaseProductName` from oracle driver may not `oracle`, it will contain other character. So it's better to use `StringUtils.containsIgnoreCase(databaseDialect, "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: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-seatunnel] gleiyu commented on pull request #1781: [Bug] [flink-connector-jdbc]change jdbc Source connector to get fields from jdbc meta data and support oracle database
Posted by GitBox <gi...@apache.org>.
gleiyu commented on PR #1781:
URL: https://github.com/apache/incubator-seatunnel/pull/1781#issuecomment-1119242448
@ruanwenjun please check again
--
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