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