HyukjinKwon opened a new pull request, #48920:
URL: https://github.com/apache/arrow/pull/48920

   ### 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:
   
   ```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]]
   ```
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to