nevi-me commented on pull request #9211:
URL: https://github.com/apache/arrow/pull/9211#issuecomment-768789842


   @jorgecarleitao in order to propagate the offsets to child data and buffers, 
we could do the below instead of `let mut new_data = self.clone();` inside of 
`ArrayData::slice()` in data.rs
   
   ```rust
   ArrayData::new(
       self.data_type.clone(),
       length,
       None,
       self.null_buffer().map(|buf| {
           buf.slice(offset)
       }),
       new_offset,
       self.buffers.iter().map(|buf| {
           buf.slice(offset)
       }).collect(),
       self.child_data.iter().map(|data| {
           Arc::new(data.slice(offset, length))
       }).collect()
   )
   ```
   
   I'm still running benchmarks to see the performance hit, but for 
bench::array_slice, I only see a 3% penalty.
   
   I tried this change directly on master, so not on top of this PR. I'm also 
getting failures from memory not being aligned, but I haven't looked at that 
yet.
   
   


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

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


Reply via email to