You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2021/07/11 10:29:35 UTC

[GitHub] [arrow-rs] nevi-me commented on a change in pull request #389: make slice work for nested types

nevi-me commented on a change in pull request #389:
URL: https://github.com/apache/arrow-rs/pull/389#discussion_r667459042



##########
File path: arrow/src/array/array_struct.rs
##########
@@ -85,12 +85,7 @@ impl From<ArrayData> for StructArray {
     fn from(data: ArrayData) -> Self {
         let mut boxed_fields = vec![];
         for cd in data.child_data() {
-            let child_data = if data.offset() != 0 || data.len() != cd.len() {

Review comment:
       @jhorstmann @jorgecarleitao the problem was here. We take `data` which has children and their own offsets, then slice that data correctly to populate `boxed_fields`, but then we still use the `data` with the child arrays that aren't offset.
   
   The result's that the struct is correct when looking at it through `boxed_fields` (e.g. the print utility uses this), but once you need to do anything with `data`, it's as if the child values were never sliced.
   
   The lightbulb turned on while i was trying to figure out why a test for #491 was failing.
   
   There's a change that @bjchambers authored (https://github.com/apache/arrow-rs/commit/9f965612626cdf31187ce07ba5dbecc3503077b8) which addressed the child offsets, but my tests were failing because I needed to revert what they did.




-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org