gaborkaszab commented on code in PR #18884:
URL: https://github.com/apache/iceberg/pull/18884#discussion_r4568045753


##########
core/src/main/java/org/apache/iceberg/RootManifestFile.java:
##########
@@ -21,14 +21,31 @@
 import java.nio.ByteBuffer;
 import java.util.Arrays;
 import java.util.List;
+import org.apache.iceberg.io.FileIO;
 import org.apache.iceberg.relocated.com.google.common.base.MoreObjects;
 import org.apache.iceberg.relocated.com.google.common.base.Preconditions;
 import org.apache.iceberg.util.ByteBuffers;
+import org.apache.iceberg.util.LocationUtil;
 
 /** A {@link ManifestFile} for the root manifest of an adaptive metadata tree. 
*/
 class RootManifestFile implements ManifestFile {
   private static final int FORMAT_VERSION = 4;
 
+  static RootManifestFile from(Snapshot snapshot, FileIO io, String 
tableLocation) {
+    if (snapshot.keyId() != null) {
+      throw new UnsupportedOperationException("Encrypted v4 root manifests are 
not supported");
+    }
+
+    String location = LocationUtil.resolveLocation(tableLocation, 
snapshot.rootManifestLocation());
+    return new RootManifestFile(
+        location,
+        io.newInputFile(location).getLength(),

Review Comment:
   About the question whether to have a length member in snapshot: There are a 
number of cases when we don't have the length through key metadata:
   - Encryption is only implemented now for tables in Hive catalog if I'm not 
mistaken. 
   - Parquet files we don't need to save length. We might do in our Java 
implementation, but not required, so other writers might not write length to 
Parque files key metadata. Just checked the encryption spec proposal, it also 
mentions length optional, and not set for Parquet.
   
   I think saving length to Snapshot makes sense.



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