hive-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sze...@apache.org
Subject [31/44] hive git commit: HIVE-10009: LazyObjectInspectorFactory is not thread safe [Spark Branch] (Jimmy via Xuefu)
Date Thu, 23 Apr 2015 02:34:40 GMT
HIVE-10009: LazyObjectInspectorFactory is not thread safe [Spark Branch] (Jimmy via Xuefu)

git-svn-id: https://svn.apache.org/repos/asf/hive/branches/spark@1667645 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/hive/repo
Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/79a3793f
Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/79a3793f
Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/79a3793f

Branch: refs/heads/master
Commit: 79a3793f61f226f21da2f890812549a6b8c1826e
Parents: 198bb4b
Author: Xuefu Zhang <xuefu@apache.org>
Authored: Thu Mar 19 00:22:42 2015 +0000
Committer: Szehon Ho <szehon@cloudera.com>
Committed: Wed Apr 22 19:33:52 2015 -0700

----------------------------------------------------------------------
 .../LazyObjectInspectorFactory.java             | 24 ++++++++++++++++----
 1 file changed, 20 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hive/blob/79a3793f/serde/src/java/org/apache/hadoop/hive/serde2/lazy/objectinspector/LazyObjectInspectorFactory.java
----------------------------------------------------------------------
diff --git a/serde/src/java/org/apache/hadoop/hive/serde2/lazy/objectinspector/LazyObjectInspectorFactory.java
b/serde/src/java/org/apache/hadoop/hive/serde2/lazy/objectinspector/LazyObjectInspectorFactory.java
index 50a97f7..4af9734 100644
--- a/serde/src/java/org/apache/hadoop/hive/serde2/lazy/objectinspector/LazyObjectInspectorFactory.java
+++ b/serde/src/java/org/apache/hadoop/hive/serde2/lazy/objectinspector/LazyObjectInspectorFactory.java
@@ -125,7 +125,11 @@ public final class LazyObjectInspectorFactory {
         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 LazyObjectInspectorFactory {
     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 LazyObjectInspectorFactory {
     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 LazyObjectInspectorFactory {
         .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