Skip to content

fix(arrow-array): check logical nulls, not is_nullable, for a non-nullable list field - #11178

Merged
Jefffrey merged 1 commit into
apache:mainfrom
amitvijapur:fix/list-non-nullable-field-logical-nulls
Sep 25, 2026
Merged

Jefffrey merged 1 commit into
apache:mainfrom
amitvijapur:fix/list-non-nullable-field-logical-nulls

Conversation

@amitvijapur

Copy link
Copy Markdown
Contributor

Which issue does this PR close?

Closes #6538.

Rationale for this change

GenericListArray::try_new and GenericListViewArray::try_new reject a non-nullable field whenever values.is_nullable() is true. Array::is_nullable may return true conservatively, and DictionaryArray::is_nullable does so when the keys carry a null buffer, even an all-valid one, or when the values hold a null that no key references. Such a dictionary has zero logical nulls and is rejected anyway.

The UnionArray case in the issue no longer reproduces: #6540 made UnionArray::is_nullable ask its children. The dictionary case still does.

What changes are included in this PR?

Both constructors test values.logical_null_count() != 0 instead, which is what FixedSizeListArray::try_new already checks through logical_nulls(). The doc bullets are updated to match.

Are these changes tested?

A test in each file builds a list over an Int8DictionaryArray whose keys have an all-valid null buffer under a non-nullable field, which failed before the change, and then one with a null key, which still fails with cannot contain nulls. cargo test -p arrow-array passes.

Are there any user-facing changes?

A list or list-view array over a dictionary with no logical nulls can now be built under a non-nullable field. Arrays that hold a logical null are still rejected as before.

…lable list field

GenericListArray::try_new and GenericListViewArray::try_new rejected a
non-nullable field whenever values.is_nullable() returned true, which
DictionaryArray does conservatively for keys with an all-valid null buffer
or values that hold an unreferenced null. Check logical nulls, as
FixedSizeListArray::try_new already does.

Closes apache#6538
@github-actions github-actions Bot added arrow Changes to the arrow crate arrow-array labels Sep 22, 2026
@Jefffrey Jefffrey added the bug label Sep 25, 2026
@Jefffrey
Jefffrey merged commit 951d939 into apache:main Sep 25, 2026
41 checks passed
@Jefffrey

Copy link
Copy Markdown
Contributor

thanks @amitvijapur

haohuaijin pushed a commit to haohuaijin/arrow-rs that referenced this pull request Sep 25, 2026
…lable list field (apache#11178)

# Which issue does this PR close?

Closes apache#6538.

# Rationale for this change

`GenericListArray::try_new` and `GenericListViewArray::try_new` reject a
non-nullable `field` whenever `values.is_nullable()` is true.
`Array::is_nullable` may return `true` conservatively, and
`DictionaryArray::is_nullable` does so when the keys carry a null
buffer, even an all-valid one, or when the values hold a null that no
key references. Such a dictionary has zero logical nulls and is rejected
anyway.

The `UnionArray` case in the issue no longer reproduces: apache#6540 made
`UnionArray::is_nullable` ask its children. The dictionary case still
does.

# What changes are included in this PR?

Both constructors test `values.logical_null_count() != 0` instead, which
is what `FixedSizeListArray::try_new` already checks through
`logical_nulls()`. The doc bullets are updated to match.

# Are these changes tested?

A test in each file builds a list over an `Int8DictionaryArray` whose
keys have an all-valid null buffer under a non-nullable field, which
failed before the change, and then one with a null key, which still
fails with `cannot contain nulls`. `cargo test -p arrow-array` passes.

# Are there any user-facing changes?

A list or list-view array over a dictionary with no logical nulls can
now be built under a non-nullable field. Arrays that hold a logical null
are still rejected as before.
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 arrow-array bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ListArray::try_new rejects {Union,Dictionary}Array incorrectly if field is not nullable

2 participants