hive-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From xu...@apache.org
Subject svn commit: r1644764 - in /hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/objectinspector: ObjectInspectorFactory.java UnionStructObjectInspector.java
Date Thu, 11 Dec 2014 20:56:23 GMT
Author: xuefu
Date: Thu Dec 11 20:56:23 2014
New Revision: 1644764

URL: http://svn.apache.org/r1644764
Log:
HIVE-9043: HiveException: Conflict on row inspector for {table} (Szehon via Xuefu)

Modified:
    hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/ObjectInspectorFactory.java
    hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/UnionStructObjectInspector.java

Modified: hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/ObjectInspectorFactory.java
URL: http://svn.apache.org/viewvc/hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/ObjectInspectorFactory.java?rev=1644764&r1=1644763&r2=1644764&view=diff
==============================================================================
--- hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/ObjectInspectorFactory.java
(original)
+++ hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/ObjectInspectorFactory.java
Thu Dec 11 20:56:23 2014
@@ -18,7 +18,6 @@
 
 package org.apache.hadoop.hive.serde2.objectinspector;
 
-import java.lang.reflect.Field;
 import java.lang.reflect.GenericArrayType;
 import java.lang.reflect.ParameterizedType;
 import java.lang.reflect.Type;
@@ -202,7 +201,11 @@ public final class ObjectInspectorFactor
         .get(listElementObjectInspector);
     if (result == null) {
       result = new StandardListObjectInspector(listElementObjectInspector);
-      cachedStandardListObjectInspector.put(listElementObjectInspector, result);
+      StandardListObjectInspector prev =
+        cachedStandardListObjectInspector.putIfAbsent(listElementObjectInspector, result);
+      if (prev != null) {
+        result = prev;
+      }
     }
     return result;
   }
@@ -227,7 +230,11 @@ public final class ObjectInspectorFactor
     if (result == null) {
       result = new StandardMapObjectInspector(mapKeyObjectInspector,
           mapValueObjectInspector);
-      cachedStandardMapObjectInspector.put(signature, result);
+      StandardMapObjectInspector prev =
+        cachedStandardMapObjectInspector.putIfAbsent(signature, result);
+      if (prev != null) {
+        result = prev;
+      }
     }
     return result;
   }
@@ -250,7 +257,11 @@ public final class ObjectInspectorFactor
         .get(unionObjectInspectors);
     if (result == null) {
       result = new StandardUnionObjectInspector(unionObjectInspectors);
-      cachedStandardUnionObjectInspector.put(unionObjectInspectors, result);
+      StandardUnionObjectInspector prev =
+        cachedStandardUnionObjectInspector.putIfAbsent(unionObjectInspectors, result);
+      if (prev != null) {
+        result = prev;
+      }
     }
     return result;
   }
@@ -277,7 +288,11 @@ public final class ObjectInspectorFactor
     StandardStructObjectInspector result = cachedStandardStructObjectInspector.get(signature);
     if(result == null) {
       result = new StandardStructObjectInspector(structFieldNames, structFieldObjectInspectors,
structComments);
-      cachedStandardStructObjectInspector.put(signature, result);
+      StandardStructObjectInspector prev =
+        cachedStandardStructObjectInspector.putIfAbsent(signature, result);
+      if (prev != null) {
+        result = prev;
+      }
     }
     return result;
   }
@@ -291,7 +306,11 @@ public final class ObjectInspectorFactor
         .get(structObjectInspectors);
     if (result == null) {
       result = new UnionStructObjectInspector(structObjectInspectors);
-      cachedUnionStructObjectInspector.put(structObjectInspectors, result);
+      UnionStructObjectInspector prev =
+        cachedUnionStructObjectInspector.putIfAbsent(structObjectInspectors, result);
+      if (prev != null) {
+        result = prev;
+      }
     }
     return result;
   }
@@ -319,7 +338,11 @@ public final class ObjectInspectorFactor
     if (result == null) {
       result = new ColumnarStructObjectInspector(structFieldNames,
           structFieldObjectInspectors, structFieldComments);
-      cachedColumnarStructObjectInspector.put(signature, result);
+      ColumnarStructObjectInspector prev =
+        cachedColumnarStructObjectInspector.putIfAbsent(signature, result);
+      if (prev != null) {
+        result = prev;
+      }
     }
     return result;
   }

Modified: hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/UnionStructObjectInspector.java
URL: http://svn.apache.org/viewvc/hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/UnionStructObjectInspector.java?rev=1644764&r1=1644763&r2=1644764&view=diff
==============================================================================
--- hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/UnionStructObjectInspector.java
(original)
+++ hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/UnionStructObjectInspector.java
Thu Dec 11 20:56:23 2014
@@ -98,6 +98,23 @@ public class UnionStructObjectInspector
     }
   }
 
+  @Override
+  public boolean equals(Object o) {
+    if (o == this) {
+      return true;
+    }
+    if (!(o instanceof UnionStructObjectInspector)) {
+      return false;
+    }
+    return unionObjectInspectors.equals(
+      ((UnionStructObjectInspector)o).unionObjectInspectors);
+  }
+
+  @Override
+  public int hashCode() {
+    return unionObjectInspectors.hashCode();
+  }
+
   public final Category getCategory() {
     return Category.STRUCT;
   }



Mime
View raw message