You are viewing a single comment's thread. Return to all comments →
def mapper(record): a, b, c = record.strip().split(",") if c.isdigit(): # employee return [(c, (a, b))] else: # department return [(b, (a, c))] def reducer(key, list_of_values): return [ (key, p[1], p[0]) for p in itertools.product(*combiner(sorted(list_of_values))) if (len(p) >= 2) ] def combiner(l): for _, it in itertools.groupby(l, operator.itemgetter(0)): yield list(map(operator.itemgetter(1), it))
Seems like cookies are disabled on this browser, please enable them to open this website
Map Reduce Advanced - Relational Join
You are viewing a single comment's thread. Return to all comments →