0
2.2kviews
Give Map Reduce algorithms for Naturals join of two relations.
1 Answer
0
152views
  • Merge two tables based on some common column. It represents the INNER JOIN in SQL. But the condition is implicit on the column that is common in both tables.
  • The output will only contain rows for which the values in the common column matches. It will generate one row for every time the column value across two tables match as is the case below for Tom .
  • If there were multiple Tom values in the table on the top in the image below, then four rows would have been created in the output table representing all the combinations.

enter image description here

enter image description here - For natural join operation map phase every row in relation say R can be represented as (a,b) similarly every row in relation says S can be represented as (b,c).
- This tuples will generate a key value pair.
(b,(R,a)) -> for relation R
(b,(S,c)) -> for relation S
as intermediate result of map phase. - In reduce phase, system will focus on key b which has associated values
b -> (R,a)) -> for relation R
b -> (S,c)) -> for relation S
- Then by mapping first entity of relation R and first entity in relation S.
- Generate the key value pair (b,(a,b,c)) where the key part 'b' doesn't have any significance.

Please log in to add an answer.