hive-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sunc...@apache.org
Subject hive git commit: HIVE-15130: Fixing shifting index issue related to object inspector caching (Chao Sun, reviewed by Ferdinand Xu)
Date Fri, 02 Dec 2016 21:26:02 GMT
Repository: hive
Updated Branches:
  refs/heads/master 7065407e6 -> 98a25f2d8


HIVE-15130: Fixing shifting index issue related to object inspector caching (Chao Sun, reviewed
by Ferdinand Xu)


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

Branch: refs/heads/master
Commit: 98a25f2d831ab27e174bc99792047eaa8ec08b82
Parents: 7065407
Author: Chao Sun <sunchao@apache.org>
Authored: Fri Dec 2 13:25:45 2016 -0800
Committer: Chao Sun <sunchao@apache.org>
Committed: Fri Dec 2 13:25:45 2016 -0800

----------------------------------------------------------------------
 .../serde/ArrayWritableObjectInspector.java     | 64 ++++++++++++++++----
 1 file changed, 53 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hive/blob/98a25f2d/ql/src/java/org/apache/hadoop/hive/ql/io/parquet/serde/ArrayWritableObjectInspector.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/io/parquet/serde/ArrayWritableObjectInspector.java
b/ql/src/java/org/apache/hadoop/hive/ql/io/parquet/serde/ArrayWritableObjectInspector.java
index 8df0cc1..d4f20fc 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/io/parquet/serde/ArrayWritableObjectInspector.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/io/parquet/serde/ArrayWritableObjectInspector.java
@@ -222,29 +222,39 @@ public class ArrayWritableObjectInspector extends SettableStructObjectInspector
   }
 
   @Override
-  public boolean equals(Object obj) {
-    if (obj == null) {
-      return false;
+  public boolean equals(Object o) {
+    if (this == o) {
+      return true;
     }
-    if (getClass() != obj.getClass()) {
+    if (o == null || getClass() != o.getClass()) {
       return false;
     }
-    final ArrayWritableObjectInspector other = (ArrayWritableObjectInspector) obj;
-    if (this.typeInfo != other.typeInfo && (this.typeInfo == null || !this.typeInfo.equals(other.typeInfo)))
{
+
+    ArrayWritableObjectInspector that = (ArrayWritableObjectInspector) o;
+
+    if (isRoot != that.isRoot ||
+      (typeInfo != null ? !typeInfo.equals(that.typeInfo) : that.typeInfo != null) ||
+      (fieldInfos != null ? !fieldInfos.equals(that.fieldInfos) : that.fieldInfos != null)
||
+      (fieldNames != null ? !fieldNames.equals(that.fieldNames) : that.fieldNames != null)
||
+      (fields != null ? !fields.equals(that.fields) : that.fields != null)) {
       return false;
     }
-    return true;
+
+    return fieldsByName != null ? fieldsByName.equals(that.fieldsByName) : that.fieldsByName
== null;
   }
 
   @Override
   public int hashCode() {
-    int hash = 5;
-    hash = 29 * hash + (this.typeInfo != null ? this.typeInfo.hashCode() : 0);
-    return hash;
+    int result = typeInfo != null ? typeInfo.hashCode() : 0;
+    result = 31 * result + (fieldInfos != null ? fieldInfos.hashCode() : 0);
+    result = 31 * result + (fieldNames != null ? fieldNames.hashCode() : 0);
+    result = 31 * result + (fields != null ? fields.hashCode() : 0);
+    result = 31 * result + (fieldsByName != null ? fieldsByName.hashCode() : 0);
+    result = 31 * result + (isRoot ? 1 : 0);
+    return result;
   }
 
   private class StructFieldImpl implements StructField {
-
     private final String name;
     private final ObjectInspector inspector;
     private final int index;
@@ -288,5 +298,37 @@ public class ArrayWritableObjectInspector extends SettableStructObjectInspector
     public int getFieldID() {
       return index;
     }
+
+    @Override
+    public boolean equals(Object o) {
+      if (this == o) {
+        return true;
+      }
+      if (o == null || getClass() != o.getClass()) {
+        return false;
+      }
+
+      StructFieldImpl that = (StructFieldImpl) o;
+
+      if (index != that.index) {
+        return false;
+      }
+      if (adjustedIndex != that.adjustedIndex) {
+        return false;
+      }
+      if (name != null ? !name.equals(that.name) : that.name != null) {
+        return false;
+      }
+      return inspector != null ? inspector.equals(that.inspector) : that.inspector == null;
+    }
+
+    @Override
+    public int hashCode() {
+      int result = name != null ? name.hashCode() : 0;
+      result = 31 * result + (inspector != null ? inspector.hashCode() : 0);
+      result = 31 * result + index;
+      result = 31 * result + adjustedIndex;
+      return result;
+    }
   }
 }


Mime
View raw message