Joins
Sort-Merge Join
// Setup
join(R, S):
R_sorted = sort(R, R_join_columns(R, S))
S_sorted = sort(S, S_join_columns(R, S))
R_sorted.open()
S_sorted.open()
R_row = R_sorted.next()
S_row = S_sorted.next()
- R, S: Input, as iterators
- R_sorted, S_sorted: Sorted input, also iterators.
- R_row, S_row: Current rows of R_sorted and
S_sorted.
|