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

   ### Rationale for this change
   
   In `arrow/array`, `InsertDictValues` and `NewDictionaryBuilderWithDict` do 
not check whether an initial dictionary array contains null slots. Numeric, 
decimal, and fixed-size builders insert raw zero or uninitialized bytes from 
null slots, and binary builders insert empty values, causing subsequent appends 
of zero or empty strings to collide with null dictionary entries. Arrow C++ 
rejects initial dictionaries containing nulls with an invalid error because 
dictionary builders encode nulls in the index validity bitmap rather than 
dictionary entries.
   
   ### What changes are included in this PR?
   
   - Return a wrapped `arrow.ErrInvalid` error before mutating the memo table 
whenever `InsertDictValues` or `NewDictionaryBuilderWithDict` receives an array 
containing nulls.
   - Release newly allocated builders before panicking on initialization errors 
in `NewDictionaryBuilderWithDict` so recovered panics do not leak allocator 
memory.
   - Update the binary-view and string-view initial null-slot tests from #1596 
to expect the panic instead of inserting an empty value.
   
   ### Are these changes tested?
   
   Yes. I added checked-allocator tests covering null rejection, memo-table 
atomicity on empty and populated builders, sliced arrays with nulls inside and 
outside the slice, and leak-free panics across numeric, binary, view, 
fixed-size, decimal, interval, and null dictionary builders.
   
   ### Are there any user-facing changes?
   
   The dictionary insertion methods now return `arrow.ErrInvalid` when passed 
an array containing nulls, and `NewDictionaryBuilderWithDict` panics with that 
error without leaking memory.
   


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to