Add Dense/Sparse annotation to DataType::Union #814
Labels
api-change
Changes to the arrow API
arrow
Changes to the arrow crate
enhancement
Any new improvement worthy of a entry in the changelog
Is your feature request related to a problem or challenge? Please describe what you are trying to do.
While working on validation for ArrayData (#810), I was trying to validate that the number of
Buffers
passed to aUnionArray
were accurate.However, since number of Buffers for a
UnionArray
differs based on if it has a "sparse" or "dense" layout (1 or 2, respectively), the sparseness for the UnionArray is not encoded in the typeDataType::UnionArray
; This means we can't easily validate that the UnionArray has the correct number of buffers for its typeIt also means that the UnionArray can not be used without first checking to see how many buffers it has (what type it is)
Describe the solution you'd like
I propose changing
To something like
which is both consistent with the C++ implementation as well as allows
UnionArray
to be statically typechecked: https://github.com/apache/arrow/blob/661c7d749150905a63dd3b52e0a04dac39030d95/cpp/src/arrow/type.h#L1028Describe alternatives you've considered
Can keep the sparse/dense
Additional context
Add any other context or screenshots about the feature request here.
The text was updated successfully, but these errors were encountered: