You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by jd...@apache.org on 2014/06/18 03:14:12 UTC

svn commit: r1603344 - in /hive/trunk/ql/src/java/org/apache/hadoop/hive/ql: exec/Utilities.java io/HiveInputFormat.java

Author: jdere
Date: Wed Jun 18 01:14:12 2014
New Revision: 1603344

URL: http://svn.apache.org/r1603344
Log:
HIVE-7210: NPE with "No plan file found" when running Driver instances on multiple threads (Jason Dere, reviewed by Gunther Hagleitner/Vikram Dixit)

Modified:
    hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/Utilities.java
    hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/io/HiveInputFormat.java

Modified: hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/Utilities.java
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/Utilities.java?rev=1603344&r1=1603343&r2=1603344&view=diff
==============================================================================
--- hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/Utilities.java (original)
+++ hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/Utilities.java Wed Jun 18 01:14:12 2014
@@ -242,7 +242,7 @@ public final class Utilities {
     Path reducePath = getPlanPath(conf, REDUCE_PLAN_NAME);
 
     // if the plan path hasn't been initialized just return, nothing to clean.
-    if (mapPath == null || reducePath == null) {
+    if (mapPath == null && reducePath == null) {
       return;
     }
 
@@ -260,12 +260,7 @@ public final class Utilities {
     } finally {
       // where a single process works with multiple plans - we must clear
       // the cache before working with the next plan.
-      if (mapPath != null) {
-        gWorkMap.remove(mapPath);
-      }
-      if (reducePath != null) {
-        gWorkMap.remove(reducePath);
-      }
+      clearWorkMapForConf(conf);
     }
   }
 
@@ -3314,7 +3309,19 @@ public final class Utilities {
     return false;
   }
 
-    public static void clearWorkMap() {
+  public static void clearWorkMapForConf(Configuration conf) {
+    // Remove cached query plans for the current query only
+    Path mapPath = getPlanPath(conf, MAP_PLAN_NAME);
+    Path reducePath = getPlanPath(conf, REDUCE_PLAN_NAME);
+    if (mapPath != null) {
+      gWorkMap.remove(mapPath);
+    }
+    if (reducePath != null) {
+      gWorkMap.remove(reducePath);
+    }
+  }
+
+  public static void clearWorkMap() {
     gWorkMap.clear();
   }
 

Modified: hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/io/HiveInputFormat.java
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/io/HiveInputFormat.java?rev=1603344&r1=1603343&r2=1603344&view=diff
==============================================================================
--- hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/io/HiveInputFormat.java (original)
+++ hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/io/HiveInputFormat.java Wed Jun 18 01:14:12 2014
@@ -393,7 +393,7 @@ public class HiveInputFormat<K extends W
           currentTable, result);
     }
 
-    Utilities.clearWorkMap();
+    Utilities.clearWorkMapForConf(job);
     LOG.info("number of splits " + result.size());
     perfLogger.PerfLogEnd(CLASS_NAME, PerfLogger.GET_SPLITS);
     return result.toArray(new HiveInputSplit[result.size()]);