You are viewing a plain text version of this content. The canonical link for it is here.
Posted to gitbox@hive.apache.org by "YuxiangZhuang (via GitHub)" <gi...@apache.org> on 2025/03/07 02:41:32 UTC

[PR] HIVE-26336: Add a connectTimeout parameter for JDBC [hive]

YuxiangZhuang opened a new pull request, #5683:
URL: https://github.com/apache/hive/pull/5683

   <!--
   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://cwiki.apache.org/confluence/display/Hive/HowToContribute
     2. Ensure that you have created an issue on the Hive project JIRA: https://issues.apache.org/jira/projects/HIVE/summary
     3. Ensure you have added or run the appropriate tests for your PR: 
     4. If the PR is unfinished, add '[WIP]' in your PR title, e.g., '[WIP]HIVE-XXXXX:  Your PR title ...'.
     5. Be sure to keep the PR description updated to reflect all changes.
     6. Please write your PR title to summarize what this PR proposes.
     7. If possible, provide a concise example to reproduce the issue for a faster review.
   
   -->
   
   ### What changes were proposed in this pull request?
   <!--
   Please clarify what changes you are proposing. The purpose of this section is to outline the changes and how this PR fixes the issue. 
   If possible, please consider writing useful notes for better and faster reviews in your PR. See the examples below.
     1. If you refactor some codes with changing classes, showing the class hierarchy will help reviewers.
     2. If you fix some SQL features, you can provide some references of other DBMSes.
     3. If there is design documentation, please add the link.
     4. If there is a discussion in the mailing list, please add the link.
   -->
   Add a connectTimeout parameter for JDBC
   
   
   ### Why are the changes needed?
   <!--
   Please clarify why the changes are needed. For instance,
     1. If you propose a new API, clarify the use case for a new API.
     2. If you fix a bug, you can clarify why it is a bug.
   -->
   Currently, the Hive JDBC driver lacks a dedicated parameter to set the connectTimeout for connection establishment. The driver implicitly uses the socketTimeout value for both the connect phase and subsequent socket operations. This creates ambiguity and limits users' ability to handle connection establishment failures gracefully.
   
   ### Does this PR introduce _any_ user-facing change?
   <!--
   Note that it means *any* user-facing change including all aspects such as the documentation fix.
   If yes, please clarify the previous behavior and the change this PR proposes - provide the console output, description, screenshot and/or a reproducable example to show the behavior difference if possible.
   If possible, please also clarify if this is a user-facing change compared to the released Hive versions or within the unreleased branches such as master.
   If no, write 'No'.
   -->
   Yes. New JDBC parameter connectTimeout is introduced.
   
   ### Is the change a dependency upgrade?
   <!--
   If yes, please attach a file with output from mvn dependency:tree to validate a complete upgrade of dependency.
   If no, write 'No'.
   -->
   No
   
   ### How was this patch tested?
   <!--
   If tests were added, say they were added here. Please make sure to add some test cases that check the changes thoroughly including negative and positive cases if possible.
   If it was tested in a way different from regular unit tests, please clarify how you tested step by step, ideally copy and paste-able, so that other reviewers can test and check, and descendants can verify in the future.
   If tests were not added, please describe why they were not added and/or why it was difficult to add.
   -->
   This patch was tested by validate the parsing of JDBC connection parameters in org.apache.hive.jdbc.TestHiveConnection#testHiveConnectionParameters
   


-- 
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: gitbox-unsubscribe@hive.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org


Re: [PR] HIVE-26336: Add a connectTimeout parameter for JDBC [hive]

Posted by "deniskuzZ (via GitHub)" <gi...@apache.org>.
deniskuzZ commented on code in PR #5683:
URL: https://github.com/apache/hive/pull/5683#discussion_r2009069702


##########
jdbc/src/java/org/apache/hive/jdbc/HiveConnection.java:
##########
@@ -1433,20 +1434,23 @@ private String getSessionValue(String varName, String varDefault) {
   }
 
   // use socketTimeout from jdbc connection url. Thrift timeout needs to be in millis
-  private void setupLoginTimeout() {
+  private void setupTimeout() {
+    String connectTimeoutStr = sessConfMap.getOrDefault(JdbcConnectionParams.CONNECT_TIMEOUT, "0");
     String socketTimeoutStr = sessConfMap.getOrDefault(JdbcConnectionParams.SOCKET_TIMEOUT, "0");
-    long timeOut = 0;
+    long connectTimeoutMs = 0;
+    long socketTimeoutMs = 0;
     try {
-      timeOut = Long.parseLong(socketTimeoutStr);
+      connectTimeoutMs = Long.parseLong(connectTimeoutStr);
+      connectTimeout = (int) Math.max(0, Math.min(connectTimeoutMs, Integer.MAX_VALUE));
     } catch (NumberFormatException e) {
-      LOG.info("Failed to parse socketTimeout of value " + socketTimeoutStr);
+      LOG.info("Failed to parse connectTimeout of value " + connectTimeoutStr);
     }
-    if (timeOut > Integer.MAX_VALUE) {
-      loginTimeout = Integer.MAX_VALUE;
-    } else if (timeOut < 0) {
-      loginTimeout = 0;
-    } else {
-      loginTimeout = (int) timeOut;
+
+    try {

Review Comment:
   can you extract common logic into method `getTimeoutFor(String configKey)
   ````
   connectionTimeout = getTimeoutFor(JdbcConnectionParams.CONNECT_TIMEOUT);
   socketTimeout = getTimeoutFor(JdbcConnectionParams.SOCKET_TIMEOUT);
   ````



-- 
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: gitbox-unsubscribe@hive.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org


Re: [PR] HIVE-26336: Add a connectTimeout parameter for JDBC [hive]

Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #5683:
URL: https://github.com/apache/hive/pull/5683#issuecomment-2714183849

   ## [![Quality Gate Passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/qg-passed-20px.png 'Quality Gate Passed')](https://sonarcloud.io/dashboard?id=apache_hive&pullRequest=5683) **Quality Gate passed**  
   Issues  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [2 New issues](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=5683&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/accepted-16px.png '') [0 Accepted issues](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=5683&issueStatuses=ACCEPTED)
   
   Measures  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_hive&pullRequest=5683&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_hive&pullRequest=5683&metric=new_coverage&view=list)  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0.0% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_hive&pullRequest=5683&metric=new_duplicated_lines_density&view=list)  
     
   [See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_hive&pullRequest=5683)
   
   


-- 
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: gitbox-unsubscribe@hive.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org


Re: [PR] HIVE-26336: Add a connectTimeout parameter for JDBC [hive]

Posted by "deniskuzZ (via GitHub)" <gi...@apache.org>.
deniskuzZ commented on code in PR #5683:
URL: https://github.com/apache/hive/pull/5683#discussion_r2009070144


##########
common/src/java/org/apache/hadoop/hive/common/auth/HiveAuthUtils.java:
##########
@@ -73,67 +73,61 @@ public static <T extends TTransport> T configureThriftMaxMessageSize(T transport
    * will default to Thrift library default.
    * @param host Host to connect to.
    * @param port Port to connect to.
-   * @param loginTimeout Socket timeout (0 means no timeout).
+   * @param socketTimeout Socket timeout (0 means no timeout).
+   * @param connectTimeout Connection timeout (0 means no timeout).
    * @return TTransport TSocket for host/port.
    */
-  public static TTransport getSocketTransport(String host, int port, int loginTimeout) throws TTransportException {
-    return getSocketTransport(host, port, loginTimeout, /* maxMessageSize */ -1);
+  public static TTransport getSocketTransport(String host, int port, int socketTimeout, int connectTimeout) throws TTransportException {
+    return getSocketTransport(host, port, socketTimeout, connectTimeout, /* maxMessageSize */ -1);
   }
 
   /**
    * Create a TSocket for the provided host and port with specified loginTimeout and maxMessageSize.
    * will default to Thrift library default.
    * @param host Host to connect to.
    * @param port Port to connect to.
-   * @param loginTimeout Socket timeout (0 means no timeout).
+   * @param socketTimeout Socket timeout (0 means no timeout).
+   * @param connectTimeout Connection timeout (0 means no timeout).
    * @param maxMessageSize Size in bytes for max allowable Thrift message size, less than or equal to 0
    *                       results in using the Thrift library default.
    * @return TTransport TSocket for host/port
    */
-  public static TTransport getSocketTransport(String host, int port, int loginTimeout, int maxMessageSize)
-      throws TTransportException {
-    TSocket tSocket = new TSocket(host, port, loginTimeout);
+  public static TTransport getSocketTransport(String host, int port, int socketTimeout, int connectTimeout, int maxMessageSize)
+          throws TTransportException {
+    TSocket tSocket = new TSocket(host, port, socketTimeout);
+    tSocket.setConnectTimeout(connectTimeout);
     return configureThriftMaxMessageSize(tSocket, maxMessageSize);
   }
 
-  public static TTransport getSSLSocket(String host, int port, int loginTimeout, TSSLTransportParameters params,
+  public static TTransport getSSLSocket(String host, int port, int socketTimeout, int connectTimeout, TSSLTransportParameters params,

Review Comment:
   should we change the order of params?



-- 
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: gitbox-unsubscribe@hive.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org


Re: [PR] HIVE-26336: Add a connectTimeout parameter for JDBC [hive]

Posted by "deniskuzZ (via GitHub)" <gi...@apache.org>.
deniskuzZ commented on code in PR #5683:
URL: https://github.com/apache/hive/pull/5683#discussion_r2009069702


##########
jdbc/src/java/org/apache/hive/jdbc/HiveConnection.java:
##########
@@ -1433,20 +1434,23 @@ private String getSessionValue(String varName, String varDefault) {
   }
 
   // use socketTimeout from jdbc connection url. Thrift timeout needs to be in millis
-  private void setupLoginTimeout() {
+  private void setupTimeout() {
+    String connectTimeoutStr = sessConfMap.getOrDefault(JdbcConnectionParams.CONNECT_TIMEOUT, "0");
     String socketTimeoutStr = sessConfMap.getOrDefault(JdbcConnectionParams.SOCKET_TIMEOUT, "0");
-    long timeOut = 0;
+    long connectTimeoutMs = 0;
+    long socketTimeoutMs = 0;
     try {
-      timeOut = Long.parseLong(socketTimeoutStr);
+      connectTimeoutMs = Long.parseLong(connectTimeoutStr);
+      connectTimeout = (int) Math.max(0, Math.min(connectTimeoutMs, Integer.MAX_VALUE));
     } catch (NumberFormatException e) {
-      LOG.info("Failed to parse socketTimeout of value " + socketTimeoutStr);
+      LOG.info("Failed to parse connectTimeout of value " + connectTimeoutStr);
     }
-    if (timeOut > Integer.MAX_VALUE) {
-      loginTimeout = Integer.MAX_VALUE;
-    } else if (timeOut < 0) {
-      loginTimeout = 0;
-    } else {
-      loginTimeout = (int) timeOut;
+
+    try {

Review Comment:
   can you extract common logic into method `getTimeoutFor(String configKey)
   ````
   connectionTimeout = getTimeoutVar(sessConfMap, JdbcConnectionParams.CONNECT_TIMEOUT);
   socketTimeout = getTimeoutVar(sessConfMap, JdbcConnectionParams.SOCKET_TIMEOUT);
   ````



-- 
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: gitbox-unsubscribe@hive.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org


Re: [PR] HIVE-26336: Add a connectTimeout parameter for JDBC [hive]

Posted by "YuxiangZhuang (via GitHub)" <gi...@apache.org>.
YuxiangZhuang commented on code in PR #5683:
URL: https://github.com/apache/hive/pull/5683#discussion_r2011200322


##########
jdbc/src/java/org/apache/hive/jdbc/HiveConnection.java:
##########
@@ -932,7 +933,7 @@ private TTransport createUnderlyingTransport() throws TTransportException, SQLEx
       String sslTrustStorePassword = Utils.getPassword(sessConfMap, JdbcConnectionParams.SSL_TRUST_STORE_PASSWORD);
 
       if (sslTrustStore == null || sslTrustStore.isEmpty()) {
-        transport = HiveAuthUtils.getSSLSocket(host, port, loginTimeout, maxMessageSize);
+        transport = HiveAuthUtils.getSSLSocket(host, port, socketTimeout, connectTimeout, maxMessageSize);

Review Comment:
   @deniskuzZ currently the `socketTimeout` and `connectTimeout` use a seconds unit, `Socket.java` and `TSocket.java` use a milliseconds timeout, so should we convert the timeout parameters to milliseconds here and other place in `HiveConnection.java`?



-- 
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: gitbox-unsubscribe@hive.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org


Re: [PR] HIVE-26336: Add a connectTimeout parameter for JDBC [hive]

Posted by "deniskuzZ (via GitHub)" <gi...@apache.org>.
deniskuzZ commented on code in PR #5683:
URL: https://github.com/apache/hive/pull/5683#discussion_r2009720031


##########
jdbc/src/java/org/apache/hive/jdbc/HiveConnection.java:
##########
@@ -806,9 +807,9 @@ protected boolean requestIsAborted(final HttpRequest request) {
 
     // set the specified timeout (socketTimeout jdbc param) for http connection as well
     RequestConfig config = RequestConfig.custom()
-            .setConnectTimeout(loginTimeout * 1000)
-            .setConnectionRequestTimeout(loginTimeout * 1000)
-            .setSocketTimeout(loginTimeout * 1000).build();
+            .setConnectTimeout(connectTimeout)

Review Comment:
   did we use a seconds unit before? isn't it a breaking change?



-- 
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: gitbox-unsubscribe@hive.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org


Re: [PR] HIVE-26336: Add a connectTimeout parameter for JDBC [hive]

Posted by "deniskuzZ (via GitHub)" <gi...@apache.org>.
deniskuzZ commented on code in PR #5683:
URL: https://github.com/apache/hive/pull/5683#discussion_r2009069702


##########
jdbc/src/java/org/apache/hive/jdbc/HiveConnection.java:
##########
@@ -1433,20 +1434,23 @@ private String getSessionValue(String varName, String varDefault) {
   }
 
   // use socketTimeout from jdbc connection url. Thrift timeout needs to be in millis
-  private void setupLoginTimeout() {
+  private void setupTimeout() {
+    String connectTimeoutStr = sessConfMap.getOrDefault(JdbcConnectionParams.CONNECT_TIMEOUT, "0");
     String socketTimeoutStr = sessConfMap.getOrDefault(JdbcConnectionParams.SOCKET_TIMEOUT, "0");
-    long timeOut = 0;
+    long connectTimeoutMs = 0;
+    long socketTimeoutMs = 0;
     try {
-      timeOut = Long.parseLong(socketTimeoutStr);
+      connectTimeoutMs = Long.parseLong(connectTimeoutStr);
+      connectTimeout = (int) Math.max(0, Math.min(connectTimeoutMs, Integer.MAX_VALUE));
     } catch (NumberFormatException e) {
-      LOG.info("Failed to parse socketTimeout of value " + socketTimeoutStr);
+      LOG.info("Failed to parse connectTimeout of value " + connectTimeoutStr);
     }
-    if (timeOut > Integer.MAX_VALUE) {
-      loginTimeout = Integer.MAX_VALUE;
-    } else if (timeOut < 0) {
-      loginTimeout = 0;
-    } else {
-      loginTimeout = (int) timeOut;
+
+    try {

Review Comment:
   can you extract common logic into method `getTimeoutFor(String configKey)
   ````
   connectionTimeout = getTimeoutVar(JdbcConnectionParams.CONNECT_TIMEOUT);
   socketTimeout = getTimeoutVar(JdbcConnectionParams.SOCKET_TIMEOUT);
   ````



-- 
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: gitbox-unsubscribe@hive.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org


Re: [PR] HIVE-26336: Add a connectTimeout parameter for JDBC [hive]

Posted by "YuxiangZhuang (via GitHub)" <gi...@apache.org>.
YuxiangZhuang commented on PR #5683:
URL: https://github.com/apache/hive/pull/5683#issuecomment-2710282825

   I dont know how "This commit cannot be built" happened and cannot open the failed jenkins link. But i can run <mvn clean package -Pdist -PskipTests> in my local env. 
   
   Since the build works locally but fails in the CI environment, I'm unsure how to proceed. Could anyone help me troubleshoot this issue? Any assistance would be greatly appreciated.


-- 
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: gitbox-unsubscribe@hive.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org


Re: [PR] HIVE-26336: Add a connectTimeout parameter for JDBC [hive]

Posted by "YuxiangZhuang (via GitHub)" <gi...@apache.org>.
YuxiangZhuang commented on code in PR #5683:
URL: https://github.com/apache/hive/pull/5683#discussion_r2009389723


##########
jdbc/src/java/org/apache/hive/jdbc/HiveConnection.java:
##########
@@ -176,7 +176,8 @@ public class HiveConnection implements java.sql.Connection {
   private SQLWarning warningChain = null;
   private TSessionHandle sessHandle = null;
   private final List<TProtocolVersion> supportedProtocols = new LinkedList<TProtocolVersion>();
-  private int loginTimeout = 0;
+  private int connectTimeout = 0;
+  private int socketTimtout = 0;

Review Comment:
   Resolved, thank u for the mention, my mistake



-- 
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: gitbox-unsubscribe@hive.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org


Re: [PR] HIVE-26336: Add a connectTimeout parameter for JDBC [hive]

Posted by "deniskuzZ (via GitHub)" <gi...@apache.org>.
deniskuzZ commented on code in PR #5683:
URL: https://github.com/apache/hive/pull/5683#discussion_r2009070144


##########
common/src/java/org/apache/hadoop/hive/common/auth/HiveAuthUtils.java:
##########
@@ -73,67 +73,61 @@ public static <T extends TTransport> T configureThriftMaxMessageSize(T transport
    * will default to Thrift library default.
    * @param host Host to connect to.
    * @param port Port to connect to.
-   * @param loginTimeout Socket timeout (0 means no timeout).
+   * @param socketTimeout Socket timeout (0 means no timeout).
+   * @param connectTimeout Connection timeout (0 means no timeout).
    * @return TTransport TSocket for host/port.
    */
-  public static TTransport getSocketTransport(String host, int port, int loginTimeout) throws TTransportException {
-    return getSocketTransport(host, port, loginTimeout, /* maxMessageSize */ -1);
+  public static TTransport getSocketTransport(String host, int port, int socketTimeout, int connectTimeout) throws TTransportException {
+    return getSocketTransport(host, port, socketTimeout, connectTimeout, /* maxMessageSize */ -1);
   }
 
   /**
    * Create a TSocket for the provided host and port with specified loginTimeout and maxMessageSize.
    * will default to Thrift library default.
    * @param host Host to connect to.
    * @param port Port to connect to.
-   * @param loginTimeout Socket timeout (0 means no timeout).
+   * @param socketTimeout Socket timeout (0 means no timeout).
+   * @param connectTimeout Connection timeout (0 means no timeout).
    * @param maxMessageSize Size in bytes for max allowable Thrift message size, less than or equal to 0
    *                       results in using the Thrift library default.
    * @return TTransport TSocket for host/port
    */
-  public static TTransport getSocketTransport(String host, int port, int loginTimeout, int maxMessageSize)
-      throws TTransportException {
-    TSocket tSocket = new TSocket(host, port, loginTimeout);
+  public static TTransport getSocketTransport(String host, int port, int socketTimeout, int connectTimeout, int maxMessageSize)
+          throws TTransportException {
+    TSocket tSocket = new TSocket(host, port, socketTimeout);
+    tSocket.setConnectTimeout(connectTimeout);
     return configureThriftMaxMessageSize(tSocket, maxMessageSize);
   }
 
-  public static TTransport getSSLSocket(String host, int port, int loginTimeout, TSSLTransportParameters params,
+  public static TTransport getSSLSocket(String host, int port, int socketTimeout, int connectTimeout, TSSLTransportParameters params,

Review Comment:
   should we change the order of params? ````int connectionTimeout, int socketTimeout````



-- 
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: gitbox-unsubscribe@hive.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org


Re: [PR] HIVE-26336: Add a connectTimeout parameter for JDBC [hive]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #5683:
URL: https://github.com/apache/hive/pull/5683#issuecomment-2914512637

   This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
   Feel free to reach out on the dev@hive.apache.org list if the patch is in need of reviews.


-- 
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: gitbox-unsubscribe@hive.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org


Re: [PR] HIVE-26336: Add a connectTimeout parameter for JDBC [hive]

Posted by "YuxiangZhuang (via GitHub)" <gi...@apache.org>.
YuxiangZhuang commented on code in PR #5683:
URL: https://github.com/apache/hive/pull/5683#discussion_r2017832305


##########
jdbc/src/test/org/apache/hive/jdbc/TestHiveConnection.java:
##########
@@ -72,6 +72,7 @@ public void testHiveConnectionParameters() throws SQLException, ZooKeeperHiveCli
     Assert.assertEquals("http", params.getSessionVars().get(JdbcConnectionParams.TRANSPORT_MODE));
     Assert.assertEquals("cliservice", params.getSessionVars().get(JdbcConnectionParams.HTTP_PATH));
     Assert.assertEquals("60", params.getSessionVars().get(JdbcConnectionParams.SOCKET_TIMEOUT));

Review Comment:
   After the modifications, the usage of `socketTimeout` and `connectTimeout` remain consistent with the previous version.



-- 
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: gitbox-unsubscribe@hive.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org


Re: [PR] HIVE-26336: Add a connectTimeout parameter for JDBC [hive]

Posted by "deniskuzZ (via GitHub)" <gi...@apache.org>.
deniskuzZ commented on code in PR #5683:
URL: https://github.com/apache/hive/pull/5683#discussion_r2009068333


##########
jdbc/src/java/org/apache/hive/jdbc/HiveConnection.java:
##########
@@ -1433,20 +1434,23 @@ private String getSessionValue(String varName, String varDefault) {
   }
 
   // use socketTimeout from jdbc connection url. Thrift timeout needs to be in millis
-  private void setupLoginTimeout() {
+  private void setupTimeout() {
+    String connectTimeoutStr = sessConfMap.getOrDefault(JdbcConnectionParams.CONNECT_TIMEOUT, "0");
     String socketTimeoutStr = sessConfMap.getOrDefault(JdbcConnectionParams.SOCKET_TIMEOUT, "0");
-    long timeOut = 0;
+    long connectTimeoutMs = 0;
+    long socketTimeoutMs = 0;
     try {
-      timeOut = Long.parseLong(socketTimeoutStr);
+      connectTimeoutMs = Long.parseLong(connectTimeoutStr);

Review Comment:
   change it to local var



-- 
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: gitbox-unsubscribe@hive.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org


Re: [PR] HIVE-26336: Add a connectTimeout parameter for JDBC [hive]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #5683:
URL: https://github.com/apache/hive/pull/5683#issuecomment-3169572519

   This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
   Feel free to reach out on the dev@hive.apache.org list if the patch is in need of reviews.


-- 
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: gitbox-unsubscribe@hive.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org


Re: [PR] HIVE-26336: Add a connectTimeout parameter for JDBC [hive]

Posted by "YuxiangZhuang (via GitHub)" <gi...@apache.org>.
YuxiangZhuang commented on code in PR #5683:
URL: https://github.com/apache/hive/pull/5683#discussion_r2009402569


##########
jdbc/src/java/org/apache/hive/jdbc/HiveConnection.java:
##########
@@ -1433,20 +1434,23 @@ private String getSessionValue(String varName, String varDefault) {
   }
 
   // use socketTimeout from jdbc connection url. Thrift timeout needs to be in millis
-  private void setupLoginTimeout() {
+  private void setupTimeout() {
+    String connectTimeoutStr = sessConfMap.getOrDefault(JdbcConnectionParams.CONNECT_TIMEOUT, "0");
     String socketTimeoutStr = sessConfMap.getOrDefault(JdbcConnectionParams.SOCKET_TIMEOUT, "0");
-    long timeOut = 0;
+    long connectTimeoutMs = 0;
+    long socketTimeoutMs = 0;
     try {
-      timeOut = Long.parseLong(socketTimeoutStr);
+      connectTimeoutMs = Long.parseLong(connectTimeoutStr);

Review Comment:
   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: gitbox-unsubscribe@hive.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org


Re: [PR] HIVE-26336: Add a connectTimeout parameter for JDBC [hive]

Posted by "YuxiangZhuang (via GitHub)" <gi...@apache.org>.
YuxiangZhuang commented on code in PR #5683:
URL: https://github.com/apache/hive/pull/5683#discussion_r2009494841


##########
jdbc/src/java/org/apache/hive/jdbc/HiveConnection.java:
##########
@@ -1433,20 +1434,23 @@ private String getSessionValue(String varName, String varDefault) {
   }
 
   // use socketTimeout from jdbc connection url. Thrift timeout needs to be in millis
-  private void setupLoginTimeout() {
+  private void setupTimeout() {
+    String connectTimeoutStr = sessConfMap.getOrDefault(JdbcConnectionParams.CONNECT_TIMEOUT, "0");
     String socketTimeoutStr = sessConfMap.getOrDefault(JdbcConnectionParams.SOCKET_TIMEOUT, "0");
-    long timeOut = 0;
+    long connectTimeoutMs = 0;
+    long socketTimeoutMs = 0;
     try {
-      timeOut = Long.parseLong(socketTimeoutStr);
+      connectTimeoutMs = Long.parseLong(connectTimeoutStr);
+      connectTimeout = (int) Math.max(0, Math.min(connectTimeoutMs, Integer.MAX_VALUE));
     } catch (NumberFormatException e) {
-      LOG.info("Failed to parse socketTimeout of value " + socketTimeoutStr);
+      LOG.info("Failed to parse connectTimeout of value " + connectTimeoutStr);
     }
-    if (timeOut > Integer.MAX_VALUE) {
-      loginTimeout = Integer.MAX_VALUE;
-    } else if (timeOut < 0) {
-      loginTimeout = 0;
-    } else {
-      loginTimeout = (int) timeOut;
+
+    try {
+      socketTimeoutMs = Long.parseLong(socketTimeoutStr);
+      connectTimeout = (int) Math.max(0, Math.min(socketTimeoutMs, Integer.MAX_VALUE));

Review Comment:
   IMO, this should parse the integer value of timeout in milliseconds, between 0 and Integer.MAX_VALUE.
   Am I right? I’m sorry if I’m wrong.



-- 
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: gitbox-unsubscribe@hive.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org


Re: [PR] HIVE-26336: Add a connectTimeout parameter for JDBC [hive]

Posted by "deniskuzZ (via GitHub)" <gi...@apache.org>.
deniskuzZ commented on code in PR #5683:
URL: https://github.com/apache/hive/pull/5683#discussion_r2009070144


##########
common/src/java/org/apache/hadoop/hive/common/auth/HiveAuthUtils.java:
##########
@@ -73,67 +73,61 @@ public static <T extends TTransport> T configureThriftMaxMessageSize(T transport
    * will default to Thrift library default.
    * @param host Host to connect to.
    * @param port Port to connect to.
-   * @param loginTimeout Socket timeout (0 means no timeout).
+   * @param socketTimeout Socket timeout (0 means no timeout).
+   * @param connectTimeout Connection timeout (0 means no timeout).
    * @return TTransport TSocket for host/port.
    */
-  public static TTransport getSocketTransport(String host, int port, int loginTimeout) throws TTransportException {
-    return getSocketTransport(host, port, loginTimeout, /* maxMessageSize */ -1);
+  public static TTransport getSocketTransport(String host, int port, int socketTimeout, int connectTimeout) throws TTransportException {
+    return getSocketTransport(host, port, socketTimeout, connectTimeout, /* maxMessageSize */ -1);
   }
 
   /**
    * Create a TSocket for the provided host and port with specified loginTimeout and maxMessageSize.
    * will default to Thrift library default.
    * @param host Host to connect to.
    * @param port Port to connect to.
-   * @param loginTimeout Socket timeout (0 means no timeout).
+   * @param socketTimeout Socket timeout (0 means no timeout).
+   * @param connectTimeout Connection timeout (0 means no timeout).
    * @param maxMessageSize Size in bytes for max allowable Thrift message size, less than or equal to 0
    *                       results in using the Thrift library default.
    * @return TTransport TSocket for host/port
    */
-  public static TTransport getSocketTransport(String host, int port, int loginTimeout, int maxMessageSize)
-      throws TTransportException {
-    TSocket tSocket = new TSocket(host, port, loginTimeout);
+  public static TTransport getSocketTransport(String host, int port, int socketTimeout, int connectTimeout, int maxMessageSize)
+          throws TTransportException {
+    TSocket tSocket = new TSocket(host, port, socketTimeout);
+    tSocket.setConnectTimeout(connectTimeout);
     return configureThriftMaxMessageSize(tSocket, maxMessageSize);
   }
 
-  public static TTransport getSSLSocket(String host, int port, int loginTimeout, TSSLTransportParameters params,
+  public static TTransport getSSLSocket(String host, int port, int socketTimeout, int connectTimeout, TSSLTransportParameters params,

Review Comment:
   should we change the order of params?
   ````int connectionTimeout, int socketTimeout````



-- 
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: gitbox-unsubscribe@hive.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org


Re: [PR] HIVE-26336: Add a connectTimeout parameter for JDBC [hive]

Posted by "zhangbutao (via GitHub)" <gi...@apache.org>.
zhangbutao commented on PR #5683:
URL: https://github.com/apache/hive/pull/5683#issuecomment-2712322790

   https://ci.hive.apache.org/blue/organizations/jenkins/hive-precommit/detail/PR-5683/1/pipeline
   @YuxiangZhuang Please check the CI log & fix the build error:
   
   ```
   unit/src/test/java/org/apache/hadoop/hive/ql/parse/WarehouseInstance.java: Recompile with -Xlint:unchecked for details.
   
   [2025-03-07T03:13:58.874Z] [INFO] -------------------------------------------------------------
   
   [2025-03-07T03:13:58.874Z] [ERROR] COMPILATION ERROR : 
   
   [2025-03-07T03:13:58.874Z] [INFO] -------------------------------------------------------------
   
   [2025-03-07T03:13:58.874Z] [ERROR] /home/jenkins/agent/workspace/hive-precommit_PR-5683/itests/hive-unit/src/test/java/org/apache/hive/service/cli/thrift/TestThriftCliServiceWithInfoMessage.java:[98,41] method getSocketTransport in class org.apache.hadoop.hive.common.auth.HiveAuthUtils cannot be applied to given types;
   
   [2025-03-07T03:13:58.874Z]   required: java.lang.String,int,int,int,int
   
   [2025-03-07T03:13:58.874Z]   found: java.lang.String,int,int
   
   [2025-03-07T03:13:58.874Z]   reason: actual and formal argument lists differ in length
   
   [2025-03-07T03:13:58.874Z] [ERROR] /home/jenkins/agent/workspace/hive-precommit_PR-5683/itests/hive-unit/src/test/java/org/apache/hive/service/cli/thrift/TestThriftHttpCLIServiceFeatures.java:[220,25] method getSocketTransport in class org.apache.hadoop.hive.common.auth.HiveAuthUtils cannot be applied to given types;
   
   [2025-03-07T03:13:58.875Z]   required: java.lang.String,int,int,int,int
   
   [2025-03-07T03:13:58.875Z]   found: java.lang.String,int,int
   
   [2025-03-07T03:13:58.875Z]   reason: actual and formal argument lists differ in length
   
   [2025-03-07T03:13:58.875Z] [INFO] 2 errors 
   
   [2025-03-07T03:13:58.875Z] [INFO] -------------------------------------------------------------
   
   [2025-03-07T03:13:58.875Z] [INFO] ------------------------------------------------------------------------
   
   [2025-03-07T03:13:58.875Z] [INFO] Reactor Summary for Hive 4.1.0-SNAPSHOT:
   
   [2025-03-07T03:13:58.875Z] [INFO] 
   
   [2025-03-07T03:13:58.875Z] [INFO] Hive Storage API ................................... SUCCESS [ 13.201 s]
   
   [2025-03-07T03:13:58.875Z] [INFO] Hive ............................................... SUCCESS [  7.825 s]
   
   [2025-03-07T03:13:58.875Z] [INFO] Hive Classifications ............................... SUCCESS [  0.460 s]
   
   [2025-03-07T03:13:58.875Z] [INFO] Hive Shims Common .................................. SUCCESS [  5.947 s]
   
   [2025-03-07T03:13:58.875Z] [INFO] Hive Shims 0.23 .................................... SUCCESS [ 11.139 s]
   
   [2025-03-07T03:13:58.875Z] [INFO] Hive Shims ......................................... SUCCESS [  5.746 s]
   
   [2025-03-07T03:13:58.875Z] [INFO] Hive Standalone Metastore .......................... SUCCESS [  3.102 s]
   
   [2025-03-07T03:13:58.875Z] [INFO] Hive Standalone Metastore Common Code .............. SUCCESS [ 33.571 s]
   
   [2025-03-07T03:13:58.875Z] [INFO] Hive Common ........................................ SUCCESS [ 15.184 s]
   
   [2025-03-07T03:13:58.875Z] [INFO] Hive Service RPC ................................... SUCCESS [  1.200 s]
   
   [2025-03-07T03:13:58.875Z] [INFO] Hive Serde ......................................... SUCCESS [ 20.775 s]
   
   [2025-03-07T03:13:58.875Z] [INFO] Hive Metastore ..................................... SUCCESS [ 10.855 s]
   
   [2025-03-07T03:13:58.875Z] [INFO] Hive Vector-Code-Gen Utilities ..................... SUCCESS [  1.408 s]
   
   [2025-03-07T03:13:58.875Z] [INFO] Hive Parser ........................................ SUCCESS [ 21.130 s]
   
   [2025-03-07T03:13:58.875Z] [INFO] Hive UDF ........................................... SUCCESS [ 10.263 s]
   
   [2025-03-07T03:13:58.875Z] [INFO] Hive Llap Common ................................... SUCCESS [ 12.828 s]
   
   [2025-03-07T03:13:58.875Z] [INFO] Hive Llap Client ................................... SUCCESS [ 12.258 s]
   
   [2025-03-07T03:13:58.875Z] [INFO] Hive Llap Tez ...................................... SUCCESS [ 13.912 s]
   
   [2025-03-07T03:13:58.875Z] [INFO] Hive Metastore Server .............................. SUCCESS [ 41.048 s]
   
   [2025-03-07T03:13:58.875Z] [INFO] Hive Query Language ................................ SUCCESS [02:19 min]
   
   [2025-03-07T03:13:58.875Z] [INFO] Hive TestUtils ..................................... SUCCESS [  0.504 s]
   
   [2025-03-07T03:13:58.875Z] [INFO] Hive Llap Server ................................... SUCCESS [ 35.112 s]
   
   [2025-03-07T03:13:58.875Z] [INFO] Hive HPL/SQL ....................................... SUCCESS [ 17.470 s]
   
   [2025-03-07T03:13:58.875Z] [INFO] Hive Service ....................................... SUCCESS [ 34.060 s]
   
   [2025-03-07T03:13:58.875Z] [INFO] Hive Accumulo Handler .............................. SUCCESS [ 22.597 s]
   
   [2025-03-07T03:13:58.875Z] [INFO] Hive JDBC .......................................... SUCCESS [ 17.273 s]
   
   [2025-03-07T03:13:58.875Z] [INFO] Hive Beeline ....................................... SUCCESS [ 36.668 s]
   
   [2025-03-07T03:13:58.875Z] [INFO] Hive CLI ........................................... SUCCESS [ 20.240 s]
   
   [2025-03-07T03:13:58.875Z] [INFO] Hive Contrib ....................................... SUCCESS [ 16.081 s]
   
   [2025-03-07T03:13:58.875Z] [INFO] Hive Druid Handler ................................. SUCCESS [02:43 min]
   
   [2025-03-07T03:13:58.875Z] [INFO] Hive HBase Handler ................................. SUCCESS [ 27.072 s]
   
   [2025-03-07T03:13:58.875Z] [INFO] Hive JDBC Handler .................................. SUCCESS [ 16.717 s]
   
   [2025-03-07T03:13:58.875Z] [INFO] Hive HCatalog ...................................... SUCCESS [  9.867 s]
   
   [2025-03-07T03:13:58.875Z] [INFO] Hive HCatalog Core ................................. SUCCESS [ 25.322 s]
   
   [2025-03-07T03:13:58.875Z] [INFO] Hive HCatalog Pig Adapter .......................... SUCCESS [ 21.708 s]
   
   [2025-03-07T03:13:58.875Z] [INFO] Hive HCatalog Server Extensions .................... SUCCESS [ 22.129 s]
   
   [2025-03-07T03:13:58.875Z] [INFO] Hive HCatalog Webhcat Java Client .................. SUCCESS [ 26.529 s]
   
   [2025-03-07T03:13:58.875Z] [INFO] Hive HCatalog Webhcat .............................. SUCCESS [ 23.813 s]
   
   [2025-03-07T03:13:58.875Z] [INFO] Hive Streaming ..................................... SUCCESS [ 19.551 s]
   
   [2025-03-07T03:13:58.875Z] [INFO] Hive Llap External Client .......................... SUCCESS [ 15.395 s]
   
   [2025-03-07T03:13:58.875Z] [INFO] Hive Shims Aggregator .............................. SUCCESS [  0.162 s]
   
   [2025-03-07T03:13:58.875Z] [INFO] Hive Kudu Handler .................................. SUCCESS [ 22.140 s]
   
   [2025-03-07T03:13:58.875Z] [INFO] Hive Iceberg Modules ............................... SUCCESS [  2.223 s]
   
   [2025-03-07T03:13:58.875Z] [INFO] Patched Iceberg API ................................ SUCCESS [  2.719 s]
   
   [2025-03-07T03:13:58.875Z] [INFO] Patched Iceberg Core ............................... SUCCESS [ 14.130 s]
   
   [2025-03-07T03:13:58.875Z] [INFO] Hive Iceberg Shading ............................... SUCCESS [  7.939 s]
   
   [2025-03-07T03:13:58.875Z] [INFO] Hive Iceberg Catalog ............................... SUCCESS [ 35.279 s]
   
   [2025-03-07T03:13:58.875Z] [INFO] Hive Iceberg Handler ............................... SUCCESS [01:02 min]
   
   [2025-03-07T03:13:58.875Z] [INFO] Hive Kafka Storage Handler ......................... SUCCESS [ 27.174 s]
   
   [2025-03-07T03:13:58.875Z] [INFO] Hive Packaging ..................................... SUCCESS [01:44 min]
   
   [2025-03-07T03:13:58.875Z] [INFO] Hive Metastore Tools ............................... SUCCESS [  0.176 s]
   
   [2025-03-07T03:13:58.875Z] [INFO] Hive Metastore Tools common libraries .............. SUCCESS [ 25.630 s]
   
   [2025-03-07T03:13:58.875Z] [INFO] Hive metastore benchmarks .......................... SUCCESS [ 23.886 s]
   
   [2025-03-07T03:13:58.875Z] [INFO] Hive Integration - Parent .......................... SUCCESS [  0.304 s]
   
   [2025-03-07T03:13:58.875Z] [INFO] Hive Integration - Custom Serde .................... SUCCESS [ 15.290 s]
   
   [2025-03-07T03:13:58.875Z] [INFO] Hive Integration - Custom udfs ..................... SUCCESS [  0.216 s]
   
   [2025-03-07T03:13:58.875Z] [INFO] Hive Integration - Custom UDFs - udf-classloader-util SUCCESS [  0.280 s]
   
   [2025-03-07T03:13:58.875Z] [INFO] Hive Integration - Custom UDFs - udf-classloader-udf1 SUCCESS [ 14.036 s]
   
   [2025-03-07T03:13:58.875Z] [INFO] Hive Integration - Custom UDFs - udf-classloader-udf2 SUCCESS [ 14.811 s]
   
   [2025-03-07T03:13:58.875Z] [INFO] Hive Integration - Custom UDFs - udf-vectorized-badexample SUCCESS [ 13.814 s]
   
   [2025-03-07T03:13:58.875Z] [INFO] Hive Integration - HCatalog Unit Tests ............. SUCCESS [ 25.989 s]
   
   [2025-03-07T03:13:58.875Z] [INFO] Hive Integration - QFile Druid Tests ............... SUCCESS [ 49.053 s]
   
   [2025-03-07T03:13:58.875Z] [INFO] Hive Integration - Testing Utilities ............... SUCCESS [ 47.589 s]
   
   [2025-03-07T03:13:58.875Z] [INFO] Hive Integration - Unit Tests ...................... FAILURE [ 15.947 s]
   
   [2025-03-07T03:13:58.875Z] [INFO] Hive Integration - Blobstore Tests ................. SKIPPED
   
   [2025-03-07T03:13:58.875Z] [INFO] Hive Integration - Test Serde ...................... SKIPPED
   
   [2025-03-07T03:13:58.875Z] [INFO] Hive Integration - QFile Tests ..................... SKIPPED
   
   [2025-03-07T03:13:58.875Z] [INFO] Hive Integration - QFile Accumulo Tests ............ SKIPPED
   
   [2025-03-07T03:13:58.875Z] [INFO] JMH benchmark: Hive ................................ SKIPPED
   
   [2025-03-07T03:13:58.875Z] [INFO] Hive Integration - Unit Tests - Hadoop 2 ........... SKIPPED
   
   [2025-03-07T03:13:58.875Z] [INFO] Hive Integration - Unit Tests with miniKdc ......... SKIPPED
   
   [2025-03-07T03:13:58.875Z] [INFO] Hive Integration - QFile Kudu Tests ................ SKIPPED
   
   [2025-03-07T03:13:58.875Z] [INFO] Hive Integration - QFile Iceberg Tests ............. SKIPPED
   
   [2025-03-07T03:13:58.875Z] [INFO] ------------------------------------------------------------------------
   
   [2025-03-07T03:13:58.875Z] [INFO] BUILD FAILURE
   
   [2025-03-07T03:13:58.875Z] [INFO] ------------------------------------------------------------------------
   
   [2025-03-07T03:13:58.875Z] [INFO] Total time:  24:40 min
   
   [2025-03-07T03:13:58.875Z] [INFO] Finished at: 2025-03-07T03:13:58Z
   
   [2025-03-07T03:13:58.875Z] [INFO] ------------------------------------------------------------------------
   
   [2025-03-07T03:13:58.875Z] [INFO] 1172 goals, 1172 executed
   
   [2025-03-07T03:13:59.133Z] [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:testCompile (default-testCompile) on project hive-it-unit: Compilation failure: Compilation failure: 
   
   [2025-03-07T03:13:59.133Z] [ERROR] /home/jenkins/agent/workspace/hive-precommit_PR-5683/itests/hive-unit/src/test/java/org/apache/hive/service/cli/thrift/TestThriftCliServiceWithInfoMessage.java:[98,41] method getSocketTransport in class org.apache.hadoop.hive.common.auth.HiveAuthUtils cannot be applied to given types;
   
   [2025-03-07T03:13:59.133Z] [ERROR]   required: java.lang.String,int,int,int,int
   
   [2025-03-07T03:13:59.133Z] [ERROR]   found: java.lang.String,int,int
   
   [2025-03-07T03:13:59.133Z] [ERROR]   reason: actual and formal argument lists differ in length
   
   [2025-03-07T03:13:59.133Z] [ERROR] /home/jenkins/agent/workspace/hive-precommit_PR-5683/itests/hive-unit/src/test/java/org/apache/hive/service/cli/thrift/TestThriftHttpCLIServiceFeatures.java:[220,25] method getSocketTransport in class org.apache.hadoop.hive.common.auth.HiveAuthUtils cannot be applied to given types;
   
   [2025-03-07T03:13:59.133Z] [ERROR]   required: java.lang.String,int,int,int,int
   
   [2025-03-07T03:13:59.133Z] [ERROR]   found: java.lang.String,int,int
   
   [2025-03-07T03:13:59.133Z] [ERROR]   reason: actual and formal argument lists differ in length
   
   [2025-03-07T03:13:59.133Z] [ERROR] -> [Help 1]
   
   [2025-03-07T03:13:59.133Z] [ERROR] 
   
   [2025-03-07T03:13:59.133Z] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
   
   [2025-03-07T03:13:59.133Z] [ERROR] Re-run Maven using the -X switch to enable full debug logging.
   
   [2025-03-07T03:13:59.133Z] [ERROR] 
   
   [2025-03-07T03:13:59.133Z] [ERROR] For more information about the errors and possible solutions, please read the following articles:
   
   [2025-03-07T03:13:59.133Z] [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
   
   [2025-03-07T03:13:59.133Z] [ERROR] 
   
   [2025-03-07T03:13:59.133Z] [ERROR] After correcting the problems, you can resume the build with the command
   
   [2025-03-07T03:13:59.133Z] [ERROR]   mvn <args> -rf :hive-it-unit
   
   script returned exit code 1
   ```


-- 
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: gitbox-unsubscribe@hive.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org


Re: [PR] HIVE-26336: Add a connectTimeout parameter for JDBC [hive]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] closed pull request #5683: HIVE-26336: Add a connectTimeout parameter for JDBC
URL: https://github.com/apache/hive/pull/5683


-- 
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: gitbox-unsubscribe@hive.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org


Re: [PR] HIVE-26336: Add a connectTimeout parameter for JDBC [hive]

Posted by "deniskuzZ (via GitHub)" <gi...@apache.org>.
deniskuzZ commented on code in PR #5683:
URL: https://github.com/apache/hive/pull/5683#discussion_r2009711362


##########
jdbc/src/java/org/apache/hive/jdbc/HiveConnection.java:
##########
@@ -1433,20 +1434,23 @@ private String getSessionValue(String varName, String varDefault) {
   }
 
   // use socketTimeout from jdbc connection url. Thrift timeout needs to be in millis
-  private void setupLoginTimeout() {
+  private void setupTimeout() {
+    String connectTimeoutStr = sessConfMap.getOrDefault(JdbcConnectionParams.CONNECT_TIMEOUT, "0");
     String socketTimeoutStr = sessConfMap.getOrDefault(JdbcConnectionParams.SOCKET_TIMEOUT, "0");
-    long timeOut = 0;
+    long connectTimeoutMs = 0;
+    long socketTimeoutMs = 0;
     try {
-      timeOut = Long.parseLong(socketTimeoutStr);
+      connectTimeoutMs = Long.parseLong(connectTimeoutStr);
+      connectTimeout = (int) Math.max(0, Math.min(connectTimeoutMs, Integer.MAX_VALUE));
     } catch (NumberFormatException e) {
-      LOG.info("Failed to parse socketTimeout of value " + socketTimeoutStr);
+      LOG.info("Failed to parse connectTimeout of value " + connectTimeoutStr);
     }
-    if (timeOut > Integer.MAX_VALUE) {
-      loginTimeout = Integer.MAX_VALUE;
-    } else if (timeOut < 0) {
-      loginTimeout = 0;
-    } else {
-      loginTimeout = (int) timeOut;
+
+    try {
+      socketTimeoutMs = Long.parseLong(socketTimeoutStr);
+      connectTimeout = (int) Math.max(0, Math.min(socketTimeoutMs, Integer.MAX_VALUE));

Review Comment:
   shouldn't it be assigned to `socketTimeout`? after the refactor it was corrected



-- 
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: gitbox-unsubscribe@hive.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org


Re: [PR] HIVE-26336: Add a connectTimeout parameter for JDBC [hive]

Posted by "deniskuzZ (via GitHub)" <gi...@apache.org>.
deniskuzZ commented on code in PR #5683:
URL: https://github.com/apache/hive/pull/5683#discussion_r2009711362


##########
jdbc/src/java/org/apache/hive/jdbc/HiveConnection.java:
##########
@@ -1433,20 +1434,23 @@ private String getSessionValue(String varName, String varDefault) {
   }
 
   // use socketTimeout from jdbc connection url. Thrift timeout needs to be in millis
-  private void setupLoginTimeout() {
+  private void setupTimeout() {
+    String connectTimeoutStr = sessConfMap.getOrDefault(JdbcConnectionParams.CONNECT_TIMEOUT, "0");
     String socketTimeoutStr = sessConfMap.getOrDefault(JdbcConnectionParams.SOCKET_TIMEOUT, "0");
-    long timeOut = 0;
+    long connectTimeoutMs = 0;
+    long socketTimeoutMs = 0;
     try {
-      timeOut = Long.parseLong(socketTimeoutStr);
+      connectTimeoutMs = Long.parseLong(connectTimeoutStr);
+      connectTimeout = (int) Math.max(0, Math.min(connectTimeoutMs, Integer.MAX_VALUE));
     } catch (NumberFormatException e) {
-      LOG.info("Failed to parse socketTimeout of value " + socketTimeoutStr);
+      LOG.info("Failed to parse connectTimeout of value " + connectTimeoutStr);
     }
-    if (timeOut > Integer.MAX_VALUE) {
-      loginTimeout = Integer.MAX_VALUE;
-    } else if (timeOut < 0) {
-      loginTimeout = 0;
-    } else {
-      loginTimeout = (int) timeOut;
+
+    try {
+      socketTimeoutMs = Long.parseLong(socketTimeoutStr);
+      connectTimeout = (int) Math.max(0, Math.min(socketTimeoutMs, Integer.MAX_VALUE));

Review Comment:
   shouldn't it be assigned to `socketTimeout`?



-- 
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: gitbox-unsubscribe@hive.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org


Re: [PR] HIVE-26336: Add a connectTimeout parameter for JDBC [hive]

Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #5683:
URL: https://github.com/apache/hive/pull/5683#issuecomment-2747742256

   ## [![Quality Gate Passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/qg-passed-20px.png 'Quality Gate Passed')](https://sonarcloud.io/dashboard?id=apache_hive&pullRequest=5683) **Quality Gate passed**  
   Issues  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [3 New issues](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=5683&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/accepted-16px.png '') [0 Accepted issues](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=5683&issueStatuses=ACCEPTED)
   
   Measures  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_hive&pullRequest=5683&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_hive&pullRequest=5683&metric=new_coverage&view=list)  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0.0% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_hive&pullRequest=5683&metric=new_duplicated_lines_density&view=list)  
     
   [See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_hive&pullRequest=5683)
   
   


-- 
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: gitbox-unsubscribe@hive.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org


Re: [PR] HIVE-26336: Add a connectTimeout parameter for JDBC [hive]

Posted by "deniskuzZ (via GitHub)" <gi...@apache.org>.
deniskuzZ commented on code in PR #5683:
URL: https://github.com/apache/hive/pull/5683#discussion_r2009067412


##########
jdbc/src/java/org/apache/hive/jdbc/HiveConnection.java:
##########
@@ -176,7 +176,8 @@ public class HiveConnection implements java.sql.Connection {
   private SQLWarning warningChain = null;
   private TSessionHandle sessHandle = null;
   private final List<TProtocolVersion> supportedProtocols = new LinkedList<TProtocolVersion>();
-  private int loginTimeout = 0;
+  private int connectTimeout = 0;
+  private int socketTimtout = 0;

Review Comment:
   typo



-- 
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: gitbox-unsubscribe@hive.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org


Re: [PR] HIVE-26336: Add a connectTimeout parameter for JDBC [hive]

Posted by "deniskuzZ (via GitHub)" <gi...@apache.org>.
deniskuzZ commented on code in PR #5683:
URL: https://github.com/apache/hive/pull/5683#discussion_r2009067580


##########
jdbc/src/java/org/apache/hive/jdbc/HiveConnection.java:
##########
@@ -1433,20 +1434,23 @@ private String getSessionValue(String varName, String varDefault) {
   }
 
   // use socketTimeout from jdbc connection url. Thrift timeout needs to be in millis
-  private void setupLoginTimeout() {
+  private void setupTimeout() {

Review Comment:
   `setupTimeouts`



-- 
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: gitbox-unsubscribe@hive.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org


Re: [PR] HIVE-26336: Add a connectTimeout parameter for JDBC [hive]

Posted by "YuxiangZhuang (via GitHub)" <gi...@apache.org>.
YuxiangZhuang commented on code in PR #5683:
URL: https://github.com/apache/hive/pull/5683#discussion_r2011181044


##########
jdbc/src/java/org/apache/hive/jdbc/HiveConnection.java:
##########
@@ -1433,20 +1434,23 @@ private String getSessionValue(String varName, String varDefault) {
   }
 
   // use socketTimeout from jdbc connection url. Thrift timeout needs to be in millis
-  private void setupLoginTimeout() {
+  private void setupTimeout() {
+    String connectTimeoutStr = sessConfMap.getOrDefault(JdbcConnectionParams.CONNECT_TIMEOUT, "0");
     String socketTimeoutStr = sessConfMap.getOrDefault(JdbcConnectionParams.SOCKET_TIMEOUT, "0");
-    long timeOut = 0;
+    long connectTimeoutMs = 0;
+    long socketTimeoutMs = 0;
     try {
-      timeOut = Long.parseLong(socketTimeoutStr);
+      connectTimeoutMs = Long.parseLong(connectTimeoutStr);
+      connectTimeout = (int) Math.max(0, Math.min(connectTimeoutMs, Integer.MAX_VALUE));
     } catch (NumberFormatException e) {
-      LOG.info("Failed to parse socketTimeout of value " + socketTimeoutStr);
+      LOG.info("Failed to parse connectTimeout of value " + connectTimeoutStr);
     }
-    if (timeOut > Integer.MAX_VALUE) {
-      loginTimeout = Integer.MAX_VALUE;
-    } else if (timeOut < 0) {
-      loginTimeout = 0;
-    } else {
-      loginTimeout = (int) timeOut;
+
+    try {
+      socketTimeoutMs = Long.parseLong(socketTimeoutStr);
+      connectTimeout = (int) Math.max(0, Math.min(socketTimeoutMs, Integer.MAX_VALUE));

Review Comment:
   oh. thats a terrible mistake... thanks very much for the review 



-- 
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: gitbox-unsubscribe@hive.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org


Re: [PR] HIVE-26336: Add a connectTimeout parameter for JDBC [hive]

Posted by "YuxiangZhuang (via GitHub)" <gi...@apache.org>.
YuxiangZhuang commented on code in PR #5683:
URL: https://github.com/apache/hive/pull/5683#discussion_r2011184741


##########
jdbc/src/java/org/apache/hive/jdbc/HiveConnection.java:
##########
@@ -806,9 +807,9 @@ protected boolean requestIsAborted(final HttpRequest request) {
 
     // set the specified timeout (socketTimeout jdbc param) for http connection as well
     RequestConfig config = RequestConfig.custom()
-            .setConnectTimeout(loginTimeout * 1000)
-            .setConnectionRequestTimeout(loginTimeout * 1000)
-            .setSocketTimeout(loginTimeout * 1000).build();
+            .setConnectTimeout(connectTimeout)

Review Comment:
   this indead introduce a breaking change. we should use msec instead of sec.



-- 
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: gitbox-unsubscribe@hive.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org


Re: [PR] HIVE-26336: Add a connectTimeout parameter for JDBC [hive]

Posted by "deniskuzZ (via GitHub)" <gi...@apache.org>.
deniskuzZ commented on code in PR #5683:
URL: https://github.com/apache/hive/pull/5683#discussion_r2009722149


##########
jdbc/src/test/org/apache/hive/jdbc/TestHiveConnection.java:
##########
@@ -72,6 +72,7 @@ public void testHiveConnectionParameters() throws SQLException, ZooKeeperHiveCli
     Assert.assertEquals("http", params.getSessionVars().get(JdbcConnectionParams.TRANSPORT_MODE));
     Assert.assertEquals("cliservice", params.getSessionVars().get(JdbcConnectionParams.HTTP_PATH));
     Assert.assertEquals("60", params.getSessionVars().get(JdbcConnectionParams.SOCKET_TIMEOUT));

Review Comment:
   that meant 60 sec before, now it's 60 msec, isn't it?



-- 
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: gitbox-unsubscribe@hive.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org


Re: [PR] HIVE-26336: Add a connectTimeout parameter for JDBC [hive]

Posted by "deniskuzZ (via GitHub)" <gi...@apache.org>.
deniskuzZ commented on code in PR #5683:
URL: https://github.com/apache/hive/pull/5683#discussion_r2009069702


##########
jdbc/src/java/org/apache/hive/jdbc/HiveConnection.java:
##########
@@ -1433,20 +1434,23 @@ private String getSessionValue(String varName, String varDefault) {
   }
 
   // use socketTimeout from jdbc connection url. Thrift timeout needs to be in millis
-  private void setupLoginTimeout() {
+  private void setupTimeout() {
+    String connectTimeoutStr = sessConfMap.getOrDefault(JdbcConnectionParams.CONNECT_TIMEOUT, "0");
     String socketTimeoutStr = sessConfMap.getOrDefault(JdbcConnectionParams.SOCKET_TIMEOUT, "0");
-    long timeOut = 0;
+    long connectTimeoutMs = 0;
+    long socketTimeoutMs = 0;
     try {
-      timeOut = Long.parseLong(socketTimeoutStr);
+      connectTimeoutMs = Long.parseLong(connectTimeoutStr);
+      connectTimeout = (int) Math.max(0, Math.min(connectTimeoutMs, Integer.MAX_VALUE));
     } catch (NumberFormatException e) {
-      LOG.info("Failed to parse socketTimeout of value " + socketTimeoutStr);
+      LOG.info("Failed to parse connectTimeout of value " + connectTimeoutStr);
     }
-    if (timeOut > Integer.MAX_VALUE) {
-      loginTimeout = Integer.MAX_VALUE;
-    } else if (timeOut < 0) {
-      loginTimeout = 0;
-    } else {
-      loginTimeout = (int) timeOut;
+
+    try {

Review Comment:
   can you extract common logic into method `getTimeoutVar(Map<String, String> sessConfMap, String configKey)
   ````
   connectionTimeout = getTimeoutVar(sessConfMap, JdbcConnectionParams.CONNECT_TIMEOUT);
   socketTimeout = getTimeoutVar(sessConfMap, JdbcConnectionParams.SOCKET_TIMEOUT);
   ````



##########
jdbc/src/java/org/apache/hive/jdbc/HiveConnection.java:
##########
@@ -1433,20 +1434,23 @@ private String getSessionValue(String varName, String varDefault) {
   }
 
   // use socketTimeout from jdbc connection url. Thrift timeout needs to be in millis
-  private void setupLoginTimeout() {
+  private void setupTimeout() {
+    String connectTimeoutStr = sessConfMap.getOrDefault(JdbcConnectionParams.CONNECT_TIMEOUT, "0");
     String socketTimeoutStr = sessConfMap.getOrDefault(JdbcConnectionParams.SOCKET_TIMEOUT, "0");
-    long timeOut = 0;
+    long connectTimeoutMs = 0;
+    long socketTimeoutMs = 0;
     try {
-      timeOut = Long.parseLong(socketTimeoutStr);
+      connectTimeoutMs = Long.parseLong(connectTimeoutStr);
+      connectTimeout = (int) Math.max(0, Math.min(connectTimeoutMs, Integer.MAX_VALUE));
     } catch (NumberFormatException e) {
-      LOG.info("Failed to parse socketTimeout of value " + socketTimeoutStr);
+      LOG.info("Failed to parse connectTimeout of value " + connectTimeoutStr);
     }
-    if (timeOut > Integer.MAX_VALUE) {
-      loginTimeout = Integer.MAX_VALUE;
-    } else if (timeOut < 0) {
-      loginTimeout = 0;
-    } else {
-      loginTimeout = (int) timeOut;
+
+    try {

Review Comment:
   can you extract common logic into method `getTimeoutVar(Map<String, String> sessConfMap, String configKey)`
   ````
   connectionTimeout = getTimeoutVar(sessConfMap, JdbcConnectionParams.CONNECT_TIMEOUT);
   socketTimeout = getTimeoutVar(sessConfMap, JdbcConnectionParams.SOCKET_TIMEOUT);
   ````



-- 
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: gitbox-unsubscribe@hive.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org


Re: [PR] HIVE-26336: Add a connectTimeout parameter for JDBC [hive]

Posted by "YuxiangZhuang (via GitHub)" <gi...@apache.org>.
YuxiangZhuang commented on PR #5683:
URL: https://github.com/apache/hive/pull/5683#issuecomment-2716562693

   Thank you very much for your guidance. I have fixed the previous buid errors, and all the tests have been successfully run now. May I ask if it is possible to proceed with the merge?
   @zhangbutao 


-- 
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: gitbox-unsubscribe@hive.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org


Re: [PR] HIVE-26336: Add a connectTimeout parameter for JDBC [hive]

Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #5683:
URL: https://github.com/apache/hive/pull/5683#issuecomment-2760108510

   ## [![Quality Gate Passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/qg-passed-20px.png 'Quality Gate Passed')](https://sonarcloud.io/dashboard?id=apache_hive&pullRequest=5683) **Quality Gate passed**  
   Issues  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [1 New issue](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=5683&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/accepted-16px.png '') [0 Accepted issues](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=5683&issueStatuses=ACCEPTED)
   
   Measures  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_hive&pullRequest=5683&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_hive&pullRequest=5683&metric=new_coverage&view=list)  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0.0% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_hive&pullRequest=5683&metric=new_duplicated_lines_density&view=list)  
     
   [See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_hive&pullRequest=5683)
   
   


-- 
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: gitbox-unsubscribe@hive.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org


Re: [PR] HIVE-26336: Add a connectTimeout parameter for JDBC [hive]

Posted by "YuxiangZhuang (via GitHub)" <gi...@apache.org>.
YuxiangZhuang commented on code in PR #5683:
URL: https://github.com/apache/hive/pull/5683#discussion_r2009388560


##########
common/src/java/org/apache/hadoop/hive/common/auth/HiveAuthUtils.java:
##########
@@ -73,67 +73,61 @@ public static <T extends TTransport> T configureThriftMaxMessageSize(T transport
    * will default to Thrift library default.
    * @param host Host to connect to.
    * @param port Port to connect to.
-   * @param loginTimeout Socket timeout (0 means no timeout).
+   * @param socketTimeout Socket timeout (0 means no timeout).
+   * @param connectTimeout Connection timeout (0 means no timeout).
    * @return TTransport TSocket for host/port.
    */
-  public static TTransport getSocketTransport(String host, int port, int loginTimeout) throws TTransportException {
-    return getSocketTransport(host, port, loginTimeout, /* maxMessageSize */ -1);
+  public static TTransport getSocketTransport(String host, int port, int socketTimeout, int connectTimeout) throws TTransportException {
+    return getSocketTransport(host, port, socketTimeout, connectTimeout, /* maxMessageSize */ -1);
   }
 
   /**
    * Create a TSocket for the provided host and port with specified loginTimeout and maxMessageSize.
    * will default to Thrift library default.
    * @param host Host to connect to.
    * @param port Port to connect to.
-   * @param loginTimeout Socket timeout (0 means no timeout).
+   * @param socketTimeout Socket timeout (0 means no timeout).
+   * @param connectTimeout Connection timeout (0 means no timeout).
    * @param maxMessageSize Size in bytes for max allowable Thrift message size, less than or equal to 0
    *                       results in using the Thrift library default.
    * @return TTransport TSocket for host/port
    */
-  public static TTransport getSocketTransport(String host, int port, int loginTimeout, int maxMessageSize)
-      throws TTransportException {
-    TSocket tSocket = new TSocket(host, port, loginTimeout);
+  public static TTransport getSocketTransport(String host, int port, int socketTimeout, int connectTimeout, int maxMessageSize)
+          throws TTransportException {
+    TSocket tSocket = new TSocket(host, port, socketTimeout);
+    tSocket.setConnectTimeout(connectTimeout);
     return configureThriftMaxMessageSize(tSocket, maxMessageSize);
   }
 
-  public static TTransport getSSLSocket(String host, int port, int loginTimeout, TSSLTransportParameters params,
+  public static TTransport getSSLSocket(String host, int port, int socketTimeout, int connectTimeout, TSSLTransportParameters params,

Review Comment:
   i refer to org.apache.thrift.transport.TSocket#TSocket(org.apache.thrift.TConfiguration, java.lang.String, int, int, int), which the order of params is: `TConfiguration config, String host, int port, int socketTimeout, int connectTimeout`



-- 
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: gitbox-unsubscribe@hive.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org


Re: [PR] HIVE-26336: Add a connectTimeout parameter for JDBC [hive]

Posted by "deniskuzZ (via GitHub)" <gi...@apache.org>.
deniskuzZ commented on code in PR #5683:
URL: https://github.com/apache/hive/pull/5683#discussion_r2009069794


##########
jdbc/src/java/org/apache/hive/jdbc/HiveConnection.java:
##########
@@ -1433,20 +1434,23 @@ private String getSessionValue(String varName, String varDefault) {
   }
 
   // use socketTimeout from jdbc connection url. Thrift timeout needs to be in millis
-  private void setupLoginTimeout() {
+  private void setupTimeout() {
+    String connectTimeoutStr = sessConfMap.getOrDefault(JdbcConnectionParams.CONNECT_TIMEOUT, "0");
     String socketTimeoutStr = sessConfMap.getOrDefault(JdbcConnectionParams.SOCKET_TIMEOUT, "0");
-    long timeOut = 0;
+    long connectTimeoutMs = 0;
+    long socketTimeoutMs = 0;
     try {
-      timeOut = Long.parseLong(socketTimeoutStr);
+      connectTimeoutMs = Long.parseLong(connectTimeoutStr);
+      connectTimeout = (int) Math.max(0, Math.min(connectTimeoutMs, Integer.MAX_VALUE));
     } catch (NumberFormatException e) {
-      LOG.info("Failed to parse socketTimeout of value " + socketTimeoutStr);
+      LOG.info("Failed to parse connectTimeout of value " + connectTimeoutStr);
     }
-    if (timeOut > Integer.MAX_VALUE) {
-      loginTimeout = Integer.MAX_VALUE;
-    } else if (timeOut < 0) {
-      loginTimeout = 0;
-    } else {
-      loginTimeout = (int) timeOut;
+
+    try {
+      socketTimeoutMs = Long.parseLong(socketTimeoutStr);
+      connectTimeout = (int) Math.max(0, Math.min(socketTimeoutMs, Integer.MAX_VALUE));

Review Comment:
   that seems wrong



-- 
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: gitbox-unsubscribe@hive.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org


Re: [PR] HIVE-26336: Add a connectTimeout parameter for JDBC [hive]

Posted by "deniskuzZ (via GitHub)" <gi...@apache.org>.
deniskuzZ commented on code in PR #5683:
URL: https://github.com/apache/hive/pull/5683#discussion_r2009069702


##########
jdbc/src/java/org/apache/hive/jdbc/HiveConnection.java:
##########
@@ -1433,20 +1434,23 @@ private String getSessionValue(String varName, String varDefault) {
   }
 
   // use socketTimeout from jdbc connection url. Thrift timeout needs to be in millis
-  private void setupLoginTimeout() {
+  private void setupTimeout() {
+    String connectTimeoutStr = sessConfMap.getOrDefault(JdbcConnectionParams.CONNECT_TIMEOUT, "0");
     String socketTimeoutStr = sessConfMap.getOrDefault(JdbcConnectionParams.SOCKET_TIMEOUT, "0");
-    long timeOut = 0;
+    long connectTimeoutMs = 0;
+    long socketTimeoutMs = 0;
     try {
-      timeOut = Long.parseLong(socketTimeoutStr);
+      connectTimeoutMs = Long.parseLong(connectTimeoutStr);
+      connectTimeout = (int) Math.max(0, Math.min(connectTimeoutMs, Integer.MAX_VALUE));
     } catch (NumberFormatException e) {
-      LOG.info("Failed to parse socketTimeout of value " + socketTimeoutStr);
+      LOG.info("Failed to parse connectTimeout of value " + connectTimeoutStr);
     }
-    if (timeOut > Integer.MAX_VALUE) {
-      loginTimeout = Integer.MAX_VALUE;
-    } else if (timeOut < 0) {
-      loginTimeout = 0;
-    } else {
-      loginTimeout = (int) timeOut;
+
+    try {

Review Comment:
   can you extract common logic into method `getTimeoutFor(String configKey)
   ````
   connectTimeout = getTimeoutFor(JdbcConnectionParams.CONNECT_TIMEOUT);
   socketTimeout = getTimeoutFor(JdbcConnectionParams.SOCKET_TIMEOUT);
   ````



-- 
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: gitbox-unsubscribe@hive.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org


Re: [PR] HIVE-26336: Add a connectTimeout parameter for JDBC [hive]

Posted by "deniskuzZ (via GitHub)" <gi...@apache.org>.
deniskuzZ commented on code in PR #5683:
URL: https://github.com/apache/hive/pull/5683#discussion_r2011665779


##########
jdbc/src/java/org/apache/hive/jdbc/HiveConnection.java:
##########
@@ -932,7 +933,7 @@ private TTransport createUnderlyingTransport() throws TTransportException, SQLEx
       String sslTrustStorePassword = Utils.getPassword(sessConfMap, JdbcConnectionParams.SSL_TRUST_STORE_PASSWORD);
 
       if (sslTrustStore == null || sslTrustStore.isEmpty()) {
-        transport = HiveAuthUtils.getSSLSocket(host, port, loginTimeout, maxMessageSize);
+        transport = HiveAuthUtils.getSSLSocket(host, port, socketTimeout, connectTimeout, maxMessageSize);

Review Comment:
   that is how it was done before
   ````
   RequestConfig config = RequestConfig.custom()
     .setConnectTimeout(loginTimeout * 1000)
     .setConnectionRequestTimeout(loginTimeout * 1000)
     .setSocketTimeout(loginTimeout * 1000).build();
   ````
   I think you can do the conversion in the `getTimestampVar`



-- 
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: gitbox-unsubscribe@hive.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org


Re: [PR] HIVE-26336: Add a connectTimeout parameter for JDBC [hive]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] closed pull request #5683: HIVE-26336: Add a connectTimeout parameter for JDBC
URL: https://github.com/apache/hive/pull/5683


-- 
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: gitbox-unsubscribe@hive.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org


Re: [PR] HIVE-26336: Add a connectTimeout parameter for JDBC [hive]

Posted by "YuxiangZhuang (via GitHub)" <gi...@apache.org>.
YuxiangZhuang commented on code in PR #5683:
URL: https://github.com/apache/hive/pull/5683#discussion_r2017831240


##########
jdbc/src/java/org/apache/hive/jdbc/HiveConnection.java:
##########
@@ -932,7 +933,7 @@ private TTransport createUnderlyingTransport() throws TTransportException, SQLEx
       String sslTrustStorePassword = Utils.getPassword(sessConfMap, JdbcConnectionParams.SSL_TRUST_STORE_PASSWORD);
 
       if (sslTrustStore == null || sslTrustStore.isEmpty()) {
-        transport = HiveAuthUtils.getSSLSocket(host, port, loginTimeout, maxMessageSize);
+        transport = HiveAuthUtils.getSSLSocket(host, port, socketTimeout, connectTimeout, maxMessageSize);

Review Comment:
   done the conversion in the `getTimeoutVar `



-- 
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: gitbox-unsubscribe@hive.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org


Re: [PR] HIVE-26336: Add a connectTimeout parameter for JDBC [hive]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #5683:
URL: https://github.com/apache/hive/pull/5683#issuecomment-3419095616

   This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
   Feel free to reach out on the dev@hive.apache.org list if the patch is in need of reviews.


-- 
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: gitbox-unsubscribe@hive.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org