[ 
https://issues.apache.org/jira/browse/ARROW-17951?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17624380#comment-17624380
 ] 

Miles Granger commented on ARROW-17951:
---------------------------------------

Seems to make sense to me. (y)
I would guess in the meantime you've found using `combine_chunks` may suffice? 
(albeit, not optimal)
{code:python}
pc.replace_with_mask(
    pa.chunked_array([pa.array(["a", "b"])]),
    pa.chunked_array([pa.array([True, False])]).combine_chunks(),
    pa.scalar("c", pa.string()),
)
{code}

> [Python] Support ChunkedArray mask in replace operations
> --------------------------------------------------------
>
>                 Key: ARROW-17951
>                 URL: https://issues.apache.org/jira/browse/ARROW-17951
>             Project: Apache Arrow
>          Issue Type: Improvement
>         Environment: pyarrow==9.0.0
> python 3.9
>            Reporter: &res
>            Priority: Minor
>
> Replace operations (more specifically replace_with_mask) don't support 
> chunked array for the mask argument.
> But one would expect that ReplaceMaskChunked, which support chunked array for 
>  its input data (the data to be replaced), should also support chunked array 
> for its mask.
>  
> {code:java}
> pc.replace_with_mask(pa.array(["a", "b"]), pa.array([True, False]), 
> pa.scalar("c", pa.string()))
> pc.replace_with_mask(
>     pa.chunked_array([pa.array(["a", "b"])]),
>     pa.array([True, False]),
>     pa.scalar("c", pa.string()),
> )
> with pytest.raises(pa.ArrowInvalid, match=r"Mask must be array or scalar, not 
> ChunkedArray"):
>     pc.replace_with_mask(
>         pa.chunked_array([pa.array(["a", "b"])]),
>         pa.chunked_array([pa.array([True, False])]),
>         pa.scalar("c", pa.string()),
>     ) {code}
>  
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to