• + 0 comments
    def mapper(record):
        # use SSN=Employee_ID as the joining key
        t,k,v = record.strip().split(',')
        if t[0]=='E' : k,v = v,k
        mapReducer.emitIntermediate( k, (t[0],v) )
    
    def reducer(key, values):
        # a person can have multiple nicknames
        for p in [ v for t,v in values if t=='E' ] :
            for d in [ v for t,v in values if t=='D' ] :
                mapReducer.emit( (key,p,d) )