Skip to content

fix(parquet): free excluded stats bytes in ApplyStatSizeLimits - #885

Merged
zeroshade merged 1 commit into
apache:mainfrom
mdibaiee:fix/stats-max-size-retention
Jul 2, 2026
Merged

zeroshade merged 1 commit into
apache:mainfrom
mdibaiee:fix/stats-max-size-retention

Conversation

@mdibaiee

@mdibaiee mdibaiee commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Rationale for this change

The current implementation has a memory leak where even if limits are set for MinMax statistics, despite not using MinMax after they bypass the limit, the code still retains a copy of the bytes, not allowing GC to clean them up and accumulating memory.

In our use case we have noticed this causes memory accumulation over time and leads to OOMs. After this fix we do not experience the OOMs anymore.

What changes are included in this PR?

Discard unused Min/Max stats bytes

Are these changes tested?

Yes I have tested them in our own codebase https://github.com/estuary/connectors

Are there any user-facing changes?

No

Has*=false alone only affects serialization; the underlying Max/Min byte
slices remained referenced by the persistent ColumnChunkMetaDataBuilder
until file Close(), so oversized per-row-group values were retained in
memory for the writer's entire lifetime regardless of MaxStatsSize.
@mdibaiee
mdibaiee requested a review from zeroshade as a code owner July 2, 2026 18:23
@zeroshade
zeroshade merged commit 7c0238a into apache:main Jul 2, 2026
23 checks passed
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