Mihaly Szjatinya created IMPALA-15775:
-----------------------------------------
Summary: Puffin NDV stats override HMS stats computed for the same
Iceberg snapshot
Key: IMPALA-15775
URL: https://issues.apache.org/jira/browse/IMPALA-15775
Project: IMPALA
Issue Type: Bug
Components: Frontend
Affects Versions: Impala 5.0.0
Reporter: Mihaly Szjatinya
Assignee: Mihaly Szjatinya
When an Iceberg table has both HMS and Puffin NDV stats for a column,
{{PuffinStatsLoader}} decides which one to use by comparing the snapshot stored
in the {{impala.computeStatsSnapshotIds}} table property with the snapshot of
the Puffin blob. If both refer to the same snapshot, the Puffin stats are used,
because {{hmsHasMoreRecentStats()}} relies on a strict comparison
({{isMoreRecentSnapshot()}}).
Before IMPALA-14261 the check was {{hmsStatsTimestampMs_ >= snapshotTs}}, i.e.
HMS stats won the tie, as the comment of the method ("at least as recent")
still says. IMPALA-14261 switched to snapshot ids and lost the equality case.
Consequence: HMS stats for the current snapshot are ignored whenever Puffin
stats exist for the same snapshot, e.g.
* a manual {{ALTER TABLE ... SET COLUMN STATS}} after {{COMPUTE STATS}} has no
effect,
* HMS stats computed by Impala are shadowed by Puffin stats written by another
engine for the same snapshot.
Fix: treat equal snapshots as "HMS is at least as recent", document the tie
rule and add a test where HMS and Puffin stats refer to the same snapshot.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)