[CALCITE-7689] MAP equality compares maps by insertion order - #5151
[CALCITE-7689] MAP equality compares maps by insertion order#5151mihaibudiu wants to merge 1 commit into
Conversation
Signed-off-by: Mihai Budiu <mbudiu@feldera.com>
|
|
I checked the SQL standard, and there are no constraints regarding how maps should be compared; I believe any implementation approach we choose would be justifiable. However, I have observed that both DuckDB and ClickHouse return |
|
Clickhouse maps are actually not even maps, since they can have duplicate keys. |
xiedeyantu
left a comment
There was a problem hiding this comment.
Although the databases or query engines I am familiar with typically treat map comparisons as order-dependent, and I had previously hesitated regarding the implementation approach, I personally support the implementation in this PR. If no one raises an objection, I think it is acceptable, as it aligns better with intuition.
|
Let's see if there are any other objections. |



Jira Link
CALCITE-7689
Changes Proposed
Two MAP values should be equal when they have the same exact key and each key maps to the same exact value. Key and value comparisons use
<=>(IS NOT DISTINCT FROM), consistent withARRAYvalues.As a side-effect this changes ordering of maps too.