Test and fix for loss of final rows by SortMergeJoinOperation...

Unit test and fix for SortMergeJoinOperation issue, causing potential loss of final rows in outer joins.