Skip to content

fix(parquet/pqarrow): Fix null_count column stats - #489

Merged
zeroshade merged 1 commit into
apache:mainfrom
MasslessParticle:fix-repitions-required-dictionary-null-values
Sep 4, 2025
Merged

fix(parquet/pqarrow): Fix null_count column stats#489
zeroshade merged 1 commit into
apache:mainfrom
MasslessParticle:fix-repitions-required-dictionary-null-values

Conversation

@MasslessParticle

Copy link
Copy Markdown
Contributor

Rationale for this change

When dictionary encoding is enabled and and repetitions are set to required, the null_count statistic is negative because defLevels is always 0.

What changes are included in this PR?

This PR sets the null count to 0 if defLevels - nonNullCount < 0

Are these changes tested?

Yes. I've added a new test that exposes another bug. I started with the fullTypeList variable like this test and discovered that not all types are supported.

If an unsupported type is encoded as a dictionary, it results in a nasty panic in the typed dictionary encoder because the types don't line up.

Are there any user-facing changes?

Yes, the stats written to parquet files are currently wrong for these sorts of columns. This PR should fix that!

@MasslessParticle

Copy link
Copy Markdown
Contributor Author

I've added a new issue for the encoding panic I mentioned here

@zeroshade
zeroshade merged commit 5651f0c into apache:main Sep 4, 2025
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants