xanderbailey commented on code in PR #2453:
URL: https://github.com/apache/iceberg-rust/pull/2453#discussion_r3276241456


##########
crates/iceberg/src/spec/snapshot.rs:
##########
@@ -199,8 +200,22 @@ impl Snapshot {
         &self,
         file_io: &FileIO,
         table_metadata: &TableMetadata,
+        encryption_manager: Option<&EncryptionManager>,
     ) -> Result<ManifestList> {
-        let manifest_list_content = 
file_io.new_input(&self.manifest_list)?.read().await?;
+        let manifest_list_content = match (&self.encryption_key_id, 
encryption_manager) {
+            (Some(_), None) => {
+                return Err(Error::new(
+                    ErrorKind::FeatureUnsupported,
+                    "Snapshot has encryption_key_id but no EncryptionManager 
configured on Table",
+                ));
+            }
+            (Some(key_id), Some(em)) => {
+                let key_metadata = 
em.decrypt_manifest_list_key_metadata(key_id).await?;
+                let input = file_io.new_input(&self.manifest_list)?;
+                EncryptedInputFile::new(input, key_metadata).read().await?
+            }
+            (None, _) => file_io.new_input(&self.manifest_list)?.read().await?,

Review Comment:
   Double checked and java does the same 
https://github.com/apache/iceberg/blob/main/api/src/main/java/org/apache/iceberg/encryption/EncryptingFileIO.java#L120-L125



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