Jörn Horstmann created ARROW-7559:

             Summary: Possibly incorrect index check assertion in StringArray 
and BinaryArray
                 Key: ARROW-7559
                 URL: https://issues.apache.org/jira/browse/ARROW-7559
             Project: Apache Arrow
          Issue Type: Bug
          Components: Rust
    Affects Versions: 0.16.0
            Reporter: Jörn Horstmann

The following code tries to build a list array based on an underlying string 
array and panics on master (commit acfcdee75acb4b1814f2e727c150a7403d618e8f)
fn nested_string_array() {
    let strarray = StringArray::from(vec!["foo", "bar", "foobar"]);

    let nestedData = 
        .add_buffer(Buffer::from(&[0, 2, 3].to_byte_slice()))
    let nestedArray = ListArray::from(nestedData);

My guess is that the index check in StringArray.value is incorrect, instead of 

    pub fn value(&self, i: usize) -> &str {
            i + self.offset() < self.data.len(),
            "StringArray out of bounds access"
it should probably compare {{i}} without adding the offset. The same check is 
also done in {{BinaryArray}}. Changing this results in the expected output of
[arrow/src/array/array.rs:2460] nestedArray = ListArray

This message was sent by Atlassian Jira

Reply via email to