Comp150CPA: Clouds and Power-Aware Computing
Classroom Exercise 10
Advanced Pig
Spring 2011

group member 1: ____________________________ login: ______________

group member 2: ____________________________ login: ______________

group member 3: ____________________________ login: ______________

group member 4: ____________________________ login: ______________

group member 5: ____________________________ login: ______________

In class we've studied the advanced Pig operators including COGROUP and CROSS. Let's play with these in more detail.

  1. Suppose you have two relations:
    friends: {name:chararray} 
    employees: {name:chararray}
    Write a Pig script that computes the symmetric difference of these two relations, to get those people who are employees but not friends, or friends but not employees.
  2. Suppose you have a parameters relation params:{name:chararray, value:int} that contains the relation:
    and want to select people in the relation friends: {name:chararray, n:int} who have between atleast and atmost friends. Write the Pig script to pick these people from the list.

  3. Suppose your input data is a bag of pairs contest:{winner: chararray, loser:chararray}. Write a script that recovers the list of names that appear in the contest relation but never lost.

  4. (Advanced) Write a pig script that has as input a tuple of three bags of names, and outputs all names that occur in exactly one of the three bags.