You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by GitBox <gi...@apache.org> on 2021/06/02 00:10:06 UTC

[GitHub] [iceberg] flyrain commented on a change in pull request #2520: Core: add key_metadata in ManifestFile

flyrain commented on a change in pull request #2520:
URL: https://github.com/apache/iceberg/pull/2520#discussion_r643564071



##########
File path: core/src/main/java/org/apache/iceberg/ManifestFiles.java
##########
@@ -67,26 +90,47 @@ private ManifestFiles() {
    * @param io a FileIO
    * @return a manifest reader
    */
-  public static ManifestReader<DataFile> read(ManifestFile manifest, FileIO io) {
-    return read(manifest, io, null);
+  public static ManifestReader<DataFile> read(ManifestFile manifest, FileIO io, EncryptionManager encryption) {
+    return read(manifest, io, encryption, null);
+  }
+
+  /**
+   * @deprecated please use {@link #read(ManifestFile, FileIO, EncryptionManager, Map)}
+   */
+  @Deprecated
+  public static ManifestReader<DataFile> read(ManifestFile manifest, FileIO io, Map<Integer, PartitionSpec> specsById) {
+    return read(manifest, io, EncryptionManagers.plainText(), specsById);
   }
 
   /**
    * Returns a new {@link ManifestReader} for a {@link ManifestFile}.
    *
-   * @param manifest a {@link ManifestFile}
+   * @param manifest an encrypted {@link ManifestFile}
    * @param io a {@link FileIO}
+   * @param encryption a {@link EncryptionManager}
    * @param specsById a Map from spec ID to partition spec
    * @return a {@link ManifestReader}
    */
-  public static ManifestReader<DataFile> read(ManifestFile manifest, FileIO io, Map<Integer, PartitionSpec> specsById) {
+  public static ManifestReader<DataFile> read(ManifestFile manifest, FileIO io, EncryptionManager encryption,
+                                              Map<Integer, PartitionSpec> specsById) {
     Preconditions.checkArgument(manifest.content() == ManifestContent.DATA,
         "Cannot read a delete manifest with a ManifestReader: %s", manifest);
-    InputFile file = io.newInputFile(manifest.path());
+
+    EncryptedInputFile encryptedFile = EncryptedFiles.encryptedInput(
+            io.newInputFile(manifest.path()), manifest.keyMetadata());

Review comment:
       A nit: 4 spaces indentation rather than 8 spaces.




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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org