ashniku commented on code in PR #6412:
URL: https://github.com/apache/hive/pull/6412#discussion_r3457810378
##########
jdbc/src/java/org/apache/hive/jdbc/HiveConnection.java:
##########
@@ -190,6 +201,48 @@ public class HiveConnection implements java.sql.Connection
{
public TCLIService.Iface getClient() { return client; }
+ /**
+ * Updates the tracked {@code hive.query.timeout.seconds} value (in seconds)
on this connection.
+ * Called at connect time from the JDBC URL hive-conf map, and may be called
again later if needed.
+ */
+ void setSessionQueryTimeoutSeconds(long seconds) {
+ sessionQueryTimeoutSeconds.set(seconds);
+ }
+
+ /**
+ * If the JDBC URL supplied {@code hive.query.timeout.seconds} (via the
{@code ?hive_conf_list}
+ * segment), parses and stores the value so that {@link
#getSessionQueryTimeoutSeconds()} can
+ * return it for timeout error messages. This runs once at connect time and
does not affect the
+ * server-side configuration, which is applied separately in {@link
#openSession()}.
+ */
+ private void applySessionQueryTimeoutFromJdbcUrl() {
+ Map<String, String> hiveConfs = connParams.getHiveConfs();
+ if (hiveConfs == null || hiveConfs.isEmpty()) {
+ return;
+ }
+ String raw = hiveConfs.get(ConfVars.HIVE_QUERY_TIMEOUT_SECONDS.varname);
+ if (StringUtils.isBlank(raw)) {
+ return;
+ }
+ try {
+ HiveConf conf = new HiveConf();
+ conf.set(ConfVars.HIVE_QUERY_TIMEOUT_SECONDS.varname, raw.trim());
+ long sec = HiveConf.getTimeVar(conf,
ConfVars.HIVE_QUERY_TIMEOUT_SECONDS, TimeUnit.SECONDS);
+ if (sec > 0) {
+ setSessionQueryTimeoutSeconds(sec);
+ }
+ } catch (Exception e) {
+ LOG.debug("Could not parse {} from JDBC URL: {}",
ConfVars.HIVE_QUERY_TIMEOUT_SECONDS.varname, raw, e);
+ }
Review Comment:
I have changed it
--
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]