Skip to content

fix(parquet/variant): handle empty metadata keys#985

Open
fallintoplace wants to merge 1 commit into
apache:mainfrom
fallintoplace:fix/variant-empty-key
Open

fix(parquet/variant): handle empty metadata keys#985
fallintoplace wants to merge 1 commit into
apache:mainfrom
fallintoplace:fix/variant-empty-key

Conversation

@fallintoplace

@fallintoplace fallintoplace commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Rationale for this change

Variant metadata may contain an empty object key. Metadata.KeyAt validates the dictionary index, then previously took the address of the key's first byte. That panics when the key is empty.

What changes are included in this PR?

Use unsafe.SliceData for the existing zero-copy byte-to-string conversion so zero-length keys are handled safely. Add a builder-based regression covering both KeyAt and IdFor.

Are these changes tested?

Yes:

  • go test ./parquet/variant
  • go test -race -count=1 ./parquet/variant

Are there any user-facing changes?

Metadata.KeyAt now returns an empty string for a valid empty key instead of panicking. There is no API change.

@fallintoplace
fallintoplace requested a review from zeroshade as a code owner July 23, 2026 00:49
@fallintoplace
fallintoplace force-pushed the fix/variant-empty-key branch from efa6d4c to 09defe6 Compare July 23, 2026 00:53
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