Mihai Budiu created CALCITE-7689:
------------------------------------

             Summary: MAP equality compares maps by insertion order
                 Key: CALCITE-7689
                 URL: https://issues.apache.org/jira/browse/CALCITE-7689
             Project: Calcite
          Issue Type: Bug
          Components: core
    Affects Versions: 1.42.0
            Reporter: Mihai Budiu


The runtime implements MAP values as LinkedHashMap. Two such maps are equal 
only if keys were inserted in the same order. I believe that the SQL semantics 
would require checking that two maps have the same keys and map these keys to 
correspondingly equal values:
{code:java}
SELECT MAP[1, 2, 3, 4] = MAP[3, 4, 1, 2]; {code}
should evaluate to TRUE (today it evaluates to FALSE).

Regarding NULLs, today ARRAY values use IS NOT DISTINCT FROM, so probably MAP 
equality should use the same semantics (i.e. MAP[1, NULL] = MAP[1, NULL] should 
evaluate to TRUE and not to UNKNOWN).



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to