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

Niranda Perera commented on ARROW-14982:
----------------------------------------

In Cylon, we do some buffer-level in-place operations. And for those we need a 
deep-copy. IMO, with or without offset, the dev effort would be the same for 
deep-copy isn't it?

Anyways, say we have this.
{code:java}
def deep_copy(pa.Array: arr, int offset = 0, int length = None) -> pa.Array:
{code}
So, following cases would be equivalent. 
{code:java}
a = pa.Array(...)

# case 1 
c1 = deep_copy(a, offset=10)

# case 2 
b = a.slice(10)
...
c2 = deep_copy(b)  # Deep copy, sees this as an array to be copied from 0 --> 
b.length(), but internally b has an offset from slicing 

assert(c1 == c2) 
{code}

> [C++][Python] Create utils for deep-copying an Array/ ArrayData
> ---------------------------------------------------------------
>
>                 Key: ARROW-14982
>                 URL: https://issues.apache.org/jira/browse/ARROW-14982
>             Project: Apache Arrow
>          Issue Type: New Feature
>          Components: C++, Python
>            Reporter: Niranda Perera
>            Priority: Major
>
> Hi, I would like to request a util to deep copy an Array with the following 
> semantic. 
>  
> {code:java}
> Result<shared_ptr<ArrayData>> DeepCopyArrayData(const ArrayData& arr, int64 
> offset = 0, int64 length = -1/*, pool=...*/);
> {code}
>  
> This was discussed some time back in Zulip [1]. 
>  
> [1] 
> [https://ursalabs.zulipchat.com/#narrow/stream/180245-dev/topic/create.20a.20deep.20copy.20of.20buffers]



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to