Describe the bug
arrow-rs normally has a 1:1 relationship between data types and array types, in order to allow downcasting from &dyn Array or ArrayRef. But VariantArray breaks that convention by declaring it is a StructType.
To Reproduce
A match of the form:
match array.data_type() {
...
StructType(_) => array.as_struct().do_something(), // panics!
...
}
Expected behavior
Somehow we need a safe way to distinguish a VariantArray from a normal StructArray. Not just to protect hapless uses, but also to make our own code safe (cast_to_variant would both panic if passed a VariantArray today).
Additional context
Discovered during pathfinding work for variant shredding and a potential extension type for variant.