I see union uses column order for a DF. This to me is "fine" since they aren't typed.
However, for a dataset which is supposed to be strongly typed it is actually giving the wrong result. If you try to access the members by name, it will use the order. Heres is a reproducible case. 2.2.0
So its inconsistent and a bug IMO. And I'm not sure that the suggested work around is really fair, since I'm supposed to be getting of type `AB`. More importantly I think the issue is bigger when you consider that it happens even if you read from parquet (as you would expect). And that its inconsistent when going to/from rdd.
I imagine its just lazily converting to typed DS instead of initially. So either that typing could be prioritized to happen before the union or unioning of DF could be done with column order taken into account. Again, this is speculation..