Skip to content

[Bug] Hive external table SQL cache serves stale results after out-of-band file replacement #66133

Description

@Baymine

Search before asking

  • I had searched in the issues and found no similar issues.

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

  1. Create a Hive external table and run a cacheable query so its result is cached (SQL cache enabled).
  2. Replace the table's data files out-of-band (rewrite the files on storage) without an HMS DDL/event, keeping HMS table parameters unchanged.
  3. Re-run the same query — the FE serves the cached (stale) result because updateTime did not advance.

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions