You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
BinaryBuilder accepted a DataType in its constructor but discarded it, so finishing through ArrayBuilder::Finish() always produced a plain binary array instead of preserving the supplied type, such as an extension type backed by binary storage.
What changes are included in this PR?
Store the supplied DataType in BaseBinaryBuilder.
Use the stored type for BinaryBuilder and LargeBinaryBuilder output.
Add a regression test covering BinaryBuilder with a binary-backed extension type.
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR fixes BinaryBuilder / LargeBinaryBuilder so that when they’re constructed with an explicit DataType (notably binary-backed extension types), the finished array preserves that type instead of always producing a plain (large) binary array.
Changes:
Store the provided DataType inside BaseBinaryBuilder and return it from type().
Remove BinaryBuilder / LargeBinaryBuilder’s hardcoded type() overrides so FinishInternal() uses the stored type.
Add a regression test ensuring a binary-backed ExtensionType is preserved through BinaryBuilder::Finish().
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
File
Description
cpp/src/arrow/array/builder_binary.h
Persist builder DataType in BaseBinaryBuilder and use it for finished array type.
cpp/src/arrow/array/array_binary_test.cc
Adds a regression test covering preservation of a binary-backed extension type.
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
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.
Rationale for this change
BinaryBuilder accepted a DataType in its constructor but discarded it, so finishing through ArrayBuilder::Finish() always produced a plain binary array instead of preserving the supplied type, such as an extension type backed by binary storage.
What changes are included in this PR?
Are these changes tested?
Yes.