Skip to content

feat(encryption): [13/N] Write encrypted Parquet data files - #4328

Open
xanderbailey wants to merge 2 commits into
apache:mainfrom
xanderbailey:xb/encryption-write-parquet
Open

xanderbailey wants to merge 2 commits into
apache:mainfrom
xanderbailey:xb/encryption-write-parquet

Conversation

@xanderbailey

Copy link
Copy Markdown
Contributor

Working towards #3222

Rationale for this change

First write-side PR: data files of an encrypted table are written with Parquet Modular Encryption.

  • Each data file gets its own key and AAD prefix, recorded as the DataFile's key_metadata.
  • Like Java, the AAD prefix isn't stored in the file.
  • Needs pyarrow >= 25, and raises on older versions rather than writing plaintext.

Commits to v3 tables still fail at the manifest writer, so encrypted manifests come next once #3624 lands.

Are these changes tested?

Yes, write_file on 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.

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.
file_schema: Schema,
properties: Properties,
) -> FileFormatWriter: ...
key_metadata: StandardKeyMetadata | None = None,

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interested in thoughts here, we can add default as None here to not break existing callers but it does mean you need to provide it when we need it

Keeps plaintext writes working with FileFormatModel implementations that
predate the key_metadata argument.
@xanderbailey
xanderbailey marked this pull request as ready for review November 10, 2026 23:43

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant