@Test public void testSim4() throws Exception { PhysicalPlan php = new PhysicalPlan(); PhysicalPlan ldGrpChain1 = GenPhyOp.loadedGrpChain(); PhysicalPlan ldGrpChain2 = GenPhyOp.loadedGrpChain(); php.merge(ldGrpChain1); php.merge(ldGrpChain2); POUnion un = GenPhyOp.topUnionOp(); php.addAsLeaf(un); PhysicalPlan ldFil1 = GenPhyOp.loadedFilter(); PhysicalPlan ldFil2 = GenPhyOp.loadedFilter(); php.merge(ldFil1); php.connect(ldFil1.getLeaves().get(0), un); php.merge(ldFil2); php.connect(ldFil2.getLeaves().get(0), un); POStore st = GenPhyOp.topStoreOp(); php.add(st); php.connect(un, st); run(php, "test/org/apache/pig/test/data/GoldenFiles/MRC4.gld"); }
@Test public void testSim8() throws Exception { PhysicalPlan php = new PhysicalPlan(); PhysicalPlan ldGrpChain1 = GenPhyOp.loadedGrpChain(); PhysicalPlan ldGrpChain2 = GenPhyOp.loadedGrpChain(); POLocalRearrange lr1 = GenPhyOp.topLocalRearrangeOp(); POLocalRearrange lr2 = GenPhyOp.topLocalRearrangeOp(); ldGrpChain1.addAsLeaf(lr1); ldGrpChain2.addAsLeaf(lr2); php.merge(ldGrpChain1); php.merge(ldGrpChain2); POGlobalRearrange gr = GenPhyOp.topGlobalRearrangeOp(); php.addAsLeaf(gr); PhysicalPlan ldFil1 = GenPhyOp.loadedFilter(); PhysicalPlan ldFil2 = GenPhyOp.loadedFilter(); php.merge(ldFil1); php.connect(ldFil1.getLeaves().get(0), gr); php.merge(ldFil2); php.connect(ldFil2.getLeaves().get(0), gr); POPackage pk = GenPhyOp.topPackageOp(); php.addAsLeaf(pk); POStore st = GenPhyOp.topStoreOp(); php.addAsLeaf(st); run(php, "test/org/apache/pig/test/data/GoldenFiles/MRC8.gld"); }
/** * Test that POSortedDistinct gets printed as POSortedDistinct * * @throws Exception */ @Test public void testSortedDistinctInForeach() throws Exception { PhysicalPlan php = new PhysicalPlan(); PhysicalPlan grpChain1 = GenPhyOp.loadedGrpChain(); php.merge(grpChain1); List<PhysicalPlan> inputs = new LinkedList<PhysicalPlan>(); PhysicalPlan inplan = new PhysicalPlan(); PODistinct op1 = new POSortedDistinct(new OperatorKey("", r.nextLong()), -1, null); inplan.addAsLeaf(op1); inputs.add(inplan); List<Boolean> toFlattens = new ArrayList<Boolean>(); toFlattens.add(false); POForEach pofe = new POForEach(new OperatorKey("", r.nextLong()), 1, inputs, toFlattens); php.addAsLeaf(pofe); POStore st = GenPhyOp.topStoreOp(); php.addAsLeaf(st); run(php, "test/org/apache/pig/test/data/GoldenFiles/MRC19.gld"); }