You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@kyuubi.apache.org by "wForget (via GitHub)" <gi...@apache.org> on 2025/02/14 07:22:36 UTC

[PR] [KYUUBI #6918] Cache client ipAddress in kyuubi jdbc connection [kyuubi]

wForget opened a new pull request, #6919:
URL: https://github.com/apache/kyuubi/pull/6919

   <!--
   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/master/contributing/code/index.html
     2. If the PR is related to an issue in https://github.com/apache/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?
   
   add Utils.CLIENT_IP_ADDRESS to cache local ipAddress
   
   closes #6918
   
   ### How was this patch tested?
   
   minor fix
   
   ### Was this patch authored or co-authored using generative AI tooling?
   
   No
   


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


Re: [PR] [KYUUBI #6918] Cache client ipAddress in kyuubi jdbc connection [kyuubi]

Posted by "pan3793 (via GitHub)" <gi...@apache.org>.
pan3793 commented on code in PR #6919:
URL: https://github.com/apache/kyuubi/pull/6919#discussion_r1955795637


##########
kyuubi-hive-jdbc/src/main/java/org/apache/kyuubi/jdbc/hive/Utils.java:
##########
@@ -68,6 +68,19 @@ public class Utils {
   public static final Pattern KYUUBI_OPERATION_HINT_PATTERN =
       Pattern.compile("^__kyuubi_operation_result_(.*)__=(.*)", Pattern.CASE_INSENSITIVE);
 
+  public static final String CLIENT_IP_ADDRESS;
+
+  static {
+    String localIpAddress;
+    try {
+      localIpAddress = InetAddress.getLocalHost().getHostAddress();
+    } catch (UnknownHostException e) {
+      localIpAddress = "unknown";
+      LOG.warn("Error getting Kyuubi local client ip address", e);
+    }
+    CLIENT_IP_ADDRESS = localIpAddress;

Review Comment:
   ```suggestion
       String addr;
       try {
         addr = InetAddress.getLocalHost().getHostAddress();
       } catch (UnknownHostException e) {
         LOG.warn("Error getting Kyuubi local client IP address", e);
       }
       if (addr != null && !addr.isEmpty) {
         CLIENT_IP_ADDRESS = addr;
       } else {
         CLIENT_IP_ADDRESS = "unknown";
       }
   ```



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


Re: [PR] [KYUUBI #6918] Cache client ipAddress in kyuubi jdbc connection [kyuubi]

Posted by "wForget (via GitHub)" <gi...@apache.org>.
wForget commented on PR #6919:
URL: https://github.com/apache/kyuubi/pull/6919#issuecomment-2659270732

   Thank you, merged to master/1.10.2


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


Re: [PR] [KYUUBI #6918] Cache client ipAddress in kyuubi jdbc connection [kyuubi]

Posted by "pan3793 (via GitHub)" <gi...@apache.org>.
pan3793 commented on code in PR #6919:
URL: https://github.com/apache/kyuubi/pull/6919#discussion_r1955795637


##########
kyuubi-hive-jdbc/src/main/java/org/apache/kyuubi/jdbc/hive/Utils.java:
##########
@@ -68,6 +68,19 @@ public class Utils {
   public static final Pattern KYUUBI_OPERATION_HINT_PATTERN =
       Pattern.compile("^__kyuubi_operation_result_(.*)__=(.*)", Pattern.CASE_INSENSITIVE);
 
+  public static final String CLIENT_IP_ADDRESS;
+
+  static {
+    String localIpAddress;
+    try {
+      localIpAddress = InetAddress.getLocalHost().getHostAddress();
+    } catch (UnknownHostException e) {
+      localIpAddress = "unknown";
+      LOG.warn("Error getting Kyuubi local client ip address", e);
+    }
+    CLIENT_IP_ADDRESS = localIpAddress;

Review Comment:
   ```suggestion
       String addr;
       try {
         addr = InetAddress.getLocalHost().getHostAddress();
       } catch (UnknownHostException e) {
         LOG.warn("Error getting Kyuubi local client IP address", e);
       }
       if (addr != null && !addr.isEmpty) {
         CLIENT_IP_ADDRESS = addr;
       } else {
         CLIENT_IP_ADDRESS = "unknown";
       }
   ```



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


Re: [PR] [KYUUBI #6918] Cache client ipAddress in kyuubi jdbc connection [kyuubi]

Posted by "pan3793 (via GitHub)" <gi...@apache.org>.
pan3793 commented on code in PR #6919:
URL: https://github.com/apache/kyuubi/pull/6919#discussion_r1955748106


##########
kyuubi-hive-jdbc/src/main/java/org/apache/kyuubi/jdbc/hive/Utils.java:
##########
@@ -68,6 +68,18 @@ public class Utils {
   public static final Pattern KYUUBI_OPERATION_HINT_PATTERN =
       Pattern.compile("^__kyuubi_operation_result_(.*)__=(.*)", Pattern.CASE_INSENSITIVE);
 
+  public static final String CLIENT_IP_ADDRESS;
+
+  static {
+    String localIpAddress = null;
+    try {
+      localIpAddress = InetAddress.getLocalHost().getHostAddress();
+    } catch (UnknownHostException e) {
+      LOG.debug("Error getting Kyuubi local client ip address", e);
+    }
+    CLIENT_IP_ADDRESS = localIpAddress;

Review Comment:
   sgtm



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


Re: [PR] [KYUUBI #6918] Cache client ipAddress in kyuubi jdbc connection [kyuubi]

Posted by "pan3793 (via GitHub)" <gi...@apache.org>.
pan3793 commented on code in PR #6919:
URL: https://github.com/apache/kyuubi/pull/6919#discussion_r1955742791


##########
kyuubi-hive-jdbc/src/main/java/org/apache/kyuubi/jdbc/hive/Utils.java:
##########
@@ -68,6 +68,18 @@ public class Utils {
   public static final Pattern KYUUBI_OPERATION_HINT_PATTERN =
       Pattern.compile("^__kyuubi_operation_result_(.*)__=(.*)", Pattern.CASE_INSENSITIVE);
 
+  public static final String CLIENT_IP_ADDRESS;
+
+  static {
+    String localIpAddress = null;
+    try {
+      localIpAddress = InetAddress.getLocalHost().getHostAddress();
+    } catch (UnknownHostException e) {
+      LOG.debug("Error getting Kyuubi local client ip address", e);
+    }
+    CLIENT_IP_ADDRESS = localIpAddress;

Review Comment:
   suppress `null` propagation as much as possible



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


Re: [PR] [KYUUBI #6918] Cache client ipAddress in kyuubi jdbc connection [kyuubi]

Posted by "pan3793 (via GitHub)" <gi...@apache.org>.
pan3793 commented on code in PR #6919:
URL: https://github.com/apache/kyuubi/pull/6919#discussion_r1955741775


##########
kyuubi-hive-jdbc/src/main/java/org/apache/kyuubi/jdbc/hive/Utils.java:
##########
@@ -68,6 +68,18 @@ public class Utils {
   public static final Pattern KYUUBI_OPERATION_HINT_PATTERN =
       Pattern.compile("^__kyuubi_operation_result_(.*)__=(.*)", Pattern.CASE_INSENSITIVE);
 
+  public static final String CLIENT_IP_ADDRESS;
+
+  static {
+    String localIpAddress = null;
+    try {
+      localIpAddress = InetAddress.getLocalHost().getHostAddress();
+    } catch (UnknownHostException e) {
+      LOG.debug("Error getting Kyuubi local client ip address", e);

Review Comment:
   at least `LOG.warn`



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


Re: [PR] [KYUUBI #6918] Cache client ipAddress in kyuubi jdbc connection [kyuubi]

Posted by "pan3793 (via GitHub)" <gi...@apache.org>.
pan3793 commented on code in PR #6919:
URL: https://github.com/apache/kyuubi/pull/6919#discussion_r1955796541


##########
kyuubi-hive-jdbc/src/main/java/org/apache/kyuubi/jdbc/hive/Utils.java:
##########
@@ -68,6 +68,21 @@ public class Utils {
   public static final Pattern KYUUBI_OPERATION_HINT_PATTERN =
       Pattern.compile("^__kyuubi_operation_result_(.*)__=(.*)", Pattern.CASE_INSENSITIVE);
 
+  public static final String CLIENT_IP_ADDRESS;
+
+  static {
+    String localIpAddress = null;
+    try {
+      localIpAddress = InetAddress.getLocalHost().getHostAddress();
+    } catch (UnknownHostException e) {
+      LOG.warn("Error getting Kyuubi local client ip address", e);

Review Comment:
   ```suggestion
         LOG.warn("Error getting Kyuubi local client IP address", e);
   ```



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


Re: [PR] [KYUUBI #6918] Cache client ipAddress in kyuubi jdbc connection [kyuubi]

Posted by "wForget (via GitHub)" <gi...@apache.org>.
wForget commented on code in PR #6919:
URL: https://github.com/apache/kyuubi/pull/6919#discussion_r1955745574


##########
kyuubi-hive-jdbc/src/main/java/org/apache/kyuubi/jdbc/hive/Utils.java:
##########
@@ -68,6 +68,18 @@ public class Utils {
   public static final Pattern KYUUBI_OPERATION_HINT_PATTERN =
       Pattern.compile("^__kyuubi_operation_result_(.*)__=(.*)", Pattern.CASE_INSENSITIVE);
 
+  public static final String CLIENT_IP_ADDRESS;
+
+  static {
+    String localIpAddress = null;
+    try {
+      localIpAddress = InetAddress.getLocalHost().getHostAddress();
+    } catch (UnknownHostException e) {
+      LOG.debug("Error getting Kyuubi local client ip address", e);
+    }
+    CLIENT_IP_ADDRESS = localIpAddress;

Review Comment:
   How about `unknown`?



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


Re: [PR] [KYUUBI #6918] Cache client ipAddress in kyuubi jdbc connection [kyuubi]

Posted by "codecov-commenter (via GitHub)" <gi...@apache.org>.
codecov-commenter commented on PR #6919:
URL: https://github.com/apache/kyuubi/pull/6919#issuecomment-2658988406

   ## [Codecov](https://app.codecov.io/gh/apache/kyuubi/pull/6919?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
   Attention: Patch coverage is `0%` with `10 lines` in your changes missing coverage. Please review.
   > Project coverage is 0.00%. Comparing base [(`2a2e4c2`)](https://app.codecov.io/gh/apache/kyuubi/commit/2a2e4c212391d2f5a2b8ea64d77de9cb821e4e7a?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) to head [(`5b0efe7`)](https://app.codecov.io/gh/apache/kyuubi/commit/5b0efe72285b5a7d413a562f1b84db2f0919a8d6?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
   > Report is 1 commits behind head on master.
   
   | [Files with missing lines](https://app.codecov.io/gh/apache/kyuubi/pull/6919?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Patch % | Lines |
   |---|---|---|
   | [...c/main/java/org/apache/kyuubi/jdbc/hive/Utils.java](https://app.codecov.io/gh/apache/kyuubi/pull/6919?src=pr&el=tree&filepath=kyuubi-hive-jdbc%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkyuubi%2Fjdbc%2Fhive%2FUtils.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-a3l1dWJpLWhpdmUtamRiYy9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUva3l1dWJpL2pkYmMvaGl2ZS9VdGlscy5qYXZh) | 0.00% | [9 Missing :warning: ](https://app.codecov.io/gh/apache/kyuubi/pull/6919?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   | [.../org/apache/kyuubi/jdbc/hive/KyuubiConnection.java](https://app.codecov.io/gh/apache/kyuubi/pull/6919?src=pr&el=tree&filepath=kyuubi-hive-jdbc%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkyuubi%2Fjdbc%2Fhive%2FKyuubiConnection.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-a3l1dWJpLWhpdmUtamRiYy9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUva3l1dWJpL2pkYmMvaGl2ZS9LeXV1YmlDb25uZWN0aW9uLmphdmE=) | 0.00% | [1 Missing :warning: ](https://app.codecov.io/gh/apache/kyuubi/pull/6919?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   
   <details><summary>Additional details and impacted files</summary>
   
   
   ```diff
   @@          Coverage Diff           @@
   ##           master   #6919   +/-   ##
   ======================================
     Coverage    0.00%   0.00%           
   ======================================
     Files         688     688           
     Lines       42592   42598    +6     
     Branches     5806    5807    +1     
   ======================================
   - Misses      42592   42598    +6     
   ```
   
   </details>
   
   [:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/apache/kyuubi/pull/6919?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).   
   :loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
   


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


Re: [PR] [KYUUBI #6918] Cache client ipAddress in kyuubi jdbc connection [kyuubi]

Posted by "wForget (via GitHub)" <gi...@apache.org>.
wForget closed pull request #6919: [KYUUBI #6918] Cache client ipAddress in kyuubi jdbc connection
URL: https://github.com/apache/kyuubi/pull/6919


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