Repository navigation
[57_maintenance] fix(arrow-array): preserve type params in PrimitiveArray::into_builder - #11807
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.
…taType (apache#9473) This enables setting a timezone or precision & scale on parameterized DataType values. Note: I think the panic is unfortunate, and a try_with_data_type() would be sensible. # Which issue does this PR close? - Closes apache#8042. # Are these changes tested? Yes # Are there any user-facing changes? - Adds `PrimitiveRunBuilder::with_data_type`.
…er` (apache#11321) - Follow-on to apache#11310 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` * 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 Yes; existing tests pass, new test added. No, aside from the bug fix. Developed with Claude Code (Fable 5.1).
4 of 5 tasks
Jefffrey
marked this pull request as ready for review
October 22, 2026 12:23
alamb
approved these changes
Oct 22, 2026
| /// # Panics | ||
| /// | ||
| /// This method panics if `values_builder` rejects `data_type`. | ||
| pub fn with_data_type(mut self, data_type: arrow_schema::DataType) -> Self { |
…310_11321_57 # Conflicts: # arrow-array/src/builder/primitive_run_builder.rs
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#1132157.3.2(October 2026) #11666Cherry-pick of 2f3cd82 and 38054b7
These are combined into a single PR since the fixes work on the same function
NOTE
We also backport #9473 183f8c1 since we needed it for a test, and I think fix makes more sense with this in mind. It was introduced in 58 so only 57 needs this extra backport