BUG:Cache bug of the ”last“ function
153952402 opened this issue · comments
Bug Description
When querying specified column data through the last
function, the obtained value does not match the expectation. The expected value is false
, but the value is true
. However, not using the last function can query the correct value
To Reproduce
Steps to reproduce the behavior:
-
Prepare an SQL A, and run it every second using a while loop
selectSwitch
as property, _ts fromdevice_table
where device_id = 'deviceId1' andSwitch
is not null and _ts >= {T} and _ts < {T+1} order by _ts desc limit 1 offset 0
(tips: device_id is a tag) -
Prepare an SQL B, and run it every second using a while loop
select device_id, last(Switch
) fromdevice_table
where device_id in('deviceId1', 'deviceId2', 'deviceId3') group by device_id -
Insert new data through the schemaless model,
-
See error
Assume that the initial value of SwitchState is true. After inserting new data, the value becomes false. You will find that the execution result of SQL A will immediately get the latest data 'false', while SQL B will get the expected latest result 'false' only after a varying time of 10-40 seconds.
Environment (please complete the following information):
- TDengine Version [3.0.7.1]
Additional Context
Add any other context about the problem here.
Uploading 屏幕录制2024-05-30 112331_compressed.mp4…