trinodb / trino

Official repository of Trino, the distributed SQL query engine for big data, formerly known as PrestoSQL (https://trino.io)
https://trino.io
Apache License 2.0
9.85k stars 2.85k forks source link

Materialized view referencing current date/time not refreshed when underlying tables did not change #22533

Open findepi opened 1 week ago

findepi commented 1 week ago

reproducible with io.trino.plugin.iceberg.IcebergQueryRunner.DefaultIcebergQueryRunnerMain#main

CREATE MATERIALIZED VIEW mv GRACE PERIOD INTERVAL '3' SECOND AS SELECT CURRENT_TIMESTAMP t FROM nation WHERE nationkey=1;

REFRESH MATERIALIZED VIEW mv;

TABLE mv;
                   t
---------------------------------------
 2024-06-27 21:25:54.269 Europe/Warsaw

now, when user waits a few seconds and queries the MV again, they can expect a timestamp not older than current time - 3 seconds, but that's not the case

TABLE mv;
                   t
---------------------------------------
 2024-06-27 21:25:54.269 Europe/Warsaw
findepi commented 1 week ago

cc @alexjo2144 @marton-bod @sopel39