hive-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From xu...@apache.org
Subject svn commit: r1667645 - /hive/branches/spark/serde/src/java/org/apache/hadoop/hive/serde2/lazy/objectinspector/LazyObjectInspectorFactory.java
Date Thu, 19 Mar 2015 00:22:43 GMT
Author: xuefu
Date: Thu Mar 19 00:22:42 2015
New Revision: 1667645

URL: http://svn.apache.org/r1667645
Log:
HIVE-10009: LazyObjectInspectorFactory is not thread safe [Spark Branch] (Jimmy via Xuefu)

Modified:
    hive/branches/spark/serde/src/java/org/apache/hadoop/hive/serde2/lazy/objectinspector/LazyObjectInspectorFactory.java

Modified: hive/branches/spark/serde/src/java/org/apache/hadoop/hive/serde2/lazy/objectinspector/LazyObjectInspectorFactory.java
URL: http://svn.apache.org/viewvc/hive/branches/spark/serde/src/java/org/apache/hadoop/hive/serde2/lazy/objectinspector/LazyObjectInspectorFactory.java?rev=1667645&r1=1667644&r2=1667645&view=diff
==============================================================================
--- hive/branches/spark/serde/src/java/org/apache/hadoop/hive/serde2/lazy/objectinspector/LazyObjectInspectorFactory.java
(original)
+++ hive/branches/spark/serde/src/java/org/apache/hadoop/hive/serde2/lazy/objectinspector/LazyObjectInspectorFactory.java
Thu Mar 19 00:22:42 2015
@@ -125,7 +125,11 @@ public final class LazyObjectInspectorFa
         throw new IllegalArgumentException("Illegal ObjectInspector type [" + option + "]");
       }
 
-      cachedLazySimpleStructObjectInspector.put(signature, result);
+      LazySimpleStructObjectInspector prev =
+        cachedLazySimpleStructObjectInspector.putIfAbsent(signature, result);
+      if (prev != null) {
+        result = prev;
+      }
     }
     return result;
   }
@@ -154,7 +158,11 @@ public final class LazyObjectInspectorFa
     if (result == null) {
       result = new LazyListObjectInspector(listElementObjectInspector,
           separator, lazyParams);
-      cachedLazySimpleListObjectInspector.put(signature, result);
+      LazyListObjectInspector prev =
+        cachedLazySimpleListObjectInspector.putIfAbsent(signature, result);
+      if (prev != null) {
+        result = prev;
+      }
     }
     return result;
   }
@@ -189,7 +197,11 @@ public final class LazyObjectInspectorFa
     if (result == null) {
       result = new LazyMapObjectInspector(mapKeyObjectInspector,
           mapValueObjectInspector, itemSeparator, keyValueSeparator, lazyParams);
-      cachedLazySimpleMapObjectInspector.put(signature, result);
+      LazyMapObjectInspector prev =
+        cachedLazySimpleMapObjectInspector.putIfAbsent(signature, result);
+      if (prev != null) {
+        result = prev;
+      }
     }
     return result;
   }
@@ -218,7 +230,11 @@ public final class LazyObjectInspectorFa
         .get(signature);
     if (result == null) {
       result = new LazyUnionObjectInspector(ois, separator, lazyParams);
-      cachedLazyUnionObjectInspector.put(signature, result);
+      LazyUnionObjectInspector prev =
+        cachedLazyUnionObjectInspector.putIfAbsent(signature, result);
+      if (prev != null) {
+        result = prev;
+      }
     }
     return result;
   }



Mime
View raw message