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 26faf55fb8d9..ee9150fe7258 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 @@ private static void setPlanPath(Configuration conf, Path hiveScratchDir) throws // 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 535994a9901e..ff7f0b440bed 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 Path createTezDir(Path scratchDir, Configuration conf) 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;