You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@calcite.apache.org by mm...@apache.org on 2019/05/27 17:14:56 UTC
[calcite] branch master updated: [CALCITE-3021] Equality of nested
ROWs returns false for identical values
This is an automated email from the ASF dual-hosted git repository.
mmior 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 ab40586 [CALCITE-3021] Equality of nested ROWs returns false for identical values
ab40586 is described below
commit ab40586dd6b6a8daff5054176db463d63e9c250c
Author: rubenada <ru...@gmail.com>
AuthorDate: Wed May 22 09:44:58 2019 +0200
[CALCITE-3021] Equality of nested ROWs returns false for identical values
---
core/src/test/resources/sql/struct.iq | 15 +++++++++++++++
.../org/apache/calcite/linq4j/function/Functions.java | 4 ++--
2 files changed, 17 insertions(+), 2 deletions(-)
diff --git a/core/src/test/resources/sql/struct.iq b/core/src/test/resources/sql/struct.iq
index a62af30..e386bb5 100644
--- a/core/src/test/resources/sql/struct.iq
+++ b/core/src/test/resources/sql/struct.iq
@@ -34,4 +34,19 @@ select * from (values
!ok
!}
+# [CALCITE-3021] Equality of nested ROWs returns false for identical values
+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 b8f1caa..a013cde 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.equals(v1, v2);
+ return Arrays.deepEquals(v1, v2);
}
public int hashCode(Object[] t) {
- return Arrays.hashCode(t);
+ return Arrays.deepHashCode(t);
}
}