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

svn commit: r1636450 - /hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/io/HiveFileFormatUtils.java

Author: khorgath
Date: Mon Nov  3 21:30:12 2014
New Revision: 1636450

URL: http://svn.apache.org/r1636450
Log:
HIVE-8704 : HivePassThroughOutputFormat cannot proxy more than one kind of OF (in one process) (Sushanth Sowmyan, reviewed by Ashutosh Chauhan)

Modified:
    hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/io/HiveFileFormatUtils.java

Modified: hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/io/HiveFileFormatUtils.java
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/io/HiveFileFormatUtils.java?rev=1636450&r1=1636449&r2=1636450&view=diff
==============================================================================
--- hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/io/HiveFileFormatUtils.java (original)
+++ hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/io/HiveFileFormatUtils.java Mon Nov  3 21:30:12 2014
@@ -74,7 +74,12 @@ public final class HiveFileFormatUtils {
         SequenceFileOutputFormat.class, HiveSequenceFileOutputFormat.class);
   }
 
-  static String realoutputFormat;
+  private static ThreadLocal<String> tRealOutputFormat = new ThreadLocal<String>() {
+    @Override
+    protected String initialValue() {
+      return null;
+    }
+  };
 
   @SuppressWarnings("unchecked")
   private static Map<Class<? extends OutputFormat>, Class<? extends HiveOutputFormat>>
@@ -105,11 +110,9 @@ public final class HiveFileFormatUtils {
     }
     Class<? extends HiveOutputFormat> result = outputFormatSubstituteMap
         .get(origin);
-    //register this output format into the map for the first time
-    if ((storagehandlerflag == true) && (result == null)) {
+    if ((storagehandlerflag == true) && (result == null || result == HivePassThroughOutputFormat.class)) {
       HiveFileFormatUtils.setRealOutputFormatClassName(origin.getName());
       result = HivePassThroughOutputFormat.class;
-      HiveFileFormatUtils.registerOutputFormatSubstitute((Class<? extends OutputFormat>) origin,HivePassThroughOutputFormat.class);
     }
     return result;
   }
@@ -120,7 +123,7 @@ public final class HiveFileFormatUtils {
   @SuppressWarnings("unchecked")
   public static String getRealOutputFormatClassName()
   {
-    return realoutputFormat;
+    return tRealOutputFormat.get();
   }
 
   /**
@@ -129,7 +132,7 @@ public final class HiveFileFormatUtils {
   public static void setRealOutputFormatClassName(
       String destination) {
     if (destination != null){
-      realoutputFormat = destination;
+      tRealOutputFormat.set(destination);
     }
     else {
       return;