I agree with Antoine but I get easily confused by "valid, as in
structurally correct" and "valid, as in not null" so I want to make sure I
understand:
> The child of a nested
> array should be valid itself, independently of the parent's validity
bitmap.
A child must be "structurally correct" (e.g. validate correctly) but it can
have null values.
For example, given:
* we have an array of type struct<{list<int32>}>
* the third element of the parent struct array is null
Then
* The third element in the list<int32> array could be null
* The third element in the list<int32> array could be valid (not-null)
* In all cases the offsets must exist for the third element in the list
array
> If it's a BinaryArray, when when it parent is not valid, would a validity
> member point to a undefined address?
>
> And if it's ListArray[3], when it parent is not valid, should it offset
and
> size be valid?
When a binary array or a list array element is null the cleanest thing to
do is to set the offsets to be the same. So, for example, given a list
array with 5 elements, if second item is null, the offsets could be 0, 8,
8, 12, 20, 50.
Question for Antoine: is it correct for the offsets of a null element to be
different? For the above example, could the offsets be 0, 8, 10, 12, 20,
50? I think the answer is "yes, this is correct". However, if this is the
case, then the list's values array must still have 50 items.
On Wed, Jun 28, 2023 at 8:18 AM Antoine Pitrou <[email protected]> wrote:
>
> Hi!
>
> Le 28/06/2023 à 17:03, wish maple a écrit :
> > Hi,
> >
> > By looking at the arrow standard, when it comes to nested structure, like
> > StructArray[1] or FixedListArray[2], when parent is not valid, the
> > correspond child leaves "undefined".
> >
> > If it's a BinaryArray, when when it parent is not valid, would a validity
> > member point to a undefined address?
> >
> > And if it's ListArray[3], when it parent is not valid, should it offset
> and
> > size be valid?
>
> Offsets and sizes should always need to be valid. The child of a nested
> array should be valid itself, independently of the parent's validity
> bitmap.
>
> You can also check this with ValidateFull(): it should catch such problems.
>
> Regards
>
> Antoine.
>