Skip to content

Conversation

@HyukjinKwon
Copy link
Member

@HyukjinKwon HyukjinKwon commented Jan 21, 2026

Rationale for this change

Nested types (List, LargeList, ListView, LargeListView, FixedSizeList, Map, Struct) were not supported in replace_with_mask, fill_null_forward, and fill_null_backward functions. It was marked as a todo.

What changes are included in this PR?

Added nested type support to replace_with_mask, fill_null_forward, and fill_null_backward by leveraging AppendScalar, AppendArraySlice, etc.

Are these changes tested?

Yes, manually tested as below, and unittests were added.

Are there any user-facing changes?

Yes. Here is one example in Python:

import pyarrow.compute as pc

pc.replace_with_mask([[1, 2], [3, 4], [5, 6]], [False, True, False], [[7, 8]])
pc.fill_null_forward([[1, 2], None, [5, 6]])
pc.fill_null_backward([[1, 2], None, [5, 6]])

Before:

...
pyarrow.lib.ArrowNotImplementedError: Function 'replace_with_mask' has no kernel matching input types (list<item: int64>, bool, list<item: int64>)
...
pyarrow.lib.ArrowNotImplementedError: Function 'fill_null_forward' has no kernel matching input types (list<item: int64>)
...
pyarrow.lib.ArrowNotImplementedError: Function 'fill_null_backward' has no kernel matching input types (list<item: int64>)

After:

<pyarrow.lib.ListArray object at 0x10c0ae5c0>
[[1, 2], [7, 8], [5, 6]]
<pyarrow.lib.ListArray object at 0x1a1e209a0>
[[1, 2], [1, 2], [5, 6]]
<pyarrow.lib.ListArray object at 0x1a1e20b20>
[[1, 2], [5, 6], [5, 6]]

@github-actions
Copy link

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

…with_mask, fill_null_forward, and fill_null_backward
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.

1 participant