This is an automated email from the ASF dual-hosted git repository.
hyuan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/calcite.git
The following commit(s) were added to refs/heads/master by this push:
new b722612 Revert "[CALCITE-3021] ArrayEqualityComparer should use
Arrays#deepEquals/deepHashCode instead of Arrays#equals/hashCode (Ruben Quesada
Lopez)"
b722612 is described below
commit b7226129d16ee2ed5c0e2a3d3c945b06cc555535
Author: Haisheng Yuan <[email protected]>
AuthorDate: Thu Apr 25 11:25:15 2019 -0700
Revert "[CALCITE-3021] ArrayEqualityComparer should use
Arrays#deepEquals/deepHashCode instead of Arrays#equals/hashCode (Ruben Quesada
Lopez)"
This reverts commit 758ce8b0eab0bfe59c7eefeedaf4cdd0d2235a10.
---
core/src/test/resources/sql/struct.iq | 15 ---------------
.../org/apache/calcite/linq4j/function/Functions.java | 4 ++--
.../java/org/apache/calcite/linq4j/test/Linq4jTest.java | 15 ---------------
3 files changed, 2 insertions(+), 32 deletions(-)
diff --git a/core/src/test/resources/sql/struct.iq
b/core/src/test/resources/sql/struct.iq
index 46dba27..a62af30 100644
--- a/core/src/test/resources/sql/struct.iq
+++ b/core/src/test/resources/sql/struct.iq
@@ -34,19 +34,4 @@ select * from (values
!ok
!}
-# [CALCITE-3021] ArrayEqualityComparer should use
Arrays#deepEquals/deepHashCode instead of Arrays#equals/hashCode
-select distinct * from (values
- (1, ROW(1,1)),
- (1, ROW(1,1)),
- (2, ROW(2,2))) as v(id,struct);
-+----+--------+
-| ID | STRUCT |
-+----+--------+
-| 1 | {1, 1} |
-| 2 | {2, 2} |
-+----+--------+
-(2 rows)
-
-!ok
-
# End struct.iq
diff --git
a/linq4j/src/main/java/org/apache/calcite/linq4j/function/Functions.java
b/linq4j/src/main/java/org/apache/calcite/linq4j/function/Functions.java
index a013cde..b8f1caa 100644
--- a/linq4j/src/main/java/org/apache/calcite/linq4j/function/Functions.java
+++ b/linq4j/src/main/java/org/apache/calcite/linq4j/function/Functions.java
@@ -465,11 +465,11 @@ public abstract class Functions {
private static class ArrayEqualityComparer
implements EqualityComparer<Object[]> {
public boolean equal(Object[] v1, Object[] v2) {
- return Arrays.deepEquals(v1, v2);
+ return Arrays.equals(v1, v2);
}
public int hashCode(Object[] t) {
- return Arrays.deepHashCode(t);
+ return Arrays.hashCode(t);
}
}
diff --git
a/linq4j/src/test/java/org/apache/calcite/linq4j/test/Linq4jTest.java
b/linq4j/src/test/java/org/apache/calcite/linq4j/test/Linq4jTest.java
index 0f24652..e630485 100644
--- a/linq4j/src/test/java/org/apache/calcite/linq4j/test/Linq4jTest.java
+++ b/linq4j/src/test/java/org/apache/calcite/linq4j/test/Linq4jTest.java
@@ -57,8 +57,6 @@ import java.util.NoSuchElementException;
import java.util.Objects;
import java.util.TreeSet;
-import static org.apache.calcite.linq4j.function.Functions.arrayComparer;
-
import static org.hamcrest.CoreMatchers.endsWith;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.is;
@@ -909,19 +907,6 @@ public class Linq4jTest {
.count());
}
- @Test public void testDistinctWithArrayEqualityComparer() {
- final Object[][] items = {
- {1, "a", new Object[]{1}},
- {2, "b", new Object[]{2}},
- {2, "b", new Object[]{2}},
- };
- assertEquals(
- 2,
- Linq4j.asEnumerable(items)
- .distinct(arrayComparer())
- .count());
- }
-
@Test public void testGroupJoin() {
// Note #1: Group join is a "left join": "bad employees" are filtered
// out, but empty departments are not.