You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "Sergey Nuyanzin (Jira)" <ji...@apache.org> on 2026/10/17 19:45:00 UTC
[jira] [Commented] (FLINK-40989) MAP equality compares numeric values by reference
[ https://issues.apache.org/jira/browse/FLINK-40989?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18128249#comment-18128249 ]
Sergey Nuyanzin commented on FLINK-40989:
-----------------------------------------
Merged as [bbf37d099464a01facdd3eea944975e4ab04ce4d|https://github.com/apache/flink/commit/bbf37d099464a01facdd3eea944975e4ab04ce4d]
> MAP equality compares numeric values by reference
> -------------------------------------------------
>
> Key: FLINK-40989
> URL: https://issues.apache.org/jira/browse/FLINK-40989
> Project: Flink
> Issue Type: Bug
> Components: Table SQL / Planner
> Affects Versions: 2.3.0, 2.2.1, 1.20.5, 2.4.0
> Reporter: Martijn Visser
> Assignee: Ramin Gharib
> Priority: Critical
> Labels: pull-request-available
>
> Comparing two maps with {{=}} returns FALSE when they hold equal numeric values, for example {{MAP['k', d0] = MAP['k', d1]}} with both columns 1.5, or INT values outside the Integer cache such as 5000. {{generateMapComparison}} in {{ScalarOperatorGens}} reads the values as boxed objects and passes them to {{generateEquals}}, which emits {{==}} for numeric and time types, so the boxes are compared by reference. MULTISET equality goes through the same code. Two {{BinaryRowData}} holding such maps only compare equal because the record equaliser compares their bytes.
> We should compare the unboxed values. Casting both values to their primitive type before {{generateEquals}} makes all of these TRUE, and {{MapFunctionITCase}}, {{CollectionFunctionsITCase}}, {{CastFunctionITCase}} and {{JsonFunctionsITCase}} stay green.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)