You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Ruben Q L (Jira)" <ji...@apache.org> on 2019/11/08 09:26:00 UTC
[jira] [Commented] (CALCITE-3482) Equality of nested ROWs returns
false for identical literal value
[ https://issues.apache.org/jira/browse/CALCITE-3482?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16969973#comment-16969973 ]
Ruben Q L commented on CALCITE-3482:
------------------------------------
Fixed via https://github.com/apache/calcite/commit/08c83afb16ba8dde3082735edf693d6914716ada
> Equality of nested ROWs returns false for identical literal value
> -----------------------------------------------------------------
>
> Key: CALCITE-3482
> URL: https://issues.apache.org/jira/browse/CALCITE-3482
> Project: Calcite
> Issue Type: Bug
> Affects Versions: 1.21.0
> Reporter: Ruben Q L
> Assignee: Ruben Q L
> Priority: Minor
> Labels: pull-request-available
> Fix For: 1.22.0
>
> Time Spent: 1h
> Remaining Estimate: 0h
>
> Similar to CALCITE-3021.
> Problem can be reproduced via:
> {code}
> select * from
> (values
> (1, ROW(1,1)),
> (2, ROW(2,2)),
> (3, ROW(1,1)),
> (4, ROW(2,2))) as t(id,struct)
> where t.struct = ROW(2,2);
> {code}
> which returns no results, instead of the expected (I have run the same query in PostgreSQL, and it returns this result):
> {code}
> +----+--------+
> | ID | STRUCT |
> +----+--------+
> | 2 | {2, 2} |
> | 4 | {2, 2} |
> +----+--------+
> {code}
> The issue is that the comparison is done via {{SqlFunctions#eq(Object b0, Object b1)}}
> {code}
> public static boolean eq(Object b0, Object b1) {
> return b0.equals(b1);
> }
> {code}
> And in this case we have two different Object[], with the same content, so they should be identified as equals (but they are not, based on {{Object#equals}}). Probably the simplest solution would be overloading the {{eq}} method for Object[] parameters:
> {code}
> public static boolean eq(Object[] b0, Object[] b1) {
> return Arrays.deepEquals(b0, b1);
> }
> {code}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)