pigServer.registerQuery("C = cogroup A by ($1), B by ($1);");
pigServer.registerQuery("D = foreach C generate $1.$1, $2.$1;");
Iterator<Tuple> iter = pigServer.openIterator("D");
assertTrue(iter.hasNext());
Tuple t = iter.next();
assertTrue(t.size()==2);
assertTrue(t.get(0).toString().equals("{}"));
assertTrue(t.get(1).toString().equals("{(1)}"));
assertTrue(iter.hasNext());
t = iter.next();
assertTrue(t.size()==2);
assertTrue(t.get(0).toString().equals("{(2)}"));
assertTrue(t.get(1).toString().equals("{(2)}"));
assertTrue(iter.hasNext());
t = iter.next();
assertTrue(t.size()==2);
assertTrue(t.get(0).toString().equals("{(5)}"));
assertTrue(t.get(1).toString().equals("{}"));
assertFalse(iter.hasNext());
assertTrue(emptyLogFileMessage());
}