You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by vg...@apache.org on 2019/03/06 21:42:31 UTC

[hive] branch master updated: HIVE-21182: Skip setting up hive scratch dir during planning (Vineet Garg, reviewed by Ashutosh Chauhan)

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

vgarg pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hive.git


The following commit(s) were added to refs/heads/master by this push:
     new 6326bee  HIVE-21182: Skip setting up hive scratch dir during planning (Vineet Garg, reviewed by Ashutosh Chauhan)
6326bee is described below

commit 6326bee3a1720a76706ebdef796cc4ab0bdc1d43
Author: Vineet Garg <vg...@apache.org>
AuthorDate: Wed Mar 6 13:42:09 2019 -0800

    HIVE-21182: Skip setting up hive scratch dir during planning (Vineet Garg, reviewed by Ashutosh Chauhan)
---
 ql/src/java/org/apache/hadoop/hive/ql/Context.java  | 21 ++++++++++++++++-----
 .../hadoop/hive/ql/parse/SemanticAnalyzer.java      |  2 +-
 2 files changed, 17 insertions(+), 6 deletions(-)

diff --git a/ql/src/java/org/apache/hadoop/hive/ql/Context.java b/ql/src/java/org/apache/hadoop/hive/ql/Context.java
index b11d5a1..cbe0d04 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/Context.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/Context.java
@@ -538,14 +538,14 @@ public class Context {
 
   /**
    * Create a map-reduce scratch directory on demand and return it.
+   * @param mkDir flag to indicate if scratch dir is to be created or not
    *
    */
-  public Path getMRScratchDir() {
-
+  public Path getMRScratchDir(boolean mkDir) {
     // if we are executing entirely on the client side - then
     // just (re)use the local scratch directory
     if(isLocalOnlyExecutionMode()) {
-      return getLocalScratchDir(!isExplainSkipExecution());
+      return getLocalScratchDir(mkDir);
     }
 
     try {
@@ -553,16 +553,23 @@ public class Context {
       URI uri = dir.toUri();
 
       Path newScratchDir = getScratchDir(uri.getScheme(), uri.getAuthority(),
-          !isExplainSkipExecution(), uri.getPath());
+                                         mkDir, uri.getPath());
       LOG.info("New scratch dir is " + newScratchDir);
       return newScratchDir;
     } catch (IOException e) {
       throw new RuntimeException(e);
     } catch (IllegalArgumentException e) {
       throw new RuntimeException("Error while making MR scratch "
-          + "directory - check filesystem config (" + e.getCause() + ")", e);
+                                     + "directory - check filesystem config (" + e.getCause() + ")", e);
     }
   }
+  /**
+   * Create a map-reduce scratch directory on demand and return it.
+   *
+   */
+  public Path getMRScratchDir() {
+    return getMRScratchDir(!isExplainSkipExecution());
+  }
 
   /**
    * Create a temporary directory depending of the path specified.
@@ -681,6 +688,10 @@ public class Context {
     return new Path(getStagingDir(new Path(uri), !isExplainSkipExecution()), MR_PREFIX + nextPathId());
   }
 
+  public Path getMRTmpPath(boolean mkDir) {
+    return new Path(getMRScratchDir(mkDir), MR_PREFIX +
+        nextPathId());
+  }
   /**
    * Get a path to store map-reduce intermediate data in.
    *
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java b/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java
index 8d1309d..05257c9 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java
@@ -2543,7 +2543,7 @@ public class SemanticAnalyzer extends BaseSemanticAnalyzer {
         stagingPath = ctx.getMRTmpPath(tablePath.toUri());
       }
     } else {
-      stagingPath = ctx.getMRTmpPath();
+      stagingPath = ctx.getMRTmpPath(false);
     }
 
     return stagingPath;