anoopj commented on code in PR #15049:
URL: https://github.com/apache/iceberg/pull/15049#discussion_r2934152761
##########
api/src/main/java/org/apache/iceberg/FileContent.java:
##########
@@ -18,11 +18,13 @@
*/
package org.apache.iceberg;
-/** Content type stored in a file, one of DATA, POSITION_DELETES, or
EQUALITY_DELETES. */
+/** Content type stored in a file. */
public enum FileContent {
DATA(0),
POSITION_DELETES(1),
- EQUALITY_DELETES(2);
+ EQUALITY_DELETES(2),
+ DATA_MANIFEST(3),
+ DELETE_MANIFEST(4);
Review Comment:
Good point. I just read through the write path and I think we should be ok.
The v2/v3 writers can't produce files with the new content IDs because of
compile time checks:
1. **DataFile path**: [`GenericDataFile` hardcodes
`FileContent.DATA`](https://github.com/apache/iceberg/blob/16b91678ea9a5703b74d57f4c367b86f0e85edec/core/src/main/java/org/apache/iceberg/GenericDataFile.java#L53)
in its constructor, and [`DataFile.content()` defaults to
`DATA`](https://github.com/apache/iceberg/blob/16b91678ea9a5703b74d57f4c367b86f0e85edec/api/src/main/java/org/apache/iceberg/DataFile.java#L159-L161).
There's no way to create a DataFile with DATA_MANIFEST or DELETE_MANIFEST.
2. **DeleteFile path**: [`FileMetadata.Builder.build()` has a
validation](https://github.com/apache/iceberg/blob/16b91678ea9a5703b74d57f4c367b86f0e85edec/core/src/main/java/org/apache/iceberg/FileMetadata.java#L274-L286)
that only accepts POSITION_DELETES and EQUALITY_DELETES.
3. **Writer typing**: The v2/v3 manifest writers are
`ManifestWriter<DataFile>` and `ManifestWriter<DeleteFile>`.
The V2/V3 metadata wrappers do serialize [`content().id()` without
version-gating](https://github.com/apache/iceberg/blob/16b91678ea9a5703b74d57f4c367b86f0e85edec/core/src/main/java/org/apache/iceberg/V2Metadata.java#L96),
so there's no defense at the serialization layer itself, but the type checking
upstream make it unreachable.
--
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]