mzzz-zzm commented on code in PR #1039:
URL: https://github.com/apache/iceberg-go/pull/1039#discussion_r3212348243
##########
manifest.go:
##########
@@ -944,6 +944,19 @@ func (v3writerImpl) prepareEntry(entry *manifestEntry,
snapshotID int64) (Manife
}
}
+ // v3 spec deprecates data_file.distinct_counts (parity with Java
+ // apache/iceberg#12182). Today none of the per-version Avro schemas in
+ // internal/avro_schemas.go declare distinct_counts, so the field is
+ // already dropped on encode for every version. This guard is
+ // forward-compatibility insurance: if the v2 schema is later fixed to
+ // declare distinct_counts (v2 spec requires it; tracked separately),
the
+ // v3 path stays compliant by clearing the Avro-facing pointer here. The
+ // cached distinctCntMap and DistinctValueCounts() getter are left alone
+ // so in-memory readers in the same process keep their view.
+ if df, ok := entry.DataFile().(*dataFile); ok {
+ df.DistinctCounts = nil
Review Comment:
Fixed by documenting the ownership choice in the source comment rather than
cloning. The updated comment now states that `prepareEntry` takes ownership of
the entry's data file and clears only the Avro-facing pointer while preserving
the cached `distinctCntMap` / `DistinctValueCounts()` view.
I kept the mutation approach because this PR is intentionally a narrow
writer-path guard, and the commit message now calls out the ownership behavior
explicitly as durable context.
--
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]