mbutrovich opened a new issue, #11588:
URL: https://github.com/apache/arrow-rs/issues/11588
### Describe the bug
Extending from `FixedSizeList` `ArrayData` that has a nonzero offset copies
the child values from the start of the child rather than from the offset.
### To Reproduce
```rust
use std::sync::Arc;
use arrow_array::{make_array, Array, ArrayRef, FixedSizeListArray,
Int32Array};
use arrow_data::transform::MutableArrayData;
use arrow_schema::{DataType, Field};
fn main() {
// Rows [[0, 1], [2, 3], [4, 5]], with offset 1 and length 2 on the
parent
let child: ArrayRef = Arc::new(Int32Array::from(vec![0, 1, 2, 3, 4, 5]));
let list = FixedSizeListArray::new(Arc::new(Field::new("item",
DataType::Int32, true)), 2, child, None);
let data =
list.to_data().into_builder().offset(1).len(2).build().unwrap();
let mut m = MutableArrayData::new(vec![&data], false, 2);
m.try_extend(0, 0, 2).unwrap();
let out = make_array(m.freeze());
let out = out.as_any().downcast_ref::<FixedSizeListArray>().unwrap();
println!("{:?}", out.values()); // [0, 1, 2, 3], expected [2, 3, 4, 5]
}
```
### Expected behavior
The result holds the rows at offset 1, `[[2, 3], [4, 5]]`, as
`make_array(data)` does.
### Additional context
`build_extend` extends the child from `start * size` and does not add
`array.offset()`
([fixed_size_list.rs](https://github.com/apache/arrow-rs/blob/72887ed91c80002bb7ec755ce1e964bab07bebea/arrow-data/src/transform/fixed_size_list.rs#L23-L36)).
#10933 fixed the same issue for structs in `transform/structure.rs`.
`Array::slice` never produces this layout, because `FixedSizeListArray`
slices its child. It arrives from FFI producers, which may set the offset on
the parent and leave the child whole
([CDataInterface.rst](https://github.com/apache/arrow/blob/6b4c5248127881c506d4e21e6c95a5c4ced5d0d4/docs/source/format/CDataInterface.rst?plain=1#L456-L459)),
and from code that builds `ArrayData` with an offset.
Found with property-based tests that build arrays in every physical layout
the Arrow format allows.
--
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]