Background
There has been much handwringing about how Spark's Dataset API doesn't actually provide fully type safe joins, but I'm stubborn so I really wanted to try get as close as I possibly could (without using some external library).
I was able to do that with inner joins. But, I sometimes want to do a left (or right) outer join, but can't figure out how to get the type signature correct.
Question
Specifically,
How is it possible to use the
Dataset.joinWith(rightDS, condition, "left")if this function doesn't return Options on either side regardless of the (left) outer join type?
It seems either it would need to return an Option on the "outer" side (right side if doing a left join) or not return unjoinable rows at all (i.e. would become an inner join instead of a true outer join). Somehow, I need to let the "outer" fields be null when I map them into my consolidated table, but if I pattern match the "outer" row as an Option, it blocks me.