Repository navigation
feat(encryption): [11/N] Read encrypted Parquet data files - #4309
Open
xanderbailey wants to merge 1 commit into
Open
xanderbailey wants to merge 1 commit into
xanderbailey wants to merge 1 commit into
Conversation
A data file's key_metadata holds its Parquet encryption key and AAD prefix, so scans decrypt with pyarrow's direct key API when it is set, as iceberg-rust does. That API needs pyarrow 25.
xanderbailey
marked this pull request as ready for review
November 8, 2026 18:24
xanderbailey
commented
Nov 8, 2026
| from pyarrow.parquet import encryption | ||
|
|
||
| MIN_PYARROW_VERSION_SUPPORTING_PARQUET_DECRYPTION = "25.0.0" | ||
| if version.parse(pyarrow.__version__) < version.parse(MIN_PYARROW_VERSION_SUPPORTING_PARQUET_DECRYPTION): |
Contributor
Author
There was a problem hiding this comment.
Not 100% sure what the blessed way to do this is...
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Working towards #3222
Rationale for this change
We need to be able to read data files encrypted with Parquet Modular Encryption.
key_metadatain 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 theEncryptionManageror the KMS.key_metadatais set, scans build the Parquet file format with decryption properties from PyArrow's direct key API,pyarrow.parquet.encryption.create_decryption_properties(GH-47435: [Python][Parquet] Add direct key encryption/decryption API arrow#49667). This matches iceberg-rust, which builds arrow-rsFileDecryptionPropertiesfrom the key and AAD prefix ([9/N] feat(encryption) [9/N] Read encrypted parquet data-files iceberg-rust#2584).The direct key API was added in PyArrow 25, so reading an encrypted file on an older PyArrow raises an
ImportErrorasking 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.