Martijn Visser created FLINK-40989:
--------------------------------------
Summary: 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: 1.20.5, 2.2.1, 2.3.0, 2.4.0
Reporter: Martijn Visser
Assignee: Ramin Gharib
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)