mirror of
https://github.com/hanzoai/datastore.git
synced 2026-09-26 13:55:07 +00:00
The `hive_files_cache` lives on the per-remote-table `HiveTableMetadata` and is shared by every `StorageHive` table over the same remote Hive table, but a cached `IHiveFile` bakes in table-specific state: the partition values, the minmax-index column layout (`index_names_and_types`), the file format, and the `enable_orc_*` / `enable_parquet_rowgroup_minmax_index` settings. `Hive` allows different ClickHouse schemas/settings over one remote table, so two such tables previously shared one cached file (keyed only by the remote `file_info.path`); the second table then pruned and interpreted the cached minmax index against the first table's layout and could silently keep or skip the wrong data. Key the cache by the remote path plus a `SipHash` signature of that table-specific state, so mismatched tables get independent cache entries while an identical table still reuses the cache. Add `test_hive_files_cache_is_table_local`, which reads the same remote ORC table through two ClickHouse `Hive` tables that differ in column order and minmax settings and asserts each returns its own correct rows. Addresses review: https://github.com/ClickHouse/ClickHouse/pull/108094#discussion_r3507709555 Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>