@Test
public void testFRJoinOut8() throws IOException {
pigServer.registerQuery("A = LOAD '" + INPUT_FILE + "' as (x:int,y:int);");
pigServer.registerQuery("B = LOAD '" + INPUT_FILE2 + "' as (x:int,y:int);");
DataBag dbfrj = BagFactory.getInstance().newDefaultBag(), dbshj = BagFactory.getInstance().newDefaultBag();
Map<String,Tuple> hashFRJoin = new HashMap<String,Tuple>();
Map<String,Tuple> hashJoin = new HashMap<String,Tuple>();
{
pigServer.registerQuery("C = join A by $0 left, B by $0 using \"replicated\";");
pigServer.registerQuery("D = join A by $1 left, B by $1 using \"replicated\";");
pigServer.registerQuery("E = union C,D;");
Iterator<Tuple> iter = pigServer.openIterator("E");
while(iter.hasNext()) {
Tuple tuple = iter.next();
String Key = tuple.toDelimitedString(",");
hashFRJoin.put( Key, tuple);
dbfrj.add(tuple);
}
}
{
pigServer.registerQuery("C = join A by $0 left, B by $0;");
pigServer.registerQuery("D = join A by $1 left, B by $1;");
pigServer.registerQuery("E = union C,D;");
Iterator<Tuple> iter = pigServer.openIterator("E");
while(iter.hasNext()) {
Tuple tuple = iter.next();
String Key = tuple.toDelimitedString(",");
hashJoin.put( Key, tuple);
dbshj.add(tuple);
}
}
Assert.assertTrue(dbfrj.size()>0 && dbshj.size()>0);
Assert.assertEquals(true, TestHelper.compareBags(dbfrj, dbshj));
}