JerAguilon opened a new issue, #36312:
URL: https://github.com/apache/arrow/issues/36312

   ### Describe the usage question you have. Please include as many useful 
details as  possible.
   
   
   
   Array::Slice is documented as a zero-copy view 
([reference](https://arrow.apache.org/docs/cpp/api/array.html#_CPPv4NK5arrow9ArrayData5SliceE7int64_t7int64_t))
   
   But if we peek at the implementation, there indeed appears to be a copy: 
https://github.com/apache/arrow/blob/bd8fd0cb1b2f61fa80891eb68fce23a062f48e11/cpp/src/arrow/array/data.cc#L137C22-L137C22
   
   Can I interpret zero-copy as "no dynamic allocations?" Or perhaps I am 
misunderstanding the docs?
   
   ______
   
   Context:
   
   I am interested because I have a use case wherein a function receives a 
bunch of tiny record batches that were `Split` from a bunch of upstream parquet 
files. The overhead of splitting ended up being surprisingly large!  Imagine 
~300K batches of 300+ columns with just a few rows. We ended up working around 
this by calling `CombineChunks` to create larger batches, but this was 
surprising. 
   
   A sloppy repro looks like this: 
https://gist.github.com/JerAguilon/1517c0ea623efee467ebeaed93e1a3c0
   
   If I profile the above code, I do see that `Array::Slice` is eating a lot of 
the overhead:
   
   ![Screenshot 2023-06-26 at 5 51 36 
PM](https://github.com/apache/arrow/assets/13546966/8858df9c-5cb2-4ad1-a28a-44f67a83c006)
   
   
   ### Component(s)
   
   C++, Integration


-- 
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