Details
-
Bug
-
Status: Resolved
-
Critical
-
Resolution: Fixed
-
2.0.0, 1.15.4, 1.16.3, 1.17.2, 1.18.1, 1.20.0, 1.19.1
-
None
Description
Run following SQL in sql-client:
The correct result should be '16', but we got '1' on the master.
Flink SQL> SET 'sql-client.execution.result-mode' = 'tableau'; [INFO] Execute statement succeeded. Flink SQL> select JSON_VALUE('{"a":16}','$.a'), IFNULL(JSON_VALUE('{"a":16}','$.a'),'0'); +----+--------------------------------+--------------------------------+ | op | EXPR$0 | EXPR$1 | +----+--------------------------------+--------------------------------+ | +I | 16 | 1 | +----+--------------------------------+--------------------------------+ Received a total of 1 row (0.30 seconds)
With some quick debugging, I guess it may be caused by FLINK-24413 which was introduced in Flink version 1.15.
I think the wrong result '1' was produced because the simplifying SQL procedure assumed that parameter 1 and parameter 2 ('0' was char) of IFNULL were of the same type, and therefore implicitly cast '16' to char, resulting in the incorrect result.
I have tested the SQL in the following version:
Flink Version | Result |
---|---|
1.13 | 16,16 |
1.17 | 16,1 |
1.19 | 16,1 |
master | 16,1 |