Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.
Original topic: ifnull好像触发bug了
[TiDB Version]
v5.4.1
[Encountered Problem: Phenomenon and Impact]
The
ifnull
function works in this query.
The
ifnull
function seems incorrect in this query. Is it triggering a bug?
Attached are two tables dumped using mysqldump
.
syk_test.sql (27.1 KB)
Please also send the SQL, I’ll try it in my environment.
The two SQL queries provided are selecting values from subqueries and using the IFNULL
function to handle null values. The first query is selecting from a subquery named a
which retrieves measure_status
and the value of measure_status
lagged by 2 rows within each patient_id
partition, ordered by create_time
. The second query is similar but selects from a subquery named b
, which retrieves measure_status
and the value of measure_status
lagged by 2 rows within each patient_id
partition, ordered by measure_time
. Both queries replace null values with ‘-1’ using the IFNULL
function.
Why wasn’t null captured? Using case when or if(xx is null, ‘-1’, l2), is there a difference between them?
关注了
5.7.25-TiDB-v6.4.0
This version works for my tests.
I tested it in v5.4.3 and it doesn’t work either.
During testing, it was found that it works in version V6.3.0.
Please have the official team check if it is a bug.
It is also possible that this BUG exists in some older versions but has been fixed in the new version.
The profile file was exported using the above command, see the attachment.
cpu.profile (22.7 KB)
I think we can raise an issue. This is an unexpected behavior.
This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.