You are viewing a plain text version of this content. The canonical link for it is here.
Posted to gitbox@hive.apache.org by "deniskuzZ (via GitHub)" <gi...@apache.org> on 2026/07/06 08:41:09 UTC
Re: [PR] HIVE-28265: Fix JDBC timeout message for hive.query.timeout.seconds [hive]
deniskuzZ commented on code in PR #6412:
URL: https://github.com/apache/hive/pull/6412#discussion_r3527486760
##########
jdbc/src/java/org/apache/hive/jdbc/HiveStatement.java:
##########
@@ -398,20 +398,93 @@ private TGetOperationStatusResp waitForResultSetStatus() throws SQLException {
return statusResp;
}
+ /**
+ * Returns the timeout message for a {@code TIMEDOUT_STATE} response.
+ * Uses the server error message when the SQL state is {@code HYT00} ("timeout expired"),
+ * which indicates that the server set a precise message. Otherwise falls back to a
+ * locally derived message from {@link #setQueryTimeout(int)} or the URL-seeded
+ * {@code hive.query.timeout.seconds} value on the connection.
+ */
+ private String sqlTimeoutMessageForTimedOutState(String serverMessage, String sqlState) {
+ if ("HYT00".equals(sqlState) && StringUtils.isNotBlank(serverMessage)) {
+ return serverMessage;
+ }
+ long effectiveSec = resolveEffectiveTimeoutSecondsForMessage();
+ if (effectiveSec > 0) {
+ return "Query timed out after " + effectiveSec + " seconds";
+ }
+ return "Query timed out";
+ }
+
+ private long resolveEffectiveTimeoutSecondsForMessage() {
+ if (queryTimeout > 0) {
+ return queryTimeout;
+ }
+ long tracked = connection.getSessionQueryTimeoutSeconds();
+ if (tracked > 0) {
+ return tracked;
+ }
+ return 0L;
+ }
+
+ private SQLException sqlExceptionForCanceledState(TGetOperationStatusResp statusResp) {
Review Comment:
drop this and keep the original ternary operator - not scope for your 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