Skip to content

fix(parquet): guard byte-stream-split encoder release against never-flushed buffer - #1273

Open
tom-eon wants to merge 1 commit into
apache:mainfrom
tom-eon:fix-byte-stream-split-release-nil
Open

fix(parquet): guard byte-stream-split encoder release against never-flushed buffer#1273
tom-eon wants to merge 1 commit into
apache:mainfrom
tom-eon:fix-byte-stream-split-release-nil

Conversation

@tom-eon

@tom-eon tom-eon commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Rationale for this change

byteStreamSplitEncoder.Release unconditionally passes enc.flushBuffer to releaseBufferToPool, which dereferences it. The flush buffer is allocated lazily on the first FlushValues, so releasing an encoder that never flushed — which columnWriter.Close does for a column chunk that received no values — dereferences nil and crashes the process with a SIGSEGV. ByteStreamSplitFixedLenByteArrayEncoder.Release has the same defect.

What changes are included in this PR?

A nil guard at the top of releaseBufferToPool, covering both encoders, plus a regression test that releases a never-flushed BYTE_STREAM_SPLIT encoder for all five physical types (INT32, INT64, FLOAT, DOUBLE, FIXED_LEN_BYTE_ARRAY).

Are these changes tested?

Yes. The new test panics on every subtest without the fix and passes with it; the existing parquet/internal/encoding and parquet/file suites pass.

Are there any user-facing changes?

No API changes. Writing a parquet file with a BYTE_STREAM_SPLIT column no longer panics when a column chunk ends up empty (e.g. an empty trailing row group).

@tom-eon
tom-eon requested a review from zeroshade as a code owner September 1, 2026 13:59
…lushed buffer

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@tom-eon
tom-eon force-pushed the fix-byte-stream-split-release-nil branch from 843c38a to 7135617 Compare September 1, 2026 14:49
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.

1 participant