Skip to content

[C++] ArrayBuilders with mutable type are not robustly supported #22344

@asfimport

Description

@asfimport

(Dense|Sparse)UnionBuilder, DictionaryBuilder, Addaptive(U)IntBuilders and any nested builder which contains one of those may Finish to an array whose type disagrees with what was passed to MakeBuilder. This is not well documented or supported; ListBuilder checks if its child has changed type but StructBuilder does not. Furthermore ListBuilder's check does not catch modifications to a DictionaryBuidler's type and results in an invalid array on Finish: https://github.com/apache/arrow/blob/1bcfbe1/cpp/src/arrow/array-dict-test.cc#L951-L994

Let's add to the ArrayBuilder contract: the type property is null iff that builder's type is indeterminate until Finish() is called. Then all nested builders can check this on their children at construction and bubble type mutability correclty

Reporter: Ben Kietzman / @bkietz
Assignee: Ben Kietzman / @bkietz

PRs and other links:

Note: This issue was originally created as ARROW-5935. Please see the migration documentation for further details.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions