[ 
https://issues.apache.org/jira/browse/ARROW-1877?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16281131#comment-16281131
 ] 

ASF GitHub Bot commented on ARROW-1877:
---------------------------------------

wesm closed pull request #1380: ARROW-1877: [Java] Fix incorrect equals method 
in JsonStringArrayList
URL: https://github.com/apache/arrow/pull/1380
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git 
a/java/vector/src/main/java/org/apache/arrow/vector/util/JsonStringArrayList.java
 
b/java/vector/src/main/java/org/apache/arrow/vector/util/JsonStringArrayList.java
index 480bd76d4..b6db29a7f 100644
--- 
a/java/vector/src/main/java/org/apache/arrow/vector/util/JsonStringArrayList.java
+++ 
b/java/vector/src/main/java/org/apache/arrow/vector/util/JsonStringArrayList.java
@@ -19,7 +19,6 @@
 package org.apache.arrow.vector.util;
 
 import java.util.ArrayList;
-import java.util.List;
 
 import com.fasterxml.jackson.core.JsonProcessingException;
 import com.fasterxml.jackson.databind.ObjectMapper;
@@ -40,21 +39,6 @@ public JsonStringArrayList(int size) {
     super(size);
   }
 
-  @Override
-  public boolean equals(Object obj) {
-    if (this == obj) {
-      return true;
-    }
-    if (obj == null) {
-      return false;
-    }
-    if (!(obj instanceof List)) {
-      return false;
-    }
-    List<?> other = (List<?>) obj;
-    return this.size() == other.size() && this.containsAll(other);
-  }
-
   @Override
   public final String toString() {
     try {
diff --git 
a/java/vector/src/main/java/org/apache/arrow/vector/util/JsonStringHashMap.java 
b/java/vector/src/main/java/org/apache/arrow/vector/util/JsonStringHashMap.java
index 6455389d5..cdb44fbee 100644
--- 
a/java/vector/src/main/java/org/apache/arrow/vector/util/JsonStringHashMap.java
+++ 
b/java/vector/src/main/java/org/apache/arrow/vector/util/JsonStringHashMap.java
@@ -19,7 +19,6 @@
 package org.apache.arrow.vector.util;
 
 import java.util.LinkedHashMap;
-import java.util.Map;
 
 import com.fasterxml.jackson.core.JsonProcessingException;
 import com.fasterxml.jackson.databind.ObjectMapper;
@@ -36,36 +35,6 @@
     mapper = new ObjectMapper();
   }
 
-  @Override
-  public boolean equals(Object obj) {
-    if (this == obj) {
-      return true;
-    }
-    if (obj == null) {
-      return false;
-    }
-    if (!(obj instanceof Map)) {
-      return false;
-    }
-    Map<?, ?> other = (Map<?, ?>) obj;
-    if (this.size() != other.size()) {
-      return false;
-    }
-    for (K key : this.keySet()) {
-      if (this.get(key) == null) {
-        if (other.get(key) == null) {
-          continue;
-        } else {
-          return false;
-        }
-      }
-      if (!this.get(key).equals(other.get(key))) {
-        return false;
-      }
-    }
-    return true;
-  }
-
   @Override
   public final String toString() {
     try {


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


> Incorrect comparison in JsonStringArrayList.equals
> --------------------------------------------------
>
>                 Key: ARROW-1877
>                 URL: https://issues.apache.org/jira/browse/ARROW-1877
>             Project: Apache Arrow
>          Issue Type: Bug
>          Components: Java - Vectors
>    Affects Versions: 0.1.0
>            Reporter: Venki Korukanti
>            Assignee: Venki Korukanti
>              Labels: pull-request-available
>             Fix For: 0.8.0
>
>
> [1] uses containsAll which could return wrong results. Ex. e1: [true, true, 
> false], e2: [true, false, false]. 
> Remove the equals method and fallback on super class method which has correct 
> implementation.
> [1] 
> https://github.com/apache/arrow/blob/7a4026a2b43b164ac28c96e1e796c02ca9efe496/java/vector/src/main/java/org/apache/arrow/vector/util/JsonStringArrayList.java#L55



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to