-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Description
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 a UnionArray 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 type
It 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
enum DataType {
..
Union(Vec<Field>),
..
}To something like
enum UnionMode {
Sparse,
Dense
}
enum DataType {
..
Union(UnionMode, Vec<Field>),
..
}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#L1028
Describe alternatives you've considered
Can keep the sparse/dense
Additional context
Add any other context or screenshots about the feature request here.