Repository navigation
[59_maintenance] fix(arrow-array): preserve type params in PrimitiveArray::into_builder - #11448
Merged
Merged
Conversation
…apache#11310) # Which issue does this PR close? - N/A # Rationale for this change If `PrimitiveArray::into_builder` fails to convert the array into the builder, we are supposed to return the input array unchanged. The previous implementation rebuilt the array with `T::DATA_TYPE`, which doesn't preserve type parameters (like the scale/precision of a decimal, or the timezone of a timestamp). # What changes are included in this PR? * Fix bug * Add unit test # Are these changes tested? Yes; existing tests pass, new test added. # Are there any user-facing changes? No.
…er` (apache#11321) # Which issue does this PR close? - Follow-on to apache#11310 # Rationale for this change apache#11310 made the `Err` path of `PrimitiveArray::into_builder` return the array with its original data type. Looking closer, the `Ok` path still built the builder with `PrimitiveBuilder::new_from_buffer`, which uses `T::DATA_TYPE`, so `into_builder()?.finish()` lost type parameters. These public APIs use `PrimitiveArray::into_builder` and will now behave correctly: - `PrimitiveArray::unary_mut` and `try_unary_mut` - `binary_mut` and `try_binary_mut` in arrow-arith - `DictionaryArray::unary_mut` and `into_primitive_dict_builder` - `PrimitiveRunBuilder::finish_cloned` # What changes are included in this PR? * Ensure success path of `PrimitiveArray::into_builder` also preserves type parameters * Update unit tests * Add new unit tests for some of the public APIs above, where the behavior is non-trivial # Are these changes tested? Yes; existing tests pass, new test added. # Are there any user-facing changes? No, aside from the bug fix. # AI usage Developed with Claude Code (Fable 5.1).
5 tasks done
mbutrovich
approved these changes
Oct 8, 2026
mbutrovich
left a comment
Contributor
There was a problem hiding this comment.
Seems like a clean cherry-pick. LGTM FWIW, thanks @Jefffrey!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PrimitiveArray::into_builder#11310 and fix(arrow-array): preserve type params inPrimitiveArray::into_builder#1132159.3.1(October 2026) #11352Cherry-pick of 2f3cd82 and 38054b7
These are combined into a single PR since the fixes work on the same function