stevenzwu commented on code in PR #16936:
URL: https://github.com/apache/iceberg/pull/16936#discussion_r3457444883
##########
api/src/main/java/org/apache/iceberg/ManifestFile.java:
##########
@@ -186,6 +186,26 @@ default boolean hasDeletedFiles() {
/** Returns the total number of rows in all files with status DELETED in the
manifest file. */
Long deletedRowsCount();
+ /**
+ * Returns the number of files with status REPLACED in the manifest file, or
null if not tracked.
+ *
+ * <p>REPLACED files are the prior-state entries of v4 REPLACED/MODIFIED
pairs and are not live.
+ * Returns null for manifest files written by pre-v4 writers.
+ */
+ default Integer replacedFilesCount() {
Review Comment:
Acknowledging the general guidance: public-interface changes should be
minimized and delayed. Justification for keeping these two on the interface in
this PR:
**In-tree consumers** (this PR + close follow-ups):
- `ContentEntryAdapters.manifestInfo()` (this PR) populates the v4 root
manifest's `manifest_info` struct from `manifest.replacedFilesCount()` /
`replacedRowsCount()`.
- `MergingSnapshotProducer.validateAddedDVs` (follow-up phase) filters
concurrent data manifests by `replacedFilesCount > 0` to detect v4 colocated-DV
write conflicts — without it, every concurrent data manifest must be
deep-scanned.
**Convention.** The interface-default pattern matches v3's existing
extensions for spec-defined optional fields on `ManifestFile`: `firstRowId`
(row lineage), `keyMetadata` (encryption), `containsNaN` (partition NaN). v4
spec-defined `manifest_info` counts belong on the same interface in the same
shape.
**A `TrackedFile`-based parallel v4 API was considered.** Would require
rewriting `ManifestGroup` and every engine that consumes `FileScanTask`. The
cost is disproportionate to the savings.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]