Skip to content

fix(array): make SetNull idempotent and track null count#905

Open
fallintoplace wants to merge 1 commit into
apache:mainfrom
fallintoplace:pr/fix-builder-setnull-null-count
Open

fix(array): make SetNull idempotent and track null count#905
fallintoplace wants to merge 1 commit into
apache:mainfrom
fallintoplace:pr/fix-builder-setnull-null-count

Conversation

@fallintoplace

@fallintoplace fallintoplace commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

Summary

Fix builder.SetNull null-count accounting and idempotency.

Why this fix

SetNull cleared the validity bit but did not update b.nulls, so bitmap and NullN() metadata could diverge. Repeated SetNull(i) also inflated null count.

Changes

  • Increment NullN only when the targeted entry is currently valid.
  • Keep behavior idempotent for already-null entries.
  • Validate in tests that MapBuilder delegates the same semantics.

Files

  • arrow/array/builder.go
  • arrow/array/builder_test.go
  • arrow/array/map_test.go

Validation

  • Added assertions for:
    • NullN() after setting initial nulls
    • idempotent SetNull(0) does not change count
    • MapBuilder.NullN() reflects null transitions.

Bug details

  • Severity: 86/100
  • Ask product?: 0/100

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.

1 participant