Martijn Visser created FLINK-41477:
--------------------------------------
Summary: Overload resolution for overlapping signatures changes
between JVM runs
Key: FLINK-41477
URL: https://issues.apache.org/jira/browse/FLINK-41477
Project: Flink
Issue Type: Bug
Components: Table SQL / Planner
Affects Versions: 1.20.5, 2.2.1, 2.3.0
Reporter: Martijn Visser
Function and procedure overloads with overlapping signatures resolve
differently between JVM runs. A ScalarFunction with eval(int) returning a ROW
and eval(@DataTypeHint(inputGroup = InputGroup.ANY) Object) returning a RAW
type resolves SELECT f(5) to the int overload in some runs and to the ANY
overload in others, with the same code and query. Procedures behave the same;
the overloaded example on the procedures docs page hits this.
TypeInferenceExtractor#translateOutputTypeStrategy collects the overloads with
Collectors.toMap into a HashMap, and the mapping strategy tries them in
iteration order, so the result depends on hash codes.
We should keep the overloads in a deterministic order, for example with a
LinkedHashMap, and decide whether an exact match should win over InputGroup.ANY.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)