0
14kviews
List Relational-Algebra Operations. Explain any two using MapReduce.
1 Answer
3
1.1kviews

Relational Algebra Operations:

  1. Selection.

  2. Projection.

  3. Union & Intersection.

  4. Natural Join.

  5. 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)

Please log in to add an answer.