You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "fallintoplace (via GitHub)" <gi...@apache.org> on 2026/07/11 07:33:50 UTC

[PR] fix(array): honor struct offsets in constructors and validity masks [arrow-go]

fallintoplace opened a new pull request, #922:
URL: https://github.com/apache/arrow-go/pull/922

   Struct convenience construction could retain the full child length after applying a non-zero offset, causing child slicing to run past the end. Parent validity masking also addressed logical row positions instead of the child bitmap's physical offset.
   
   This change validates struct offsets, uses length-offset for the constructed array, applies the existing null-bitmap validation to the names-based constructor, and masks child validity at physical bitmap positions. It also sizes replacement bitmaps for leading child offsets.
   
   Tests:
   - go test ./arrow/array -run 'Test(NewStructArrayWithNullsValidatesOffset|StructStringMasksParentValidityAtPhysicalOffset|StructArrayStringerMasksRequiredChildWithoutNullBitmap)'
   - go test ./arrow/array


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fix(array): honor struct offsets in constructors and validity masks [arrow-go]

Posted by "zeroshade (via GitHub)" <gi...@apache.org>.
zeroshade commented on code in PR #922:
URL: https://github.com/apache/arrow-go/pull/922#discussion_r3572941635


##########
arrow/array/struct.go:
##########
@@ -169,17 +188,19 @@ func (a *Struct) String() string {
 func (a *Struct) newStructFieldWithParentValidityMask(fieldIndex int) arrow.Array {

Review Comment:
   This masking fix is correct, but the caller in `String()` still guards it behind `!bytes.Equal(structBitmap, v.NullBitmapBytes())` (around L171). When a sliced child's bitmap **bytes** happen to equal the parent's but their physical **offsets** differ, masking is skipped and `Struct.String()` can print a value where the parent struct is null. Please fold offset compatibility into that shortcut (e.g. also apply the mask when `a.Offset() != v.Data().Offset()`), and add a regression test where the bitmap bytes are identical but the offsets differ.



-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fix(array): honor struct offsets in constructors and validity masks [arrow-go]

Posted by "zeroshade (via GitHub)" <gi...@apache.org>.
zeroshade commented on code in PR #922:
URL: https://github.com/apache/arrow-go/pull/922#discussion_r3566723457


##########
arrow/array/struct.go:
##########
@@ -61,6 +61,9 @@ func NewStructArrayWithFieldsAndNulls(cols []arrow.Array, fields []arrow.Field,
 	}
 
 	length := cols[0].Len()
+	if err := validateStructArrayOffset(offset, length); err != nil {

Review Comment:
   The existing offset-validation test only exercises `NewStructArrayWithNulls`; since this fix also guards `NewStructArrayWithFieldsAndNulls`, please add a mirrored invalid-offset case for it.



-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fix(array): honor struct offsets in constructors and validity masks [arrow-go]

Posted by "zeroshade (via GitHub)" <gi...@apache.org>.
zeroshade merged PR #922:
URL: https://github.com/apache/arrow-go/pull/922


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org