rdblue commented on code in PR #14533:
URL: https://github.com/apache/iceberg/pull/14533#discussion_r2539977913


##########
api/src/main/java/org/apache/iceberg/FileContent.java:
##########
@@ -18,11 +18,27 @@
  */
 package org.apache.iceberg;
 
-/** Content type stored in a file, one of DATA, POSITION_DELETES, or 
EQUALITY_DELETES. */
+/**
+ * Content type stored in a file.
+ *
+ * <p>For V1-V3 tables: DATA, POSITION_DELETES, or EQUALITY_DELETES.
+ *
+ * <p>For V4 tables: DATA, POSITION_DELETES, EQUALITY_DELETES, DATA_MANIFEST, 
DELETE_MANIFEST, or
+ * MANIFEST_DV.
+ */
 public enum FileContent {
   DATA(0),
   POSITION_DELETES(1),
-  EQUALITY_DELETES(2);
+  EQUALITY_DELETES(2),
+  /** Data manifest entry (V4+ only) - references data files in a root 
manifest. */
+  DATA_MANIFEST(3),
+  /** Delete manifest entry (V4+ only) - references delete files in a root 
manifest. */
+  DELETE_MANIFEST(4),
+  /**
+   * Manifest deletion vector entry (V4+ only) - marks entries in a manifest 
as deleted without
+   * rewriting the manifest.
+   */
+  MANIFEST_DV(5);

Review Comment:
   I just check with Amogh and I don't think that this has been firmly decided 
yet. From the implementation here, I think we should embed the DV in 
manifest-specific metadata.



##########
core/src/main/java/org/apache/iceberg/GenericTrackedFile.java:
##########
@@ -0,0 +1,773 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.iceberg;
+
+import java.io.Serializable;
+import java.nio.ByteBuffer;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Locale;
+import org.apache.avro.Schema;
+import org.apache.avro.generic.IndexedRecord;
+import org.apache.avro.specific.SpecificData;
+import org.apache.iceberg.avro.AvroSchemaUtil;
+import org.apache.iceberg.avro.SupportsIndexProjection;
+import org.apache.iceberg.relocated.com.google.common.base.MoreObjects;
+import org.apache.iceberg.relocated.com.google.common.collect.ImmutableMap;
+import org.apache.iceberg.types.Types;
+import org.apache.iceberg.util.ArrayUtil;
+import org.apache.iceberg.util.ByteBuffers;
+
+/** Generic implementation of {@link TrackedFile} for V4 manifests. */
+public class GenericTrackedFile extends SupportsIndexProjection
+    implements TrackedFile<GenericTrackedFile>,
+        IndexedRecord,
+        StructLike,
+        SpecificData.SchemaConstructable,
+        Serializable {
+
+  private static final FileContent[] FILE_CONTENT_VALUES = 
FileContent.values();
+
+  // Tracking metadata
+  private String manifestLocation = null;
+  private TrackingInfo.Status status = null;
+  private Long snapshotId = null;
+  private Long sequenceNumber = null;
+  private Long fileSequenceNumber = null;
+  private Long firstRowId = null;
+  private Long position = null;
+
+  // Common file metadata
+  private FileContent contentType = FileContent.DATA;
+  private String location = null;
+  private FileFormat fileFormat = null;
+  private long recordCount = -1L;
+  private Long fileSizeInBytes = null;
+
+  // Deletion vector fields
+  private Long deletionVectorOffset = null;
+  private Long deletionVectorSizeInBytes = null;
+  private byte[] deletionVectorInlineContent = null;
+
+  // Partition and ordering
+  private int partitionSpecId = -1;
+  private Integer sortOrderId = null;
+
+  // Optional metadata
+  private byte[] keyMetadata = null;
+  private long[] splitOffsets = null;
+  private int[] equalityIds = null;
+  private String referencedFile = null;
+
+  // Manifest stats (for manifest entries)
+  private Integer addedFilesCount = null;

Review Comment:
   These fields are required in v4, so they should be primitives in 
`ManifestStatsStruct`.



##########
core/src/main/java/org/apache/iceberg/GenericTrackedFile.java:
##########
@@ -0,0 +1,773 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.iceberg;
+
+import java.io.Serializable;
+import java.nio.ByteBuffer;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Locale;
+import org.apache.avro.Schema;
+import org.apache.avro.generic.IndexedRecord;
+import org.apache.avro.specific.SpecificData;
+import org.apache.iceberg.avro.AvroSchemaUtil;
+import org.apache.iceberg.avro.SupportsIndexProjection;
+import org.apache.iceberg.relocated.com.google.common.base.MoreObjects;
+import org.apache.iceberg.relocated.com.google.common.collect.ImmutableMap;
+import org.apache.iceberg.types.Types;
+import org.apache.iceberg.util.ArrayUtil;
+import org.apache.iceberg.util.ByteBuffers;
+
+/** Generic implementation of {@link TrackedFile} for V4 manifests. */
+public class GenericTrackedFile extends SupportsIndexProjection
+    implements TrackedFile<GenericTrackedFile>,
+        IndexedRecord,
+        StructLike,
+        SpecificData.SchemaConstructable,
+        Serializable {
+
+  private static final FileContent[] FILE_CONTENT_VALUES = 
FileContent.values();
+
+  // Tracking metadata
+  private String manifestLocation = null;
+  private TrackingInfo.Status status = null;
+  private Long snapshotId = null;
+  private Long sequenceNumber = null;
+  private Long fileSequenceNumber = null;
+  private Long firstRowId = null;
+  private Long position = null;
+
+  // Common file metadata
+  private FileContent contentType = FileContent.DATA;
+  private String location = null;
+  private FileFormat fileFormat = null;
+  private long recordCount = -1L;
+  private Long fileSizeInBytes = null;
+
+  // Deletion vector fields
+  private Long deletionVectorOffset = null;
+  private Long deletionVectorSizeInBytes = null;

Review Comment:
   These should be required in the DV struct, since the struct itself is 
optional.



-- 
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]

Reply via email to