You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by th...@apache.org on 2013/10/29 19:47:17 UTC

svn commit: r1536845 - /hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/MapOperator.java

Author: thejas
Date: Tue Oct 29 18:47:17 2013
New Revision: 1536845

URL: http://svn.apache.org/r1536845
Log:
HIVE-5668: path normalization in MapOperator is expensive (Thejas Nair reviewed by Gunther Hagleitner)

Modified:
    hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/MapOperator.java

Modified: hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/MapOperator.java
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/MapOperator.java?rev=1536845&r1=1536844&r2=1536845&view=diff
==============================================================================
--- hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/MapOperator.java (original)
+++ hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/MapOperator.java Tue Oct 29 18:47:17 2013
@@ -82,6 +82,7 @@ public class MapOperator extends Operato
 
   protected transient MapOpCtx current;
   private transient List<Operator<? extends OperatorDesc>> extraChildrenToClose = null;
+  private final Map<String, Path> normalizedPaths = new HashMap<String, Path>();
 
   private static class MapInputPath {
     String path;
@@ -467,7 +468,14 @@ public class MapOperator extends Operato
   }
 
   private Path normalizePath(String onefile) {
-    return new Path(onefile);
+    //creating Path is expensive, so cache the corresponding
+    //Path object in normalizedPaths
+    Path path = normalizedPaths.get(onefile);
+    if(path == null){
+      path = new Path(onefile);
+      normalizedPaths.put(onefile, path);
+    }
+    return path;
   }
 
   public void process(Writable value) throws HiveException {