You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@kyuubi.apache.org by GitBox <gi...@apache.org> on 2022/12/06 16:19:22 UTC

[GitHub] [incubator-kyuubi] cfmcgrady opened a new pull request, #3916: [WIP][KYUUBI #3915] Client support detecting ResultSet codec

cfmcgrady opened a new pull request, #3916:
URL: https://github.com/apache/incubator-kyuubi/pull/3916

   <!--
   Thanks for sending a pull request!
   
   Here are some tips for you:
     1. If this is your first time, please read our contributor guidelines: https://kyuubi.readthedocs.io/en/latest/community/CONTRIBUTING.html
     2. If the PR is related to an issue in https://github.com/apache/incubator-kyuubi/issues, add '[KYUUBI #XXXX]' in your PR title, e.g., '[KYUUBI #XXXX] Your PR title ...'.
     3. If the PR is unfinished, add '[WIP]' in your PR title, e.g., '[WIP][KYUUBI #XXXX] Your PR title ...'.
   -->
   
   ### _Why are the changes needed?_
   <!--
   Please clarify why the changes are needed. For instance,
     1. If you add a feature, you can talk about the use case of it.
     2. If you fix a bug, you can clarify why it is a bug.
   -->
   
   
   ### _How was this patch tested?_
   - [ ] Add some test cases that check the changes thoroughly including negative and positive cases if possible
   
   - [ ] Add screenshots for manual tests if appropriate
   
   - [ ] [Run test](https://kyuubi.apache.org/docs/latest/develop_tools/testing.html#running-tests) locally before make a pull request
   


-- 
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: notifications-unsubscribe@kyuubi.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org


[GitHub] [incubator-kyuubi] cfmcgrady commented on a diff in pull request #3916: [KYUUBI #3915] Client support detecting ResultSet codec

Posted by GitBox <gi...@apache.org>.
cfmcgrady commented on code in PR #3916:
URL: https://github.com/apache/incubator-kyuubi/pull/3916#discussion_r1046643728


##########
kyuubi-hive-jdbc/src/main/java/org/apache/kyuubi/jdbc/hive/KyuubiStatement.java:
##########
@@ -743,4 +763,57 @@ public String getQueryId() throws SQLException {
   public void setInPlaceUpdateStream(InPlaceUpdateStream stream) {
     this.inPlaceUpdateStream = stream;
   }
+
+  private TGetResultSetMetadataResp getResultSetMetadata() throws SQLException {
+    try {
+      TGetResultSetMetadataReq metadataReq = new TGetResultSetMetadataReq(stmtHandle);
+      // TODO need session handle
+      TGetResultSetMetadataResp metadataResp;
+      metadataResp = client.GetResultSetMetadata(metadataReq);
+      Utils.verifySuccess(metadataResp.getStatus());
+      return metadataResp;
+    } catch (SQLException eS) {
+      throw eS; // rethrow the SQLException as is
+    } catch (Exception ex) {
+      throw new KyuubiSQLException("Could not create ResultSet: " + ex.getMessage(), ex);
+    }
+  }
+
+  private void parseMetadata(
+      TGetResultSetMetadataResp metadataResp,
+      List<String> columnNames,
+      List<TTypeId> columnTypes,
+      List<JdbcColumnAttributes> columnAttributes)
+      throws KyuubiSQLException {
+    TTableSchema schema = metadataResp.getSchema();
+    if (schema == null || !schema.isSetColumns()) {
+      throw new KyuubiSQLException("the result set schema is null");
+    }
+
+    // parse kyuubi hint
+    List<String> infoMessages = metadataResp.getStatus().getInfoMessages();
+    if (infoMessages != null) {
+      metadataResp
+          .getStatus()
+          .getInfoMessages()
+          .forEach(
+              line -> {
+                String[] keyValue = line.split("=");
+                String key = keyValue[0];
+                String value = keyValue[1];

Review Comment:
   Log a warning message if the input does not contain "="



-- 
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: notifications-unsubscribe@kyuubi.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org


[GitHub] [incubator-kyuubi] pan3793 commented on pull request #3916: [KYUUBI #3915] Client support detecting ResultSet codec

Posted by GitBox <gi...@apache.org>.
pan3793 commented on PR #3916:
URL: https://github.com/apache/incubator-kyuubi/pull/3916#issuecomment-1347977198

   Thanks, merging to master


-- 
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: notifications-unsubscribe@kyuubi.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org


[GitHub] [incubator-kyuubi] pan3793 commented on a diff in pull request #3916: [KYUUBI #3915] Client support detecting ResultSet codec

Posted by GitBox <gi...@apache.org>.
pan3793 commented on code in PR #3916:
URL: https://github.com/apache/incubator-kyuubi/pull/3916#discussion_r1045709884


##########
kyuubi-hive-jdbc/src/main/java/org/apache/kyuubi/jdbc/hive/KyuubiStatement.java:
##########
@@ -743,4 +763,57 @@ public String getQueryId() throws SQLException {
   public void setInPlaceUpdateStream(InPlaceUpdateStream stream) {
     this.inPlaceUpdateStream = stream;
   }
+
+  private TGetResultSetMetadataResp getResultSetMetadata() throws SQLException {
+    try {
+      TGetResultSetMetadataReq metadataReq = new TGetResultSetMetadataReq(stmtHandle);
+      // TODO need session handle
+      TGetResultSetMetadataResp metadataResp;
+      metadataResp = client.GetResultSetMetadata(metadataReq);
+      Utils.verifySuccess(metadataResp.getStatus());
+      return metadataResp;
+    } catch (SQLException eS) {
+      throw eS; // rethrow the SQLException as is
+    } catch (Exception ex) {
+      throw new KyuubiSQLException("Could not create ResultSet: " + ex.getMessage(), ex);
+    }
+  }
+
+  private void parseMetadata(
+      TGetResultSetMetadataResp metadataResp,
+      List<String> columnNames,
+      List<TTypeId> columnTypes,
+      List<JdbcColumnAttributes> columnAttributes)
+      throws KyuubiSQLException {
+    TTableSchema schema = metadataResp.getSchema();
+    if (schema == null || !schema.isSetColumns()) {
+      throw new KyuubiSQLException("the result set schema is null");
+    }
+
+    // parse kyuubi hint
+    List<String> infoMessages = metadataResp.getStatus().getInfoMessages();
+    if (infoMessages != null) {
+      metadataResp
+          .getStatus()
+          .getInfoMessages()
+          .forEach(
+              line -> {
+                String[] keyValue = line.split("=");
+                String key = keyValue[0];
+                String value = keyValue[1];

Review Comment:
   will cause NPE if server return some message does not contains '='



-- 
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: notifications-unsubscribe@kyuubi.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org


[GitHub] [incubator-kyuubi] codecov-commenter commented on pull request #3916: [WIP][KYUUBI #3915] Client support detecting ResultSet codec

Posted by GitBox <gi...@apache.org>.
codecov-commenter commented on PR #3916:
URL: https://github.com/apache/incubator-kyuubi/pull/3916#issuecomment-1340374285

   # [Codecov](https://codecov.io/gh/apache/incubator-kyuubi/pull/3916?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#3916](https://codecov.io/gh/apache/incubator-kyuubi/pull/3916?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (7162363) into [master](https://codecov.io/gh/apache/incubator-kyuubi/commit/5e6c56abf429691db82e5b2824dab08795125662?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (5e6c56a) will **decrease** coverage by `0.06%`.
   > The diff coverage is `35.00%`.
   
   ```diff
   @@             Coverage Diff              @@
   ##             master    #3916      +/-   ##
   ============================================
   - Coverage     51.90%   51.83%   -0.07%     
     Complexity       13       13              
   ============================================
     Files           508      508              
     Lines         29029    29110      +81     
     Branches       3985     3989       +4     
   ============================================
   + Hits          15068    15090      +22     
   - Misses        12535    12594      +59     
     Partials       1426     1426              
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/incubator-kyuubi/pull/3916?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [.../scala/org/apache/kyuubi/operation/Operation.scala](https://codecov.io/gh/apache/incubator-kyuubi/pull/3916/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-a3l1dWJpLWNvbW1vbi9zcmMvbWFpbi9zY2FsYS9vcmcvYXBhY2hlL2t5dXViaS9vcGVyYXRpb24vT3BlcmF0aW9uLnNjYWxh) | `100.00% <ø> (ø)` | |
   | [...apache/kyuubi/service/AbstractBackendService.scala](https://codecov.io/gh/apache/incubator-kyuubi/pull/3916/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-a3l1dWJpLWNvbW1vbi9zcmMvbWFpbi9zY2FsYS9vcmcvYXBhY2hlL2t5dXViaS9zZXJ2aWNlL0Fic3RyYWN0QmFja2VuZFNlcnZpY2Uuc2NhbGE=) | `98.36% <ø> (ø)` | |
   | [...he/kyuubi/jdbc/hive/KyuubiArrowQueryResultSet.java](https://codecov.io/gh/apache/incubator-kyuubi/pull/3916/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-a3l1dWJpLWhpdmUtamRiYy9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUva3l1dWJpL2pkYmMvaGl2ZS9LeXV1YmlBcnJvd1F1ZXJ5UmVzdWx0U2V0LmphdmE=) | `0.00% <0.00%> (ø)` | |
   | [.../kyuubi/operation/KyuubiApplicationOperation.scala](https://codecov.io/gh/apache/incubator-kyuubi/pull/3916/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-a3l1dWJpLXNlcnZlci9zcmMvbWFpbi9zY2FsYS9vcmcvYXBhY2hlL2t5dXViaS9vcGVyYXRpb24vS3l1dWJpQXBwbGljYXRpb25PcGVyYXRpb24uc2NhbGE=) | `40.90% <0.00%> (-6.46%)` | :arrow_down: |
   | [.../org/apache/kyuubi/operation/KyuubiOperation.scala](https://codecov.io/gh/apache/incubator-kyuubi/pull/3916/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-a3l1dWJpLXNlcnZlci9zcmMvbWFpbi9zY2FsYS9vcmcvYXBhY2hlL2t5dXViaS9vcGVyYXRpb24vS3l1dWJpT3BlcmF0aW9uLnNjYWxh) | `70.23% <0.00%> (-2.61%)` | :arrow_down: |
   | [...rg/apache/kyuubi/server/BackendServiceMetric.scala](https://codecov.io/gh/apache/incubator-kyuubi/pull/3916/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-a3l1dWJpLXNlcnZlci9zcmMvbWFpbi9zY2FsYS9vcmcvYXBhY2hlL2t5dXViaS9zZXJ2ZXIvQmFja2VuZFNlcnZpY2VNZXRyaWMuc2NhbGE=) | `93.44% <ø> (ø)` | |
   | [...a/org/apache/kyuubi/jdbc/hive/KyuubiStatement.java](https://codecov.io/gh/apache/incubator-kyuubi/pull/3916/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-a3l1dWJpLWhpdmUtamRiYy9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUva3l1dWJpL2pkYmMvaGl2ZS9LeXV1YmlTdGF0ZW1lbnQuamF2YQ==) | `23.14% <2.00%> (-3.21%)` | :arrow_down: |
   | [...a/org/apache/kyuubi/service/TFrontendService.scala](https://codecov.io/gh/apache/incubator-kyuubi/pull/3916/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-a3l1dWJpLWNvbW1vbi9zcmMvbWFpbi9zY2FsYS9vcmcvYXBhY2hlL2t5dXViaS9zZXJ2aWNlL1RGcm9udGVuZFNlcnZpY2Uuc2NhbGE=) | `90.14% <50.00%> (-0.85%)` | :arrow_down: |
   | [...uubi/engine/spark/operation/ExecuteStatement.scala](https://codecov.io/gh/apache/incubator-kyuubi/pull/3916/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZXh0ZXJuYWxzL2t5dXViaS1zcGFyay1zcWwtZW5naW5lL3NyYy9tYWluL3NjYWxhL29yZy9hcGFjaGUva3l1dWJpL2VuZ2luZS9zcGFyay9vcGVyYXRpb24vRXhlY3V0ZVN0YXRlbWVudC5zY2FsYQ==) | `79.48% <77.77%> (-0.15%)` | :arrow_down: |
   | [...kyuubi/engine/spark/operation/SparkOperation.scala](https://codecov.io/gh/apache/incubator-kyuubi/pull/3916/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZXh0ZXJuYWxzL2t5dXViaS1zcGFyay1zcWwtZW5naW5lL3NyYy9tYWluL3NjYWxhL29yZy9hcGFjaGUva3l1dWJpL2VuZ2luZS9zcGFyay9vcGVyYXRpb24vU3BhcmtPcGVyYXRpb24uc2NhbGE=) | `74.16% <100.00%> (+1.60%)` | :arrow_up: |
   | ... and [14 more](https://codecov.io/gh/apache/incubator-kyuubi/pull/3916/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
   
   :mega: We’re building smart automated test selection to slash your CI/CD build times. [Learn more](https://about.codecov.io/iterative-testing/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   


-- 
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: notifications-unsubscribe@kyuubi.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org


[GitHub] [incubator-kyuubi] pan3793 closed pull request #3916: [KYUUBI #3915] Client support detecting ResultSet codec

Posted by GitBox <gi...@apache.org>.
pan3793 closed pull request #3916: [KYUUBI #3915] Client support detecting ResultSet codec
URL: https://github.com/apache/incubator-kyuubi/pull/3916


-- 
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: notifications-unsubscribe@kyuubi.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org


[GitHub] [incubator-kyuubi] pan3793 commented on a diff in pull request #3916: [KYUUBI #3915] Client support detecting ResultSet codec

Posted by GitBox <gi...@apache.org>.
pan3793 commented on code in PR #3916:
URL: https://github.com/apache/incubator-kyuubi/pull/3916#discussion_r1046709270


##########
kyuubi-hive-jdbc/src/main/java/org/apache/kyuubi/jdbc/hive/KyuubiStatement.java:
##########
@@ -796,15 +796,15 @@ private void parseMetadata(
       metadataResp
           .getStatus()
           .getInfoMessages()
+          .stream()
+          .filter(hint -> Utils.isKyuubiOperationHint(hint))
           .forEach(
               line -> {
                 String[] keyValue = line.split("=");
                 if (keyValue.length == 2) {
                   String key = keyValue[0];

Review Comment:
   since the pattern is CASE_INSENSITIVE, we need to normalize the key here, e.g. to lower/upper case, and the split should always reserve 2 parts, then assert is more suitable 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: notifications-unsubscribe@kyuubi.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org