Summary
UnionScalar formatting should format the selected child through its typed Scalar view instead of formatting the raw ScalarValue stored inside UnionValue.
This was identified while reviewing #8838 and depends on the UnionScalar support introduced there.
Current behavior
The formatter reaches directly into UnionValue::value(). That loses the selected variant's dtype when the child is dtype-aware or nested:
- struct children display as their tuple storage and omit field names;
- extension children display their storage representation;
- nested union children display as
union@<type-id>(...) instead of using the selected variant name.
Expected behavior
Formatting a union should preserve the normal display semantics of the selected child scalar, for example:
rather than:
Proposed fix
Use UnionScalar::value() to reconstruct the selected child Scalar with its dtype, then format that scalar. Add a regression test with a struct-valued child (and optionally a nested union child).
Summary
UnionScalarformatting should format the selected child through its typedScalarview instead of formatting the rawScalarValuestored insideUnionValue.This was identified while reviewing #8838 and depends on the
UnionScalarsupport introduced there.Current behavior
The formatter reaches directly into
UnionValue::value(). That loses the selected variant's dtype when the child is dtype-aware or nested:union@<type-id>(...)instead of using the selected variant name.Expected behavior
Formatting a union should preserve the normal display semantics of the selected child scalar, for example:
rather than:
Proposed fix
Use
UnionScalar::value()to reconstruct the selected childScalarwith its dtype, then format that scalar. Add a regression test with a struct-valued child (and optionally a nested union child).