ashniku commented on code in PR #6412:
URL: https://github.com/apache/hive/pull/6412#discussion_r3044656061


##########
itests/hive-unit/src/test/java/org/apache/hive/jdbc/TestJdbcDriver2.java:
##########
@@ -2680,6 +2712,37 @@ public void testQueryTimeout() throws Exception {
     stmt.close();
   }
 
+  /**
+   * HIVE-28265: hive.query.timeout.seconds drives the server-side timer, but 
the JDBC client
+   * must not report "0 seconds" when Statement#setQueryTimeout was not used.
+   */
+  @Test
+  public void testQueryTimeoutMessageUsesHiveConf() throws Exception {
+    String udfName = SleepMsUDF.class.getName();
+    Statement stmt1 = con.createStatement();
+    stmt1.execute("create temporary function sleepMsUDF as '" + udfName + "'");
+    stmt1.close();
+
+    Statement stmt = con.createStatement();
+    stmt.execute("set hive.query.timeout.seconds=1s");
+
+    try {
+      stmt.executeQuery("select sleepMsUDF(t1.under_col, 5) as u0, 
t1.under_col as u1, "
+          + "t2.under_col as u2 from " + tableName + " t1 join " + tableName
+          + " t2 on t1.under_col = t2.under_col");
+      fail("Expecting SQLTimeoutException");
+    } catch (SQLTimeoutException e) {
+      assertNotNull(e);
+      assertTrue("Message should include session timeout (1s): " + 
e.getMessage(),
+          isQueryTimedOutAfterOneSecondMessage(e.getMessage()));
+      assertFalse("Message should not claim 0 seconds (HIVE-28265): " + 
e.getMessage(),

Review Comment:
   Removed assertFalse(..., "after 0 seconds") from 
testQueryTimeoutMessageUsesHiveConf.



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