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 2ff9ad3251..8937b43811 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 @@ -667,8 +667,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 1a88b77fee..d9340d0371 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 @@ -1500,11 +1500,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;