From 6258c19736bd227aeca36d04c0d38404f7568952 Mon Sep 17 00:00:00 2001 From: saihemanth Date: Mon, 27 Oct 2025 15:57:43 -0700 Subject: [PATCH 1/3] HIVE-29293: Restrict config 'mapreduce.job.queuename' at tez session --- common/src/java/org/apache/hadoop/hive/conf/HiveConf.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/common/src/java/org/apache/hadoop/hive/conf/HiveConf.java b/common/src/java/org/apache/hadoop/hive/conf/HiveConf.java index 72519be0cda2..08cda649d766 100644 --- a/common/src/java/org/apache/hadoop/hive/conf/HiveConf.java +++ b/common/src/java/org/apache/hadoop/hive/conf/HiveConf.java @@ -4087,10 +4087,10 @@ public static enum ConfVars { HIVE_SERVER2_TEZ_SESSION_MAX_INIT_THREADS("hive.server2.tez.sessions.init.threads", 16, "If hive.server2.tez.initialize.default.sessions is enabled, the maximum number of\n" + "threads to use to initialize the default sessions."), - HIVE_SERVER2_TEZ_SESSION_RESTRICTED_CONFIGS("hive.server2.tez.sessions.restricted.configs", "", - "The configuration settings that cannot be set when submitting jobs to HiveServer2. If\n" + - "any of these are set to values different from those in the server configuration, an\n" + - "exception will be thrown."), + HIVE_SERVER2_TEZ_SESSION_RESTRICTED_CONFIGS("hive.server2.tez.sessions.restricted.configs", + "mapreduce.job.queuename", "The configuration settings that cannot be set when " + + "submitting jobs to HiveServer2. If any of these are set to values different from those in the server " + + "configuration, an exception will be thrown."), HIVE_SERVER2_TEZ_SESSION_CUSTOM_QUEUE_ALLOWED("hive.server2.tez.sessions.custom.queue.allowed", "true", new StringSet("true", "false", "ignore"), "Whether Tez session pool should allow submitting queries to custom queues. The options\n" + From d1613010892783b73cc418c1fd08131faae124fc Mon Sep 17 00:00:00 2001 From: saihemanth Date: Wed, 29 Oct 2025 14:53:37 -0700 Subject: [PATCH 2/3] Address review comments --- common/src/java/org/apache/hadoop/hive/conf/HiveConf.java | 8 ++++---- .../hadoop/hive/ql/exec/tez/TezSessionPoolManager.java | 5 +++++ 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/common/src/java/org/apache/hadoop/hive/conf/HiveConf.java b/common/src/java/org/apache/hadoop/hive/conf/HiveConf.java index 08cda649d766..f41d38eca31b 100644 --- a/common/src/java/org/apache/hadoop/hive/conf/HiveConf.java +++ b/common/src/java/org/apache/hadoop/hive/conf/HiveConf.java @@ -4087,10 +4087,10 @@ public static enum ConfVars { HIVE_SERVER2_TEZ_SESSION_MAX_INIT_THREADS("hive.server2.tez.sessions.init.threads", 16, "If hive.server2.tez.initialize.default.sessions is enabled, the maximum number of\n" + "threads to use to initialize the default sessions."), - HIVE_SERVER2_TEZ_SESSION_RESTRICTED_CONFIGS("hive.server2.tez.sessions.restricted.configs", - "mapreduce.job.queuename", "The configuration settings that cannot be set when " + - "submitting jobs to HiveServer2. If any of these are set to values different from those in the server " + - "configuration, an exception will be thrown."), + HIVE_SERVER2_TEZ_SESSION_RESTRICTED_CONFIGS("hive.server2.tez.sessions.restricted.configs", "", + "The configuration settings that cannot be set when submitting jobs to HiveServer2. If\n" + + "any of these are set to values different from those in the server configuration, an\n" + + "exception will be thrown."), HIVE_SERVER2_TEZ_SESSION_CUSTOM_QUEUE_ALLOWED("hive.server2.tez.sessions.custom.queue.allowed", "true", new StringSet("true", "false", "ignore"), "Whether Tez session pool should allow submitting queries to custom queues. The options\n" + diff --git a/ql/src/java/org/apache/hadoop/hive/ql/exec/tez/TezSessionPoolManager.java b/ql/src/java/org/apache/hadoop/hive/ql/exec/tez/TezSessionPoolManager.java index 41bc79c935f5..375500580821 100644 --- a/ql/src/java/org/apache/hadoop/hive/ql/exec/tez/TezSessionPoolManager.java +++ b/ql/src/java/org/apache/hadoop/hive/ql/exec/tez/TezSessionPoolManager.java @@ -40,6 +40,8 @@ import org.apache.hadoop.hive.ql.wm.Trigger; import org.apache.hadoop.hive.ql.wm.TriggerActionHandler; import org.apache.hadoop.hive.shims.Utils; +import org.apache.hadoop.mapred.JobContext; +import org.apache.hadoop.yarn.conf.YarnConfiguration; import org.apache.tez.dag.api.TezConfiguration; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -235,6 +237,9 @@ private TezSessionState getSession(HiveConf conf, boolean doOpen) throws Excepti // able to handle not being initialized. Perhaps we should get rid of the instance and // move the setupPool code to ctor. For now, at least hasInitialSessions will be false. String queueName = conf.get(TezConfiguration.TEZ_QUEUE_NAME); + if (queueName == null || queueName.isEmpty()) { + queueName = conf.get(JobContext.QUEUE_NAME, YarnConfiguration.DEFAULT_QUEUE_NAME); + } boolean hasQueue = (queueName != null) && !queueName.isEmpty(); if (hasQueue) { switch (customQueueAllowed) { From 63ef9ce972fdaae1384101c6f44cc014855ee744 Mon Sep 17 00:00:00 2001 From: saihemanth Date: Mon, 3 Nov 2025 11:52:02 -0800 Subject: [PATCH 3/3] Address test failures --- .../apache/hadoop/hive/ql/exec/tez/TezSessionPoolManager.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ql/src/java/org/apache/hadoop/hive/ql/exec/tez/TezSessionPoolManager.java b/ql/src/java/org/apache/hadoop/hive/ql/exec/tez/TezSessionPoolManager.java index 375500580821..0088493401fc 100644 --- a/ql/src/java/org/apache/hadoop/hive/ql/exec/tez/TezSessionPoolManager.java +++ b/ql/src/java/org/apache/hadoop/hive/ql/exec/tez/TezSessionPoolManager.java @@ -237,7 +237,8 @@ private TezSessionState getSession(HiveConf conf, boolean doOpen) throws Excepti // able to handle not being initialized. Perhaps we should get rid of the instance and // move the setupPool code to ctor. For now, at least hasInitialSessions will be false. String queueName = conf.get(TezConfiguration.TEZ_QUEUE_NAME); - if (queueName == null || queueName.isEmpty()) { + String tez_queues = HiveConf.getVar(conf, ConfVars.HIVE_SERVER2_TEZ_DEFAULT_QUEUES); + if ((queueName == null || queueName.isEmpty()) && (tez_queues == null || tez_queues.isEmpty())) { queueName = conf.get(JobContext.QUEUE_NAME, YarnConfiguration.DEFAULT_QUEUE_NAME); } boolean hasQueue = (queueName != null) && !queueName.isEmpty();