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/05/19 13:04:29 UTC

[GitHub] [incubator-seatunnel] tobezhou33 opened a new pull request, #1926: [Feature][flink-connector-jdbc]support read Hive by JDBC

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

   <!--
   
   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.-->
   1. Support fink read hive by jdbc and hiveserver2 , add hive type inform mapping
   2. Fix that some jdbc database not support PreparedStatement.getMetaData() and throw SQLException, try catch it and use ResultSet.getMetaData()
   ## 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
   


-- 
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] CalvinKirs merged pull request #1926: [Feature][flink-connector-jdbc]support read Hive by JDBC

Posted by GitBox <gi...@apache.org>.
CalvinKirs merged PR #1926:
URL: https://github.com/apache/incubator-seatunnel/pull/1926


-- 
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 #1926: [Feature][flink-connector-jdbc]support read Hive by JDBC

Posted by GitBox <gi...@apache.org>.
BenJFan commented on code in PR #1926:
URL: https://github.com/apache/incubator-seatunnel/pull/1926#discussion_r878637282


##########
seatunnel-connectors/seatunnel-connectors-flink/seatunnel-connector-flink-jdbc/src/main/java/org/apache/seatunnel/flink/jdbc/source/JdbcSource.java:
##########
@@ -194,10 +195,12 @@ private Map<String, TypeInformation<?>> initTableField(Connection connection, St
             String databaseDialect = connection.getMetaData().getDatabaseProductName();
             PreparedStatement preparedStatement = connection.prepareStatement(selectSql, ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
             preparedStatement.setMaxRows(1);
-            ResultSetMetaData rsMeta = preparedStatement.getMetaData();
             try {
+                //support PreparedStatement getMetaData()
+                ResultSetMetaData rsMeta = preparedStatement.getMetaData();
                 return getRowInfo(rsMeta, databaseDialect);
             } catch (SQLException e) {
+                //not support PreparedStatement getMetaData() and use ResultSet getMetaData()

Review Comment:
   Not only getMetaData will throw SQLException, maybe other reason will execute this code. If that, the Exception will throw again, please make sure this logic execute in right time.



-- 
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 #1926: [Feature][flink-connector-jdbc]support read Hive by JDBC

Posted by GitBox <gi...@apache.org>.
BenJFan commented on code in PR #1926:
URL: https://github.com/apache/incubator-seatunnel/pull/1926#discussion_r878637282


##########
seatunnel-connectors/seatunnel-connectors-flink/seatunnel-connector-flink-jdbc/src/main/java/org/apache/seatunnel/flink/jdbc/source/JdbcSource.java:
##########
@@ -194,10 +195,12 @@ private Map<String, TypeInformation<?>> initTableField(Connection connection, St
             String databaseDialect = connection.getMetaData().getDatabaseProductName();
             PreparedStatement preparedStatement = connection.prepareStatement(selectSql, ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
             preparedStatement.setMaxRows(1);
-            ResultSetMetaData rsMeta = preparedStatement.getMetaData();
             try {
+                //support PreparedStatement getMetaData()
+                ResultSetMetaData rsMeta = preparedStatement.getMetaData();
                 return getRowInfo(rsMeta, databaseDialect);
             } catch (SQLException e) {
+                //not support PreparedStatement getMetaData() and use ResultSet getMetaData()

Review Comment:
   Not only getMetaData will throw SQLException, maybe other reason will execute this code. If that, the Exception will throw again, please make sure this logic execute in right time.



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