xanderbailey opened a new pull request, #4309:
URL: https://github.com/apache/iceberg-python/pull/4309

   <!--
   Thanks for opening a pull request!
   -->
   Working towards https://github.com/apache/iceberg-python/issues/3222
   <!-- In the case this PR will resolve an issue, please replace 
${GITHUB_ISSUE_ID} below with the actual Github issue id. -->
   <!-- Closes #${GITHUB_ISSUE_ID} -->
   
   # Rationale for this change
   We need to be able to read data files encrypted with Parquet Modular 
Encryption.
   
   - A data file's `key_metadata` in its manifest entry holds the plaintext key 
and AAD prefix for that file. The manifest holding it is itself encrypted, so 
this doesn't need the `EncryptionManager` or the KMS.
   - When `key_metadata` is set, scans build the Parquet file format with 
decryption properties from PyArrow's direct key API, 
`pyarrow.parquet.encryption.create_decryption_properties` (apache/arrow#49667). 
This matches iceberg-rust, which builds arrow-rs `FileDecryptionProperties` 
from the key and AAD prefix ([9/N] apache/iceberg-rust#2584).
   - This covers data files and Parquet position delete files. Encrypted ORC 
files raise, and deletion vectors come in a follow-up.
   - The AAD prefix always comes from key metadata, because Java doesn't store 
it in the file.
   
   The direct key API was added in PyArrow 25, so reading an encrypted file on 
an older PyArrow raises an `ImportError` asking for 25.0.0 or later. The 
minimum PyArrow version for everything else is unchanged.
   
   ## Are these changes tested?
   Yes. A Parquet data file encrypted by iceberg-rust is checked in under 
`tests/table/encryption`, and reading it with its key metadata returns its 
rows. There's also a round trip of an encrypted data file with an encrypted 
position delete file. Reads fail with a wrong key, a wrong AAD prefix, missing 
key metadata, or key metadata on a plaintext file.
   
   ## Are there any user-facing changes?
   No. Nothing changes for unencrypted tables.
   
   <!-- In the case of user-facing changes, please add the changelog label. -->
   


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