COGROUP
Monday, March 07, 2011
2:35 PM
COGROUP
Input: two bags with a pair of comparable columns. 
Output: One bag in which the two bags are grouped together by the column. 
Sort of "half of a join". 
Example of COGROUP
if s1 has schema {name:chararray, hits:int} and data
(John,3)
(Harry,4)
(George,2)
and s2 has schema {name:chararray, errors:int} and data
(John,2)
(John,3)
(George,0)
(Sue,1)
Then 
foo = COGROUP s1 BY name, s2 BY name; 
has schema {group:chararray, s1:{(name:chararray, hits:int)}, s2:{(name: chararray, errors:int)}} and returns
(John,{(John, 3)},{(John,2),(John,3)})
(Harry,{(Harry,4)},{})
(George,{(George,2)},{(George,0)})
(Sue, {},{(Sue,1)})