kevinjqliu commented on code in PR #4326:
URL: https://github.com/apache/iceberg-python/pull/4326#discussion_r4528202657


##########
pyiceberg/table/deletion_vector.py:
##########
@@ -152,10 +154,18 @@ def _has_deletion_vector_content_reference(dv: 
"DataFile") -> bool:
     return dv.content_offset is not None or dv.content_size_in_bytes is not 
None or dv.referenced_data_file is not None
 
 
+def _new_input(io: "FileIO", dv: "DataFile") -> "InputFile":
+    """Return the Puffin file to read, decrypting it when it has key metadata 
so content offsets refer to the plaintext."""
+    input_file = io.new_input(dv.file_path)
+    if dv.key_metadata is not None:
+        return EncryptedInputFile(input_file, 
StandardKeyMetadata.from_bytes(dv.key_metadata))
+    return input_file

Review Comment:
   nit: we might want to refactor this (later) since this repeats the same 
logic as 
[`ManifestFile.fetch_manifest_entry()`](https://github.com/apache/iceberg-python/blob/c8e77814bd02a29fc2eef1eed56b73165b8ff166/pyiceberg/manifest.py#L913-L915)
   
   We could potentially share a helper in `pyiceberg/encryption/io.py` that 
accepts an `InputFile` and optional key-metadata bytes, then reuse it in both 
places. Non-blocking.



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