Author: rhbutani
Date: Thu Mar 13 00:51:43 2014
New Revision: 1577015

URL: http://svn.apache.org/r1577015
Log:
HIVE-6575: select * fails on parquet table with map datatype (Szehon via Xuefu)

Modified:
    
hive/branches/branch-0.13/ql/src/java/org/apache/hadoop/hive/ql/io/parquet/serde/AbstractParquetMapInspector.java

Modified: 
hive/branches/branch-0.13/ql/src/java/org/apache/hadoop/hive/ql/io/parquet/serde/AbstractParquetMapInspector.java
URL: 
http://svn.apache.org/viewvc/hive/branches/branch-0.13/ql/src/java/org/apache/hadoop/hive/ql/io/parquet/serde/AbstractParquetMapInspector.java?rev=1577015&r1=1577014&r2=1577015&view=diff
==============================================================================
--- 
hive/branches/branch-0.13/ql/src/java/org/apache/hadoop/hive/ql/io/parquet/serde/AbstractParquetMapInspector.java
 (original)
+++ 
hive/branches/branch-0.13/ql/src/java/org/apache/hadoop/hive/ql/io/parquet/serde/AbstractParquetMapInspector.java
 Thu Mar 13 00:51:43 2014
@@ -134,30 +134,42 @@ public abstract class AbstractParquetMap
   }
 
   @Override
+  public int hashCode() {
+    final int prime = 31;
+    int result = 1;
+    result = prime * result
+        + ((keyInspector == null) ? 0 : keyInspector.hashCode());
+    result = prime * result
+        + ((valueInspector == null) ? 0 : valueInspector.hashCode());
+    return result;
+  }
+
+  @Override
   public boolean equals(Object obj) {
+    if (this == obj) {
+      return true;
+    }
     if (obj == null) {
       return false;
     }
     if (getClass() != obj.getClass()) {
       return false;
     }
-    final StandardParquetHiveMapInspector other = 
(StandardParquetHiveMapInspector) obj;
-    if (this.keyInspector != other.keyInspector &&
-        (this.keyInspector == null || 
!this.keyInspector.equals(other.keyInspector))) {
+    final AbstractParquetMapInspector other = (AbstractParquetMapInspector) 
obj;
+    if (keyInspector == null) {
+      if (other.keyInspector != null) {
+        return false;
+      }
+    } else if (!keyInspector.equals(other.keyInspector)) {
       return false;
     }
-    if (this.valueInspector != other.valueInspector &&
-        (this.valueInspector == null || 
!this.valueInspector.equals(other.valueInspector))) {
+    if (valueInspector == null) {
+      if (other.valueInspector != null) {
+        return false;
+      }
+    } else if (!valueInspector.equals(other.valueInspector)) {
       return false;
     }
     return true;
   }
-
-  @Override
-  public int hashCode() {
-    int hash = 7;
-    hash = 59 * hash + (this.keyInspector != null ? 
this.keyInspector.hashCode() : 0);
-    hash = 59 * hash + (this.valueInspector != null ? 
this.valueInspector.hashCode() : 0);
-    return hash;
-  }
 }


Reply via email to