You are viewing a plain text version of this content. The canonical link for it is here.
Posted to gitbox@hive.apache.org by GitBox <gi...@apache.org> on 2022/06/21 09:37:14 UTC

[GitHub] [hive] pvary commented on a diff in pull request #3379: [HIVE-26336] Hive JDBC Driver should respect JDBC DriverManager#loginTimeout

pvary commented on code in PR #3379:
URL: https://github.com/apache/hive/pull/3379#discussion_r902394644


##########
jdbc/src/java/org/apache/hive/jdbc/HiveConnection.java:
##########
@@ -1329,21 +1328,32 @@ private String getSessionValue(String varName, String varDefault) {
     return varValue;
   }
 
-  // use socketTimeout from jdbc connection url. Thrift timeout needs to be in millis
-  private void setupLoginTimeout() {
-    String socketTimeoutStr = sessConfMap.getOrDefault(JdbcConnectionParams.SOCKET_TIMEOUT, "0");
-    long timeOut = 0;
-    try {
-      timeOut = Long.parseLong(socketTimeoutStr);
-    } catch (NumberFormatException e) {
-      LOG.info("Failed to parse socketTimeout of value " + socketTimeoutStr);
-    }
-    if (timeOut > Integer.MAX_VALUE) {
-      loginTimeout = Integer.MAX_VALUE;
-    } else if (timeOut < 0) {
-      loginTimeout = 0;
+  // For loginTimeout, prefer to use loginTimeout (in milliseconds) from jdbc connection url, and
+  // fallback to use DriverManger#getLoginTimeout (in seconds).
+  // For socketTimeout, use socketTimeout (in milliseconds) from jdbc connection url if present.
+  private void setupTimeout() {
+    long _loginTimeout = 0;

Review Comment:
   nit: we prefer not to use `_` in the variable names



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