}
@Test
public void testCoGroupWithResultGroupFields() throws Exception
{
Tap sourceLower = new Hfs( new TextLine( new Fields( "offset", "line" ) ), "foo" );
Tap sourceUpper = new Hfs( new TextLine( new Fields( "offset", "line" ) ), "bar" );
Map sources = new HashMap();
sources.put( "lower", sourceLower );
sources.put( "upper", sourceUpper );
Function splitter = new RegexSplitter( new Fields( "num", "char" ), " " );
// using null pos so all fields are written
Tap sink = new Hfs( new TextLine(), "/complex/cogroup/", true );
Pipe pipeLower = new Each( new Pipe( "lower" ), new Fields( "line" ), splitter );
Pipe pipeUpper = new Each( new Pipe( "upper" ), new Fields( "line" ), splitter );
Pipe splice = new CoGroup( pipeLower, new Fields( "num" ), pipeUpper, new Fields( "num" ), new Fields( "num1", "lhs", "num2", "rhs" ), new Fields( "somenum", "somenum2" ) );