Left JoinAcross when right set is empty

Posted 6 months ago
525 Views
|
|
1 Total Likes
|
 I have a question about JoinAcross. In this case the left association is returned unchanged: JoinAcross[{<|a -> 1, b -> X|>}, {<|a -> 2|>}, Key[a], "Left"] (* {<|a -> 1, b -> X|>} *) The result is expected. Notice that the "Left" is documented as allowing the first set (left) for which there is no matching right-side set. I was surprised to find that the following code return an empty list: JoinAcross[{<|a -> 1, b -> X|>}, {}, Key[a], "Left"] (* { } *) Is this the expected behavior? I now need to change my code so that if the right-side set is empty, then I need to insert a dummy association to prevent JoinAcross from deleting the whole thing.
 In the SQL world, "keys" must. be in both sets. So, I am surprised by that left joining to an empty set did not give you an error.For example, if you try: JoinAcross[{<|a -> 1, b -> X|>}, {<|b -> 10, c -> 3|>}, Key[a], "Left"] you get: {<|a -> 1, b -> X, c -> Missing["Unmatched"]|>} which is what I would expect.