in src/arraytypes/unions.jl [245:286]
function arrowvector(::UnionKind, x, i, nl, fi, de, ded, meta; kw...)
UT = eltype(x)
if unionmode(UT) == Meta.UnionMode.Dense
x = x isa DenseUnionVector ? x.itr : x
typeids, offsets, data = todense(UT, x)
data2 = map(
y -> arrowvector(y[2], i, nl + 1, y[1], de, ded, nothing; kw...),
enumerate(data),
)
UT2 = uniontypewith(UT, Tuple{(eltype(x) for x in data2)...})
return DenseUnion{Union{(eltype(x) for x in data2)...},UT2,typeof(data2)}(
UInt8[],
UInt8[],
typeids,
offsets,
data2,
meta,
)
else
x = x isa SparseUnionVector ? x.itr : x
typeids = sparsetypeids(UT, x)
data3 = Tuple(
arrowvector(
ToSparseUnion(fieldtype(eltype(UT), j), x),
i,
nl + 1,
j,
de,
ded,
nothing;
kw...,
) for j = 1:fieldcount(eltype(UT))
)
UT2 = uniontypewith(UT, Tuple{(eltype(x) for x in data3)...})
return SparseUnion{Union{(eltype(x) for x in data3)...},UT2,typeof(data3)}(
UInt8[],
typeids,
data3,
meta,
)
end
end