You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by jd...@apache.org on 2015/05/12 23:31:54 UTC

hive git commit: HIVE-10621: serde typeinfo equals methods are not symmetric (Alex Pivovarov via Jason Dere)

Repository: hive
Updated Branches:
  refs/heads/master 1e9e6fe13 -> b4b79558a


HIVE-10621: serde typeinfo equals methods are not symmetric (Alex Pivovarov via Jason Dere)


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

Branch: refs/heads/master
Commit: b4b79558a848feb86c90d18f18b32bf0e01d6754
Parents: 1e9e6fe
Author: Jason Dere <jd...@hortonworks.com>
Authored: Tue May 12 14:30:51 2015 -0700
Committer: Jason Dere <jd...@hortonworks.com>
Committed: Tue May 12 14:30:51 2015 -0700

----------------------------------------------------------------------
 .../org/apache/hadoop/hive/serde2/io/HiveDecimalWritable.java | 5 ++++-
 .../org/apache/hadoop/hive/serde2/typeinfo/CharTypeInfo.java  | 5 ++++-
 .../apache/hadoop/hive/serde2/typeinfo/DecimalTypeInfo.java   | 7 +++++--
 .../apache/hadoop/hive/serde2/typeinfo/PrimitiveTypeInfo.java | 5 ++++-
 .../apache/hadoop/hive/serde2/typeinfo/VarcharTypeInfo.java   | 5 ++++-
 5 files changed, 21 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hive/blob/b4b79558/serde/src/java/org/apache/hadoop/hive/serde2/io/HiveDecimalWritable.java
----------------------------------------------------------------------
diff --git a/serde/src/java/org/apache/hadoop/hive/serde2/io/HiveDecimalWritable.java b/serde/src/java/org/apache/hadoop/hive/serde2/io/HiveDecimalWritable.java
index 6ab64e5..a17d2cc 100644
--- a/serde/src/java/org/apache/hadoop/hive/serde2/io/HiveDecimalWritable.java
+++ b/serde/src/java/org/apache/hadoop/hive/serde2/io/HiveDecimalWritable.java
@@ -146,7 +146,10 @@ public class HiveDecimalWritable implements WritableComparable<HiveDecimalWritab
 
   @Override
   public boolean equals(Object other) {
-    if (other == null || !(other instanceof HiveDecimalWritable)) {
+    if (this == other) {
+      return true;
+    }
+    if (other == null || getClass() != other.getClass()) {
       return false;
     }
     HiveDecimalWritable bdw = (HiveDecimalWritable) other;

http://git-wip-us.apache.org/repos/asf/hive/blob/b4b79558/serde/src/java/org/apache/hadoop/hive/serde2/typeinfo/CharTypeInfo.java
----------------------------------------------------------------------
diff --git a/serde/src/java/org/apache/hadoop/hive/serde2/typeinfo/CharTypeInfo.java b/serde/src/java/org/apache/hadoop/hive/serde2/typeinfo/CharTypeInfo.java
index 610818e..871c0f0 100644
--- a/serde/src/java/org/apache/hadoop/hive/serde2/typeinfo/CharTypeInfo.java
+++ b/serde/src/java/org/apache/hadoop/hive/serde2/typeinfo/CharTypeInfo.java
@@ -40,7 +40,10 @@ public class CharTypeInfo  extends BaseCharTypeInfo {
 
   @Override
   public boolean equals(Object other) {
-    if (other == null || !(other instanceof CharTypeInfo)) {
+    if (this == other) {
+      return true;
+    }
+    if (other == null || getClass() != other.getClass()) {
       return false;
     }
 

http://git-wip-us.apache.org/repos/asf/hive/blob/b4b79558/serde/src/java/org/apache/hadoop/hive/serde2/typeinfo/DecimalTypeInfo.java
----------------------------------------------------------------------
diff --git a/serde/src/java/org/apache/hadoop/hive/serde2/typeinfo/DecimalTypeInfo.java b/serde/src/java/org/apache/hadoop/hive/serde2/typeinfo/DecimalTypeInfo.java
index cbe4802..d00f77d 100644
--- a/serde/src/java/org/apache/hadoop/hive/serde2/typeinfo/DecimalTypeInfo.java
+++ b/serde/src/java/org/apache/hadoop/hive/serde2/typeinfo/DecimalTypeInfo.java
@@ -51,7 +51,10 @@ public class DecimalTypeInfo extends PrimitiveTypeInfo {
 
   @Override
   public boolean equals(Object other) {
-    if (other == null || !(other instanceof DecimalTypeInfo)) {
+    if (this == other) {
+      return true;
+    }
+    if (other == null || getClass() != other.getClass()) {
       return false;
     }
 
@@ -99,7 +102,7 @@ public class DecimalTypeInfo extends PrimitiveTypeInfo {
 
   @Override
   public boolean accept(TypeInfo other) {
-    if (other == null || !(other instanceof DecimalTypeInfo)) {
+    if (other == null || getClass() != other.getClass()) {
       return false;
     }
 

http://git-wip-us.apache.org/repos/asf/hive/blob/b4b79558/serde/src/java/org/apache/hadoop/hive/serde2/typeinfo/PrimitiveTypeInfo.java
----------------------------------------------------------------------
diff --git a/serde/src/java/org/apache/hadoop/hive/serde2/typeinfo/PrimitiveTypeInfo.java b/serde/src/java/org/apache/hadoop/hive/serde2/typeinfo/PrimitiveTypeInfo.java
index a66b50a..ed6ea50 100644
--- a/serde/src/java/org/apache/hadoop/hive/serde2/typeinfo/PrimitiveTypeInfo.java
+++ b/serde/src/java/org/apache/hadoop/hive/serde2/typeinfo/PrimitiveTypeInfo.java
@@ -87,7 +87,10 @@ public class PrimitiveTypeInfo extends TypeInfo implements Serializable {
 
   @Override
   public boolean equals(Object other) {
-    if (other == null || !(other instanceof PrimitiveTypeInfo)) {
+    if (this == other) {
+      return true;
+    }
+    if (other == null || getClass() != other.getClass()) {
       return false;
     }
 

http://git-wip-us.apache.org/repos/asf/hive/blob/b4b79558/serde/src/java/org/apache/hadoop/hive/serde2/typeinfo/VarcharTypeInfo.java
----------------------------------------------------------------------
diff --git a/serde/src/java/org/apache/hadoop/hive/serde2/typeinfo/VarcharTypeInfo.java b/serde/src/java/org/apache/hadoop/hive/serde2/typeinfo/VarcharTypeInfo.java
index 5ac2b46..cb53503 100644
--- a/serde/src/java/org/apache/hadoop/hive/serde2/typeinfo/VarcharTypeInfo.java
+++ b/serde/src/java/org/apache/hadoop/hive/serde2/typeinfo/VarcharTypeInfo.java
@@ -40,7 +40,10 @@ public class VarcharTypeInfo extends BaseCharTypeInfo {
 
   @Override
   public boolean equals(Object other) {
-    if (other == null || !(other instanceof VarcharTypeInfo)) {
+    if (this == other) {
+      return true;
+    }
+    if (other == null || getClass() != other.getClass()) {
       return false;
     }