Skip to content

GH-43838: [Python][C++] Preserve nested NullType metadata in array views#50607

Open
dartkron wants to merge 1 commit into
apache:mainfrom
dartkron:gh-43838-nested-null-array-view
Open

GH-43838: [Python][C++] Preserve nested NullType metadata in array views#50607
dartkron wants to merge 1 commit into
apache:mainfrom
dartkron:gh-43838-nested-null-array-view

Conversation

@dartkron

@dartkron dartkron commented Jul 22, 2026

Copy link
Copy Markdown

Rationale for this change

ViewDataImpl skipped input layout entries marked ALWAYS_NULL. A nested
NullType has no physical buffer, but its ArrayData still carries the length
and offset needed for the output. Losing this metadata could make a cast to the
same nested type produce an invalid child array.

Fixes #43838.

What changes are included in this PR?

Preserve length and offset when matching an input NullType with an output
NullType, while retaining the previous behavior for other ALWAYS_NULL
layouts, including union and run-end encoded types. Add a regression test for
a sliced nested NullArray.

Are these changes tested?

Yes. The regression test and all 51 CTest targets enabled in the local C++
build pass in an Ubuntu 24.04 container.

Are there any user-facing changes?

Yes. Casts containing nested NullType fields no longer produce invalid child
arrays. There are no public API changes.

AI assistance

AI assistance was used during investigation, implementation, and review. I
reviewed the final changes and verified them with the tests described above.

This PR contains a "Critical Fix". The previous behavior could produce an
invalid array from valid input.

@dartkron
dartkron requested a review from pitrou as a code owner July 22, 2026 18:01
@github-actions

Copy link
Copy Markdown

⚠️ GitHub issue #43838 has been automatically assigned in GitHub to PR creator.

@dartkron dartkron changed the title GH-43838: [C++] Preserve nested NullType metadata in array views GH-43838: [Python][C++] Preserve nested NullType metadata in array views Jul 22, 2026
@github-actions

Copy link
Copy Markdown

⚠️ GitHub issue #43838 has been automatically assigned in GitHub to PR creator.

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Python][C++] Casting a list of struct array with null field results in invalid result

1 participant