written 5.6 years ago by |
Relational Algebra Operations:
Selection.
Projection.
Union & Intersection.
Natural Join.
Grouping & Aggregation.
Selection:
Apply a condition c to each taple in the relation and produce as output only those tuples that satisfy c.
The result of this selection is denoted by $6_c (R)$
Selection really do not need the full power of MapReduce.
They can be done most conveniently in the map portion alone, although they could also be done in the reduce portion also.
The pseudo code is as follows :
Map (key, valve)
for tuple in valve :
if tuple satisfies C :
emit (tuple, tuple)
Reduce (key, valves)
emit (key, key)
projection:
for some subset s of the attribute of the relation, produce from each tuple only the components for the attributes in S.
The result of this projection is denoted TTs (R)
Projection is performed similarly to selection.
As projection may cause the same tuple to appear several times, the reduce function eliminate duplicates.
The pseudo code for projection is as follows :
Map (key, valve)
for tuple in valve :
ts = tuple with only the components for the attributes in S.
emit (ts, ts)
Reduce (key, values)
emit (key, key)