You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I don't know if this was a change or it has always been this way, but we permit zero-length ListArray to have no offsets. In #1620 we explicitly decided against enforcing a single value.
Unfortunately the logic for value_offsets, duplicated in ListArray, StringArray, BinaryArray, etc...
#[test]
fn test_string_array_empty_offsets() {
let data = ArrayDataBuilder::new(DataType::Utf8)
.len(0)
.add_buffer(Buffer::from([]))
.add_buffer(Buffer::from([]))
.build()
.unwrap();
let array = GenericStringArray::<i32>::from(data);
assert_eq!(array.value_offsets().len(), 0); // FAILS with 1 != 0
}
Expected behavior
Given the decision to support empty offsets, I think we should always return an empty slice for zero length array types, so that the behaviour is consistent.
Additional context
Discovered whilst working on #1811, so already getting returns from that investment 😁
The text was updated successfully, but these errors were encountered:
tustvold
changed the title
value_offsets Returns Invalid Slice For Empty Offsets Buffer
Invalid Value Offsets Slice For Empty Variable Length Arrays
Jun 9, 2022
tustvold
added a commit
to tustvold/arrow-rs
that referenced
this issue
Jun 9, 2022
Describe the bug
I don't know if this was a change or it has always been this way, but we permit zero-length ListArray to have no offsets. In #1620 we explicitly decided against enforcing a single value.
Unfortunately the logic for value_offsets, duplicated in ListArray, StringArray, BinaryArray, etc...
Does not take this into account
To Reproduce
Expected behavior
Given the decision to support empty offsets, I think we should always return an empty slice for zero length array types, so that the behaviour is consistent.
Additional context
Discovered whilst working on #1811, so already getting returns from that investment 😁
The text was updated successfully, but these errors were encountered: