Skip to content

Fix JSON reader panic for non-nullable zero-size FixedSizeList#9810

Merged
Jefffrey merged 2 commits into
apache:mainfrom
liamzwbao:issue-9780-degenerate-non-nullable-fixed-size-list-decoder
Apr 29, 2026
Merged

Fix JSON reader panic for non-nullable zero-size FixedSizeList#9810
Jefffrey merged 2 commits into
apache:mainfrom
liamzwbao:issue-9780-degenerate-non-nullable-fixed-size-list-decoder

Conversation

@liamzwbao
Copy link
Copy Markdown
Contributor

Which issue does this PR close?

Rationale for this change

What changes are included in this PR?

Use FixedSizeListArray::try_new_with_length to avoid panic when decoding degenerate non-nullable FixedSizeList

Are these changes tested?

Yes

Are there any user-facing changes?

Bug fixed

@github-actions github-actions Bot added the arrow Changes to the arrow crate label Apr 24, 2026
@liamzwbao liamzwbao marked this pull request as ready for review April 24, 2026 23:43
@Jefffrey
Copy link
Copy Markdown
Contributor

Oh my apologies, I think my initial report was wrong. I think it panicked because I had the field as non-nullable but provided null data. Looks like this fix might not be needed actually 🤔

@liamzwbao
Copy link
Copy Markdown
Contributor Author

Although the initial report was the expected behavior, it did help uncover a real bug: when a non-nullable FixedSizeList has size=0 and all inputs are valid empty arrays, the decoder produces length 0 instead of the correct row count. The new test reproduces this: 3 rows of {"a": []} should give len=3 but panics without the fix.

@Jefffrey Jefffrey merged commit b114241 into apache:main Apr 29, 2026
23 checks passed
@Jefffrey
Copy link
Copy Markdown
Contributor

Thanks @liamzwbao

@liamzwbao liamzwbao deleted the issue-9780-degenerate-non-nullable-fixed-size-list-decoder branch April 30, 2026 00:59
Rich-T-kid pushed a commit to Rich-T-kid/arrow-rs that referenced this pull request Jun 2, 2026
…e#9810)

# Which issue does this PR close?

<!--
We generally require a GitHub issue to be filed for all bug fixes and
enhancements and this helps us generate change logs for our releases.
You can link an issue to this PR using the GitHub syntax.
-->

- Closes apache#9780.

# Rationale for this change

<!--
Why are you proposing this change? If this is already explained clearly
in the issue then this section is not needed.
Explaining clearly why changes are proposed helps reviewers understand
your changes and offer better suggestions for fixes.
-->

# What changes are included in this PR?

<!--
There is no need to duplicate the description in the issue here but it
is sometimes worth providing a summary of the individual changes in this
PR.
-->

Use `FixedSizeListArray::try_new_with_length` to avoid panic when
decoding degenerate non-nullable `FixedSizeList`

# Are these changes tested?

<!--
We typically require tests for all PRs in order to:
1. Prevent the code from being accidentally broken by subsequent changes
2. Serve as another way to document the expected behavior of the code

If tests are not included in your PR, please explain why (for example,
are they covered by existing tests)?
-->
Yes

# Are there any user-facing changes?

<!--
If there are user-facing changes then we may require documentation to be
updated before approving the PR.

If there are any breaking changes to public APIs, please call them out.
-->
Bug fixed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

arrow Changes to the arrow crate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug converting json to fixed list of zero size

2 participants