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


##########
jdbc/src/java/org/apache/hive/jdbc/HiveStatement.java:
##########
@@ -398,6 +407,70 @@ private TGetOperationStatusResp waitForResultSetStatus() 
throws SQLException {
     return statusResp;
   }
 
+  /**
+   * When {@code SET hive.query.timeout.seconds=...} succeeds, remember the 
effective value on the
+   * connection so {@code TIMEDOUT_STATE} can report it if the server omits 
{@code errorMessage}
+   * (HIVE-28265).
+   */
+  private void trackSessionQueryTimeoutIfSet(String sql) {
+    if (sql == null) {
+      return;
+    }
+    Matcher m = SET_HIVE_QUERY_TIMEOUT_SECONDS.matcher(sql);
+    Long lastSec = null;
+    while (m.find()) {

Review Comment:
   Thanks again for pointing at HIVE-28265 first — we stayed focused on the 
wrong error message, not changing how timeout itself works.
   
   What we changed in this update
   
   1. HiveStatement — We no longer strip the ; Query ID: … suffix from the 
timeout string. When the server returns a usable message, the JDBC client 
passes it through as HS2/HiveSQLException format it (same as you see in 
Beeline). The HIVE-28265 logic is unchanged for the broken paths: empty error 
text or “after 0 seconds”, where we still derive the text from 
Statement#setQueryTimeout and the last SET hive.query.timeout.seconds tracked 
on the connection.
   
   2. TestJdbcDriver2 — Assertions now require the message to start with Query 
timed out after 1 seconds and not contain after 0 seconds, instead of matching 
the entire string exactly. That matches real HS2 output (…; Query ID: …) and 
still guards the original bug.



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