This is an automated email from the ASF dual-hosted git repository.

sankarh pushed a commit to branch branch-3
in repository https://gitbox.apache.org/repos/asf/hive.git


The following commit(s) were added to refs/heads/branch-3 by this push:
     new 2f5fc8db630 HIVE-27606: Backport of HIVE-21171: Skip creating scratch 
dirs for tez if RPC is on (Vineet Garg, reviewed by Ashutosh Chauhan)
2f5fc8db630 is described below

commit 2f5fc8db630e9cc0384cf056d13dfd1e9e348f37
Author: Aman Raj <104416558+amanraj2...@users.noreply.github.com>
AuthorDate: Thu Aug 24 15:52:04 2023 +0530

    HIVE-27606: Backport of HIVE-21171: Skip creating scratch dirs for tez if 
RPC is on (Vineet Garg, reviewed by Ashutosh Chauhan)
    
    Signed-off-by: Sankar Hariappan <sank...@apache.org>
    Closes (#4585)
---
 ql/src/java/org/apache/hadoop/hive/ql/exec/Utilities.java   |  7 +++++--
 .../java/org/apache/hadoop/hive/ql/exec/tez/DagUtils.java   | 13 ++++++++-----
 2 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/ql/src/java/org/apache/hadoop/hive/ql/exec/Utilities.java 
b/ql/src/java/org/apache/hadoop/hive/ql/exec/Utilities.java
index 26faf55fb8d..ee9150fe725 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/exec/Utilities.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/exec/Utilities.java
@@ -662,8 +662,11 @@ public final class Utilities {
       // this is the unique conf ID, which is kept in JobConf as part of the 
plan file name
       String jobID = UUID.randomUUID().toString();
       Path planPath = new Path(hiveScratchDir, jobID);
-      FileSystem fs = planPath.getFileSystem(conf);
-      fs.mkdirs(planPath);
+      if (!HiveConf.getBoolVar(conf, ConfVars.HIVE_RPC_QUERY_PLAN)) {
+        FileSystem fs = planPath.getFileSystem(conf);
+        // since we are doing RPC creating a directory is un-necessary
+        fs.mkdirs(planPath);
+      }
       HiveConf.setVar(conf, HiveConf.ConfVars.PLAN, 
planPath.toUri().toString());
     }
   }
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/exec/tez/DagUtils.java 
b/ql/src/java/org/apache/hadoop/hive/ql/exec/tez/DagUtils.java
index 535994a9901..ff7f0b440be 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/exec/tez/DagUtils.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/exec/tez/DagUtils.java
@@ -1509,11 +1509,14 @@ public class DagUtils {
     scratchDir = new Path(scratchDir, userName);
 
     Path tezDir = getTezDir(scratchDir);
-    FileSystem fs = tezDir.getFileSystem(conf);
-    LOG.debug("TezDir path set " + tezDir + " for user: " + userName);
-    // since we are adding the user name to the scratch dir, we do not
-    // need to give more permissions here
-    fs.mkdirs(tezDir);
+    if (!HiveConf.getBoolVar(conf, ConfVars.HIVE_RPC_QUERY_PLAN)) {
+      FileSystem fs = tezDir.getFileSystem(conf);
+      LOG.debug("TezDir path set " + tezDir + " for user: " + userName);
+      // since we are adding the user name to the scratch dir, we do not
+      // need to give more permissions here
+      // Since we are doing RPC creating a dir is not necessary
+      fs.mkdirs(tezDir);
+    }
 
     return tezDir;
 

Reply via email to