jorgecarleitao edited a comment on pull request #389:
URL: https://github.com/apache/arrow-rs/pull/389#issuecomment-855365462


   Isn't it possible to not offset the child data, and instead only offset the 
`offsets`, or do we have some logic around that assumes that offsets always 
start from 0?
   
   In arrow2, I am doing 
   
   ```rust
   impl<O: Offset> ListArray<O> {
       pub fn slice(&self, offset: usize, length: usize) -> Self {
           let validity = self.validity.clone().map(|x| x.slice(offset, 
length));
           let offsets = self.offsets.clone().slice(offset, length + 1);
           Self {
               data_type: self.data_type.clone(),
               offsets,
               values: self.values.clone(),
               validity,
               offset: self.offset + offset,
           }
       }
   }
   ```
   
   note how the `offsets` are sliced and the values are cloned. The 
`ListArray<O>::offset` is only used for compatibility with the C data interface.
   


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