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

Merged
merged 9 commits into from
Jun 13, 2025
Merged

Add Avro compression #1976

merged 9 commits into from
Jun 13, 2025

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 👍

@Fokko
Copy link
Contributor Author

Fokko commented Jun 13, 2025

Moving this forward, thanks @ndrluis and @sungwy

@Fokko Fokko merged commit f4da19e into apache:main Jun 13, 2025
10 checks passed
@Fokko Fokko deleted the fd-compression branch June 13, 2025 14:05
amitgilad3 pushed a commit to amitgilad3/iceberg-python that referenced this pull request Jul 7, 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 :)

<!-- In the case of user-facing changes, please add the changelog label.
-->
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