I have a Merge Join Transform that is doing a Left Outer Join. Can anyone show me the pseudo code for this transform? I think I understand the output, but I'm curious to know the logic that is us开发者_Python百科ed to produce it.
Thank you!
The merge join works follows by traversing all the records in two sorted lists. The merge matches the records where it can, but always returns the records from the left list, even without a corresponding record in the right list. As the records are sorted in both lists, the process knows that it can discard the possibility of any matches further down the list;
Get first record from leftList
Get first record from rightList
While not at the end of either list
begin
if leftList key matches right list key
begin
return (leftList and rightList row)
move to next rightList row
end
else if no previous match found on leftList
begin
return (leftList)
move to next leftList row
end
else
move to next leftList row
end
精彩评论