[ https://issues.apache.org/jira/browse/CALCITE-3021?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Ruben Quesada Lopez updated CALCITE-3021: ----------------------------------------- Description: Currently, ArrayEqualityComparer (which is used as comparer for JavaRowFormat.ARRAY) performs the array comparison based on Arrays#equals and Arrays#hashCode: {code:java} private static class ArrayEqualityComparer implements EqualityComparer<Object[]> { public boolean equal(Object[] v1, Object[] v2) { return Arrays.equals(v1, v2); } public int hashCode(Object[] t) { return Arrays.hashCode(t); } } {code} This will lead to incorrect comparisons in case of multidimensional arrays, e.g. a row (array) with a struct field (another array) inside. To fix the issue, Arrays#deepEquals / Arrays#deepHashCode should be used: {code:java} private static class ArrayEqualityComparer implements EqualityComparer<Object[]> { public boolean equal(Object[] v1, Object[] v2) { return Arrays.deepEquals(v1, v2); } public int hashCode(Object[] t) { return Arrays.deepHashCode(t); } } {code} was: Currently, ArrayEqualityComparer (which is used as comparer for JavaRowFormat.ARRAY) performs the array comparison based on Arrays#equals and Arrays#hashCode: {code:java} private static class ArrayEqualityComparer implements EqualityComparer<Object[]> { public boolean equal(Object[] v1, Object[] v2) { return Arrays.equals(v1, v2); } public int hashCode(Object[] t) { return Arrays.hashCode(t); } } {code} This will lead to incorrect comparisons in case of multidimensional arrays. To fix the issue, Arrays#deepEquals / Arrays#deepHashCode should be used: {code:java} private static class ArrayEqualityComparer implements EqualityComparer<Object[]> { public boolean equal(Object[] v1, Object[] v2) { return Arrays.deepEquals(v1, v2); } public int hashCode(Object[] t) { return Arrays.deepHashCode(t); } } {code} > ArrayEqualityComparer should use Arrays#deepEquals/deepHashCode instead of > Arrays#equals/hashCode > ------------------------------------------------------------------------------------------------- > > Key: CALCITE-3021 > URL: https://issues.apache.org/jira/browse/CALCITE-3021 > Project: Calcite > Issue Type: Bug > Affects Versions: 1.19.0 > Reporter: Ruben Quesada Lopez > Assignee: Ruben Quesada Lopez > Priority: Minor > Fix For: 1.20.0 > > > Currently, ArrayEqualityComparer (which is used as comparer for > JavaRowFormat.ARRAY) performs the array comparison based on Arrays#equals and > Arrays#hashCode: > {code:java} > private static class ArrayEqualityComparer implements > EqualityComparer<Object[]> { > public boolean equal(Object[] v1, Object[] v2) { > return Arrays.equals(v1, v2); > } > public int hashCode(Object[] t) { > return Arrays.hashCode(t); > } > } > {code} > This will lead to incorrect comparisons in case of multidimensional arrays, > e.g. a row (array) with a struct field (another array) inside. To fix the > issue, Arrays#deepEquals / Arrays#deepHashCode should be used: > {code:java} > private static class ArrayEqualityComparer implements > EqualityComparer<Object[]> { > public boolean equal(Object[] v1, Object[] v2) { > return Arrays.deepEquals(v1, v2); > } > public int hashCode(Object[] t) { > return Arrays.deepHashCode(t); > } > } > {code} -- This message was sent by Atlassian JIRA (v7.6.3#76005)