Skip to content

fix(array): retain dictionary before replacement#926

Open
fallintoplace wants to merge 1 commit into
apache:mainfrom
fallintoplace:fix/data-set-dictionary-lifetime
Open

fix(array): retain dictionary before replacement#926
fallintoplace wants to merge 1 commit into
apache:mainfrom
fallintoplace:fix/data-set-dictionary-lifetime

Conversation

@fallintoplace

Copy link
Copy Markdown
Contributor

Data.SetDictionary released the existing dictionary before retaining the replacement. Replacing a dictionary with the same pointer while the parent held the final reference could therefore clear the dictionary before resurrecting its reference.

This retains the validated replacement first, swaps it into the Data object, then releases the previous dictionary. It also handles nil input and reports an explicit panic for an invalid dictionary data implementation.

Tests:

  • go test ./arrow/array -run 'TestData(SetDictionaryWithSamePointerRetainsDictionary|ResetClearsDictionary)'
  • go test ./arrow/array
  • go test ./arrow/... -run '^$'

@fallintoplace fallintoplace requested a review from zeroshade as a code owner July 11, 2026 07:47
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