Good idea checking the C++ version. The docs for binary layout also mention
The offsets buffer contains length + 1 signed integers
...
and the last slot is the length of the values array
which would mean there has to be a single zero in the offsets buffer for an empty ListArray.
If this is a requirements it would be better to validate it when creating ArrayData. The code in ArrayData::validate_each_offset explicitly allow this case though:
// An empty binary-like array can have 0 offsets
if self.len == 0 && offset_buffer.is_empty() {
return Ok(());
}
I'm more hesitant to change this now, maybe let's wait for some more eyes on this.
Originally posted by @jhorstmann in #1602 (comment)
Good idea checking the C++ version. The docs for binary layout also mention
which would mean there has to be a single zero in the offsets buffer for an empty
ListArray.If this is a requirements it would be better to validate it when creating
ArrayData. The code inArrayData::validate_each_offsetexplicitly allow this case though:I'm more hesitant to change this now, maybe let's wait for some more eyes on this.
Originally posted by @jhorstmann in #1602 (comment)