Repository navigation
feat(encryption): [13/N] Write encrypted Parquet data files - #4328
Merged
kevinjqliu merged 4 commits intoNov 13, 2026
Merged
Conversation
Data files of a table with encryption.key-id are written with Parquet modular encryption, using a fresh key and AAD prefix per file, and the key metadata is recorded on the DataFile. Like Java, the AAD prefix is not stored in the file.
xanderbailey
commented
Nov 10, 2026
Keeps plaintext writes working with FileFormatModel implementations that predate the key_metadata argument.
xanderbailey
marked this pull request as ready for review
November 10, 2026 23:43
kevinjqliu
reviewed
Nov 13, 2026
| if (table_key_id := metadata.properties.get(TableProperties.ENCRYPTION_KEY_ID)) is None: | ||
| return None | ||
|
|
||
| if not isinstance(metadata, TableMetadataV3): |
Contributor
There was a problem hiding this comment.
nit: not related to this pr, but generally i think we should compare using "version >= 3" instead of isinstance
kevinjqliu
reviewed
Nov 13, 2026
| self._fos: OutputStream | None = None | ||
| self._parquet_writer_kwargs = _get_parquet_writer_kwargs(properties) | ||
| if key_metadata is not None: | ||
| self._parquet_writer_kwargs["encryption_properties"] = _parquet_encryption_properties(key_metadata) |
Contributor
There was a problem hiding this comment.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
kevinjqliu
approved these changes
Nov 13, 2026
Comment on lines
+1179
to
+1182
| def _parquet_encryption_properties(key_metadata: StandardKeyMetadata | None) -> pq.FileEncryptionProperties | None: | ||
| if key_metadata is None: | ||
| return None | ||
|
|
Contributor
There was a problem hiding this comment.
this is a nit change, i prefer to keep the logic inside _parquet_encryption_properties itself and simplify ParquetFormatWriter.__init__
kevinjqliu
enabled auto-merge
November 13, 2026 19:59
Contributor
|
Thanks @xanderbailey feels like we are very close to E2E read/write of encrypted tables 😄 |
Contributor
Author
|
Very nice improvements, thanks Kevin |
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
First write-side PR: data files of an encrypted table are written with Parquet Modular Encryption.
DataFile'skey_metadata.Commits to v3 tables still fail at the manifest writer, so encrypted manifests come next once #3624 lands.
Are these changes tested?
Yes,
write_fileon an encrypted table writes encrypted files that read back through a scan. I also checked iceberg-rust can read one.Are there any user-facing changes?
No.