Skip to content

Add Avro compression #1976

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open

Add Avro compression #1976

wants to merge 9 commits into from

Conversation

Fokko
Copy link
Contributor

@Fokko Fokko commented May 6, 2025

Rationale for this change

PyIceberg did not compress the Avro. This will make gzip/deflate the same as in Java.

Are these changes tested?

Existing round-trip tests with FastAvro and Spark. Some tests are extended to both write compressed and uncompressed data.

Are there any user-facing changes?

Smaller and faster manifest files :)

Fokko added 3 commits May 6, 2025 23:47
PyIceberg did not compress the Avro. This will make gzip/deflate
the same as in Java.
@Fokko Fokko requested review from kevinjqliu, sungwy and HonahX May 15, 2025 10:19
Copy link
Collaborator

@sungwy sungwy left a comment

Choose a reason for hiding this comment

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

Hi @Fokko thanks for working on this, and thanks for the review @ndrluis !

The PR looks good to me, I have a nit suggestion about adding a few more tests, but approving it as the logic looks sound.

Comment on lines +133 to +135
self._compression = self._transaction.table_metadata.properties.get( # type: ignore
TableProperties.WRITE_AVRO_COMPRESSION, TableProperties.WRITE_AVRO_COMPRESSION_DEFAULT
)
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think little things like table property parsing has gotten us unexpectedly in the past - would it be possible to add a few cases that demonstrate:

  • that the newly written manifests now have the new default compression when a new snapshot is committed?
  • and that newly written manifests respect a compression codec value when the property is set, when a new snapshot is committed?

I think this would help us add coverage for the new parameter both in property parsing and the simple logic here in update.snapshots module in each functions

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's a good point @sungwy, and indeed that caught us in the past. I've added the test that you suggested, let me know what you think 👍

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.

3 participants