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 5 commits into
base: main
Choose a base branch
from
Open

Add Avro compression #1976

wants to merge 5 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.

from pyiceberg.avro.codecs.bzip2 import BZip2Codec
from pyiceberg.avro.codecs.codec import Codec
from pyiceberg.avro.codecs.deflate import DeflateCodec
from pyiceberg.avro.codecs.snappy_codec import SnappyCodec
from pyiceberg.avro.codecs.zstandard_codec import ZStandardCodec

KNOWN_CODECS: Dict[str, Optional[Type[Codec]]] = {
AvroCompressionCodec: TypeAlias = Literal["null", "bzip2", "snappy", "zstandard", "deflate"]
Copy link
Collaborator

Choose a reason for hiding this comment

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

In other places in the project we use zstd instead of zstandard. What do you think about using zstd?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hey @ndrluis that's a great catch! We should use zstd instead. Avro uses zstandard, that's why I copied it here, but it is actually wrong.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

keep in min that this TypeAlias is called AvroCompressionCodec, so it should actually use zstandard instead of zstd, but I've fixed it for Iceberg. LMKWYT

@Fokko Fokko requested review from kevinjqliu, sungwy and HonahX May 15, 2025 10:19
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.

2 participants