Skip to content

Conversation

@zeroshade
Copy link
Member

Rationale for this change

apache/iceberg-go#398 discovered that the current NewStructArrayWithFields fails if any child is marked as non-nullable but has nulls (as would be the case in an optional struct array full of nulls with a required field). So we need to allow constructing such an array.

What changes are included in this PR?

A new function is created, NewStructArrayWithFieldsAndNulls which takes in the top level struct null bitmap, the number of nulls, offset columns and list of fields.

Are these changes tested?

Yes, a unit test was created for it.

Are there any user-facing changes?

The above case that would error, now will no longer error.

@zeroshade zeroshade requested review from ianmcook, kou and lidavidm April 21, 2025 20:40
Copy link
Member

@lidavidm lidavidm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like Arrow should either sit down and specify the semantics of a nullable field, or else it should explicitly declare that validation is up to the application

@zeroshade zeroshade merged commit 9efe04b into apache:main Apr 25, 2025
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants