Nandor Kollar has posted comments on this change. (
http://gerrit.cloudera.org:8080/24733 )
Change subject: IMPALA-14996: Optimize count(*) for Iceberg V3 DV-only tables
......................................................................
Patch Set 8: -Code-Review
Actually Opus found an interesting and possibly problematic edge case:
"The current-snapshot count can mix two different snapshots (local catalog mode)
getRecordCountForDvOnlyTable() (FeIcebergTable.java:1344-1359) computes
total-records minus the DV row count, but the two numbers come from different
sources:
- total-records comes from
table.getIcebergApiTable().currentSnapshot().summary() (:1347 →
getIcebergSnapshot(), :1394);
- the DV row count comes from table.getContentFileStore() (:1351).
With the local catalog (CatalogdMetaProvider), those aren't guaranteed to
match:
- LocalIcebergTable.snapshotId() returns catalogSnapshotId_, and the file
store is catalogd's, both shipped by catalogd (LocalIcebergTable.java:103,
:165, :170, :288).
- The API table is loaded separately on the coordinator, with
IcebergUtil.loadTable(...) (CatalogdMetaProvider.java:1352-1369). That reads
whatever metadata is current at that moment, and
the result is cached per catalog version.
So suppose an external engine (Spark, Hive, Trino) commits between catalogd's
load (snapshot S1) and the coordinator's load (S2). Then total-records is from
S2 and the DVs are from S1.
Example: Spark compacts the table (rewrite_data_files) in S2, so the old DVs
are gone and total-records = 90. Impala computes 90 − 10 (the stale S1 DVs) =
80, which is wrong for both
snapshots. Because the API table is cached per catalog version, the wrong
result persists until the next version change: an event-processor update or a
REFRESH. With event processing off,
that can be a long time."
Considering this, I think if we don't use the same source (either Iceberg
snapshots or our content file store) count(*) can give incorrect results.
--
To view, visit http://gerrit.cloudera.org:8080/24733
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I0e6239629ee779a64808a0a4bbe041ef756c5bb2
Gerrit-Change-Number: 24733
Gerrit-PatchSet: 8
Gerrit-Owner: Arnab Karmakar <[email protected]>
Gerrit-Reviewer: Arnab Karmakar <[email protected]>
Gerrit-Reviewer: Impala Public Jenkins <[email protected]>
Gerrit-Reviewer: Nandor Kollar <[email protected]>
Gerrit-Reviewer: Peter Rozsa <[email protected]>
Gerrit-Comment-Date: Mon, 26 Oct 2026 14:58:17 +0000
Gerrit-HasComments: No