rdblue commented on code in PR #16936:
URL: https://github.com/apache/iceberg/pull/16936#discussion_r4170461775
##########
core/src/main/java/org/apache/iceberg/TrackedFileAdapters.java:
##########
@@ -529,6 +566,427 @@ public ManifestFile copy() {
}
}
+ /** Adapts a {@link DataFile} to {@link TrackedFile}. */
+ static class DataTrackedFile implements TrackedFile {
+ private final MapBackedContentStats statsWrapper;
+ private Tracking tracking;
+ private DataFile file;
+ private ContentStats stats;
+
+ DataTrackedFile(Schema tableSchema, MetricsConfig metricsConfig) {
+ this.statsWrapper = new MapBackedContentStats(tableSchema,
metricsConfig);
+ }
+
+ /** Re-points this adapter at a {@link DataFile} from the public API.
Tracking is unset. */
+ public TrackedFile wrap(DataFile newFile) {
+ return wrapFile(newFile, null);
+ }
+
+ /**
+ * Re-points this adapter at a {@link ManifestEntry}. Converts the
contained data file and the
+ * entry's tracking fields.
+ */
+ public TrackedFile wrap(ManifestEntry<DataFile> entry) {
+ Preconditions.checkArgument(entry != null, "Invalid entry: null");
+ return wrapFile(entry.file(), trackingFrom(entry, entry.file()));
+ }
+
+ private TrackedFile wrapFile(DataFile newFile, Tracking newTracking) {
Review Comment:
I think our typical naming convention is `wrapInternal`.
--
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]