Search before asking
Description
When Hive table data files are replaced out-of-band — e.g. by an external job that only rewrites the underlying data files on HDFS/S3 without issuing an HMS DDL statement or an HMS event notification — the FE's in-memory HMSExternalTable.updateTime never advances.
The FE SQL cache (NereidsSqlCacheManager / SqlCacheContext, via CacheAnalyzer) keys cache validity on HMSExternalTable.getUpdateTime(). Because that value only advances from HMS table parameters (transient_lastDdlTime) and never from the files actually observed during a scan, a stale updateTime lets the SQL cache keep serving result sets computed from the old files. Queries then return stale/incorrect data until the table's metadata is next refreshed by some other trigger.
Reproduce
- Create a Hive external table and run a cacheable query so its result is cached (SQL cache enabled).
- Replace the table's data files out-of-band (rewrite the files on storage) without an HMS DDL/event, keeping HMS table parameters unchanged.
- Re-run the same query — the FE serves the cached (stale) result because
updateTime did not advance.
Are you willing to submit PR?
Search before asking
Description
When Hive table data files are replaced out-of-band — e.g. by an external job that only rewrites the underlying data files on HDFS/S3 without issuing an HMS DDL statement or an HMS event notification — the FE's in-memory
HMSExternalTable.updateTimenever advances.The FE SQL cache (
NereidsSqlCacheManager/SqlCacheContext, viaCacheAnalyzer) keys cache validity onHMSExternalTable.getUpdateTime(). Because that value only advances from HMS table parameters (transient_lastDdlTime) and never from the files actually observed during a scan, a staleupdateTimelets the SQL cache keep serving result sets computed from the old files. Queries then return stale/incorrect data until the table's metadata is next refreshed by some other trigger.Reproduce
updateTimedid not advance.Are you willing to submit PR?