Ruben Q L created CALCITE-3482: ---------------------------------- Summary: 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 Fix For: 1.22.0
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 SqlFuynctions#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 the should be identified as equals. Probably the simples solution would be overloading the eq method: {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)