0x26res commented on issue #40750: URL: https://github.com/apache/arrow/issues/40750#issuecomment-2018021152
> Looking at the C++ code it seems the offset of an offsets array is applied to the child arrays > > https://github.com/apache/arrow/blob/2b0427559d94fb25ce61672c1ed17fc245d0a546/cpp/src/arrow/array/array_nested.cc#L796-L798 > > But in the case of empty child arrays this fails with > > ``` > ArrowInvalid: List child array invalid: Invalid: Struct child array #0 has length smaller than expected for struct array (0 < 1) > /Users/alenkafrim/repos/arrow/cpp/src/arrow/array/validate.cc:267 ValidateListLike(type) > ``` > > and the source of the error can be found here: > > https://github.com/apache/arrow/blob/2b0427559d94fb25ce61672c1ed17fc245d0a546/cpp/src/arrow/array/validate.cc#L309-L313 > > I think a check for this corner case where data is empty but the offset array has an offset can be added in `MapArray::FromArraysInternal`. In this case the offset should not be applied to the child arrays. I might be confused, but shouldn't `field_data.length` be compared to the the offset of the last position (something like data.offsets[data.offset + data.length])? -- 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]
