Skip to content

Preserve null lists when projecting a list of structs - #4129

Open
krishan711 wants to merge 2 commits into
apache:mainfrom
krishan711:preserve-null-list-of-structs
Open

krishan711 wants to merge 2 commits into
apache:mainfrom
krishan711:preserve-null-list-of-structs

Conversation

@krishan711

@krishan711 krishan711 commented Oct 21, 2026 •

Copy link
Copy Markdown

Rationale for this change

ArrowProjectionVisitor.list rebuilds a list of structs with LargeListArray.from_arrays(list_array.offsets, value_array). That drops the validity mask, so a null list is written as an empty list. This is the list version of #4118, which fixed the same thing for maps.

The fix passes mask=list_array.is_null().

Are these changes tested?

Yes. test__to_requested_schema_null_list_of_structs covers a full batch and a sliced one. It fails without the fix.

test_null_list_and_map asserted [[], [{"test": 1}]] for col_list_with_struct, with a comment that it should be [None, [{"test": 1}]] once an Arrow issue was fixed. The null was lost by the rebuild here, not by Arrow: from_arrays was given the offsets but not the validity, and a null list and an empty one share offsets. So the test now asserts [None, [{"test": 1}]].

Are there any user-facing changes?

Null lists of structs stay null on write instead of becoming [].

krishan711 and others added 2 commits October 21, 2026 13:13
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

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

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant