pan3793 commented on PR #3379:
URL: https://github.com/apache/hive/pull/3379#issuecomment-1185254554

   > Introduce new JDBC parameter `connectTimeout` w/ exsiting `socketTimeout`, 
ignore `DriverManager.loginTimeout`
   
   Implement it as we discussed before, but I found it not easy to add 
integration tests.
   
   The following tests are what I want to add at first, but finally, I realized 
it does not make sense, because JDBC always runs in async mode, a "sleep" query 
will not block server return the response immediately.
   
   ```
   @Test(expected = SocketTimeoutException.class)
     public void testThrowSocketTimeoutException() throws Exception {
       String url = miniHS2.getJdbcURL("default", "socketTimeout=5000");
       try (HiveConnection conn = (HiveConnection) 
DriverManager.getConnection(url)) {
         try (Statement stmt = conn.createStatement()) {
           stmt.executeQuery("SELECT reflect('java.lang.Thread', 'sleep', 
bigint(6000))");
         }
       }
     }
   
     @Test
     public void testConnectTimeoutDoesNotAffectSocketTime() throws Exception {
       String url = miniHS2.getJdbcURL("default", "connectTimeout=5000");
       try (HiveConnection conn = (HiveConnection) 
DriverManager.getConnection(url)) {
         try (Statement stmt = conn.createStatement()) {
           stmt.executeQuery("SELECT reflect('java.lang.Thread', 'sleep', 
bigint(6000))");
         }
       }
     }
   ```


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to