Skip to content

Fix RecordBatch::normalize() null bitmap bug and add StructArray::flatten()#9733

Open
sqd wants to merge 1 commit intoapache:mainfrom
sqd:oss_normalize_bug
Open

Fix RecordBatch::normalize() null bitmap bug and add StructArray::flatten()#9733
sqd wants to merge 1 commit intoapache:mainfrom
sqd:oss_normalize_bug

Conversation

@sqd
Copy link
Copy Markdown

@sqd sqd commented Apr 15, 2026

Currently RecordBatch::normalize() has a bug in that the top level struct's null bitmap is not propagated into the resulting normalized arrays' null bitmap. In other words, a child element may suddenly appear non-null, losing the fact that the parent level struct is null at that index. See the test in this change for a bug reproduction.

This change fixes that behavior. Also adds StructArray::flatten() which mirrors arrow-cpp's semantics and handles the aforementioned behavior correctly. The fixed RecordBatch::normalize() now uses StructArray::flatten() under the hood.

Which issue does this PR close?

Are these changes tested?

Yes

Are there any user-facing changes?

No

…tten()

Currently RecordBatch::normalize() has a bug in that the top level
struct's null bitmap is not propagated into the resulting normalized
arrays' null bitmap. In other words, a child element may suddenly
appear non-null, losing the fact that the parent level struct is null at
that index. See the test in this change for a bug reproduction.

This change fixes that behavior. Also adds StructArray::flatten() which
mirrors arrow-cpp's semantics and handles the aforementioned behavior
correctly. The fixed RecordBatch::normalize() now uses
StructArray::flatten() under the hood.
@github-actions github-actions bot added the arrow Changes to the arrow crate label Apr 15, 2026
@sqd
Copy link
Copy Markdown
Author

sqd commented Apr 15, 2026

@alamb
Copy link
Copy Markdown
Contributor

alamb commented Apr 15, 2026

@negli-me, since you added the normalize function, could you help review this PR

It was added in

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

arrow Changes to the arrow crate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

RecordBatch::normalize() does not propagate top level null bitmap into the results

2 participants