Skip to content

fix(variant): avoid panic on variant_get for non-nullable field - #11356

Open
neilconway wants to merge 1 commit into
apache:mainfrom
neilconway:neilc/fix-variant-get-non-nullable-list
Open

neilconway wants to merge 1 commit into
apache:mainfrom
neilconway:neilc/fix-variant-get-non-nullable-list

Conversation

@neilconway

@neilconway neilconway commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

Which issue does this PR close?

  • N/A

Rationale for this change

variant_get built List and ListView results using GenericListArray::new and GenericListViewArray::new, which panic if the array would be invalid. Given a list type with a non-nullable field, asking for a result with a null value in such a field would panic instead of returning an error.

What changes are included in this PR?

  • Use try_new instead of new, matching the existing FSL and struct paths
  • Add unit test

Are these changes tested?

Yes; existing test pass, new test added.

Are there any significant user-facing changes?

No.

AI usage

Developed with Claude Code (Opus 5.5). I have reviewed and understand the resulting code.

…ist items in `variant_get`

`variant_get` built List and ListView results with `GenericListArray::new`
and `GenericListViewArray::new`, which panic if the array would be invalid.
So asking for a list type with a non-nullable item field panicked, rather
than returning an error, whenever an item in the result was null: either a
null element in the variant list, or an element that a safe cast turned
into null because it did not fit the item type. Use `try_new`, as the
FixedSizeList and struct paths already do.
@github-actions github-actions Bot added the parquet-variant parquet-variant* crates label Oct 3, 2026
@Jefffrey Jefffrey added the bug label Oct 3, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug parquet-variant parquet-variant* crates

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants