This is an automated email from the ASF dual-hosted git repository.
zhangbutao pushed a commit to branch branch-4.1
in repository https://gitbox.apache.org/repos/asf/hive.git
The following commit(s) were added to refs/heads/branch-4.1 by this push:
new cc2ab46bfb9 HIVE-23708: MergeFileTask#execute need to close JobClient
(#5933) (#5937)
cc2ab46bfb9 is described below
commit cc2ab46bfb9b4b8c5e0e5ae60c233f99adf0c02f
Author: Denys Kuzmenko <[email protected]>
AuthorDate: Mon Jul 7 15:36:19 2025 +0200
HIVE-23708: MergeFileTask#execute need to close JobClient (#5933) (#5937)
(cherry picked from commit 9dab9548d3d17127e5927a47980ede75380a5340)
---
.../hadoop/hive/ql/io/merge/MergeFileTask.java | 30 +++++++++++-----------
1 file changed, 15 insertions(+), 15 deletions(-)
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/io/merge/MergeFileTask.java
b/ql/src/java/org/apache/hadoop/hive/ql/io/merge/MergeFileTask.java
index dac1393976d..61559bc0ee1 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/io/merge/MergeFileTask.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/io/merge/MergeFileTask.java
@@ -18,6 +18,7 @@
package org.apache.hadoop.hive.ql.io.merge;
+import org.apache.hadoop.hive.metastore.conf.MetastoreConf;
import org.apache.hadoop.hive.ql.exec.mr.ExecDriver;
import org.apache.commons.lang3.StringUtils;
@@ -47,7 +48,6 @@
import org.apache.hadoop.mapred.RunningJob;
import org.apache.hadoop.mapreduce.MRJobConfig;
-import java.io.IOException;
import java.io.Serializable;
import java.util.concurrent.ThreadLocalRandom;
@@ -118,7 +118,7 @@ public int execute() {
String jobName = null;
if (noName && this.getQueryPlan() != null) {
- int maxlen = conf.getIntVar(HiveConf.ConfVars.HIVE_JOBNAME_LENGTH);
+ int maxlen = HiveConf.getIntVar(conf,
HiveConf.ConfVars.HIVE_JOBNAME_LENGTH);
jobName = Utilities.abbreviate(this.getQueryPlan().getQueryStr(),
maxlen - 6);
}
@@ -137,30 +137,30 @@ public int execute() {
Utilities.setMapWork(job, work, ctx.getMRTmpPath(), true);
// remove pwd from conf file so that job tracker doesn't show this logs
- String pwd = HiveConf.getVar(job, HiveConf.ConfVars.METASTORE_PWD);
+ String pwd = MetastoreConf.getVar(job, MetastoreConf.ConfVars.PWD);
if (pwd != null) {
- HiveConf.setVar(job, HiveConf.ConfVars.METASTORE_PWD, "HIVE");
+ MetastoreConf.setVar(job, MetastoreConf.ConfVars.PWD, "HIVE");
}
// submit the job
- JobClient jc = new JobClient(job);
+ try (JobClient jc = new JobClient(job)) {
+ // There is no need for @MergeFileTask to add extra jars.
- // There is no need for Mergefile Task to add extra jars.
+ // Make this client wait if job tracker is not behaving well.
+ Throttle.checkJobTracker(job, LOG);
- // make this client wait if job trcker is not behaving well.
- Throttle.checkJobTracker(job, LOG);
-
- // Finally SUBMIT the JOB!
- rj = jc.submitJob(job);
- this.jobID = rj.getJobID();
- returnVal = jobExecHelper.progress(rj, jc, ctx);
+ // Finally SUBMIT the JOB!
+ rj = jc.submitJob(job);
+ this.jobID = rj.getID().toString();
+ returnVal = jobExecHelper.progress(rj, jc, ctx);
+ }
success = (returnVal == 0);
} catch (Exception e) {
setException(e);
String mesg = " with exception '" + Utilities.getNameMessage(e) + "'";
if (rj != null) {
- mesg = "Ended Job = " + rj.getJobID() + mesg;
+ mesg = "Ended Job = " + rj.getID() + mesg;
} else {
mesg = "Job Submission failed" + mesg;
}
@@ -233,7 +233,7 @@ public boolean checkFatalErrors(Counters ctrs,
StringBuilder errMsg) {
}
@Override
- public void logPlanProgress(SessionState ss) throws IOException {
+ public void logPlanProgress(SessionState ss) {
// no op
}
}