Examples of PhysicalPlan


Examples of org.apache.pig.backend.hadoop.executionengine.physicalLayer.plans.PhysicalPlan

        php.addAsLeaf(st);
        run(php, "test/org/apache/pig/test/data/GoldenFiles/MRC8.gld");
    }

    public void testSim9() throws Exception {
        PhysicalPlan php = new PhysicalPlan();

        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();
View Full Code Here

Examples of org.apache.pig.backend.hadoop.executionengine.physicalLayer.plans.PhysicalPlan

        php.addAsLeaf(st);
        run(php, "test/org/apache/pig/test/data/GoldenFiles/MRC9.gld");
    }
   
    public void testSortUDF1() throws Exception {
        PhysicalPlan php = new PhysicalPlan();
        PhysicalPlan ldFil1 = GenPhyOp.loadedFilter();
        php.merge(ldFil1);
       
        // set up order by *
        String funcName = WeirdComparator.class.getName();
        POUserComparisonFunc comparator = new POUserComparisonFunc(
                new OperatorKey("", r.nextLong()), -1, null, new FuncSpec(funcName));
        POSort sort = new POSort(new OperatorKey("", r.nextLong()), -1, ldFil1.getLeaves(),
                null, new ArrayList<Boolean>(), comparator);
        sort.setRequestedParallelism(20);
        PhysicalPlan nesSortPlan = new PhysicalPlan();
        POProject topPrj = new POProject(new OperatorKey("", r.nextLong()));
        topPrj.setColumn(1);
        topPrj.setOverloaded(true);
        topPrj.setResultType(DataType.TUPLE);
        nesSortPlan.add(topPrj);
       
        POProject prjStar2 = new POProject(new OperatorKey("", r.nextLong()));
        prjStar2.setResultType(DataType.TUPLE);
        prjStar2.setStar(true);
        nesSortPlan.add(prjStar2);
       
        nesSortPlan.connect(topPrj, prjStar2);
        List<PhysicalPlan> nesSortPlanLst = new ArrayList<PhysicalPlan>();
        nesSortPlanLst.add(nesSortPlan);
       
        sort.setSortPlans(nesSortPlanLst);
       
        php.add(sort);
        php.connect(ldFil1.getLeaves().get(0), sort);
        // have a foreach which takes the sort output
        // and send it two two udfs
        List<String> udfs = new ArrayList<String>();
        udfs.add(COUNT.class.getName());
        udfs.add(SUM.class.getName());
        POForEach fe3 = GenPhyOp.topForEachOPWithUDF(udfs);
        php.add(fe3);
        php.connect(sort, fe3);
       
        // add a group above the foreach
        PhysicalPlan grpChain1 = GenPhyOp.grpChain();
        php.merge(grpChain1);
        php.connect(fe3,grpChain1.getRoots().get(0));
       
       
        udfs.clear();
        udfs.add(AVG.class.getName());
        POForEach fe4 = GenPhyOp.topForEachOPWithUDF(udfs);
        php.addAsLeaf(fe4);
       
        PhysicalPlan grpChain2 = GenPhyOp.grpChain();
        php.merge(grpChain2);
        php.connect(fe4,grpChain2.getRoots().get(0));

        udfs.clear();
        udfs.add(GFCross.class.getName());
        POForEach fe5 = GenPhyOp.topForEachOPWithUDF(udfs);
        php.addAsLeaf(fe5);
View Full Code Here

Examples of org.apache.pig.backend.hadoop.executionengine.physicalLayer.plans.PhysicalPlan

        php.addAsLeaf(st);
        run(php, "test/org/apache/pig/test/data/GoldenFiles/MRC15.gld");
    }
   
    public void testDistinct1() throws Exception {
        PhysicalPlan php = new PhysicalPlan();
        PhysicalPlan ldFil1 = GenPhyOp.loadedFilter();
        php.merge(ldFil1);
       
        PODistinct op = new PODistinct(new OperatorKey("", r.nextLong()),
                -1, null);
       
        php.addAsLeaf(op);
       
        PhysicalPlan grpChain1 = GenPhyOp.grpChain();
        php.merge(grpChain1);
        php.connect(op,grpChain1.getRoots().get(0));
       
        PODistinct op1 = new PODistinct(new OperatorKey("", r.nextLong()),
                -1, null);
       
        php.addAsLeaf(op1);
View Full Code Here

Examples of org.apache.pig.backend.hadoop.executionengine.physicalLayer.plans.PhysicalPlan

        run(php, "test/org/apache/pig/test/data/GoldenFiles/MRC16.gld");
    }
   
   
    public void testLimit() throws Exception {
        PhysicalPlan php = new PhysicalPlan();

        POLoad lC = GenPhyOp.topLoadOp();
        php.add(lC);

        POLimit op = new POLimit(new OperatorKey("", r.nextLong()),
                -1, null);

        php.add(op);
        php.connect(lC, op);

        POStore st = GenPhyOp.topStoreOp();
        php.addAsLeaf(st);
        run(php, "test/org/apache/pig/test/data/GoldenFiles/MRC17.gld");
    }
View Full Code Here

Examples of org.apache.pig.backend.hadoop.executionengine.physicalLayer.plans.PhysicalPlan

    @Test
    public void testMRCompilerErr() throws Exception {
      planTester.buildPlan("a = load 'input';");
      LogicalPlan lp = planTester.buildPlan("b = filter a by $0 > 5;");
     
      PhysicalPlan pp = Util.buildPhysicalPlan(lp, pc);
      pp.remove(pp.getRoots().get(0));
      try {
        Util.buildMRPlan(new PhysicalPlan(), pc);
        fail("Expected failure.");
      } catch (MRCompilerException mrce) {
        assertTrue(mrce.getErrorCode() == 2053);
      }
    }
View Full Code Here

Examples of org.apache.pig.backend.hadoop.executionengine.physicalLayer.plans.PhysicalPlan

      }
    }

    @Test
    public void testMRCompilerErr1() throws Exception {    
        PhysicalPlan pp = new PhysicalPlan();
        PhysicalPlan ldFil1 = GenPhyOp.loadedFilter();
        pp.merge(ldFil1);
       
        POSplit op = GenPhyOp.topSplitOp();
        pp.addAsLeaf(op);
View Full Code Here

Examples of org.apache.pig.backend.hadoop.executionengine.physicalLayer.plans.PhysicalPlan

      planTester.buildPlan("a = load 'input';");
      planTester.buildPlan("b = order a by $0;");
      planTester.buildPlan("c = limit b 10;");
      LogicalPlan lp = planTester.buildPlan("store c into '/tmp';");
     
      PhysicalPlan pp = Util.buildPhysicalPlan(lp, pc);
      MROperPlan mrPlan = Util.buildMRPlan(pp, pc);
      MapReduceOper mrOper = mrPlan.getRoots().get(0);
      int count = 1;
     
      while(mrPlan.getSuccessors(mrOper) != null) {
View Full Code Here

Examples of org.apache.pig.backend.hadoop.executionengine.physicalLayer.plans.PhysicalPlan

      planTesterMR.buildPlan("a = load 'input';");
      planTesterMR.buildPlan("b = order a by $0 parallel 2;");
      planTesterMR.buildPlan("c = limit b 10;");
      LogicalPlan lp = planTesterMR.buildPlan("store c into '/tmp';");
     
      PhysicalPlan pp = Util.buildPhysicalPlan(lp, pc);
      MROperPlan mrPlan = Util.buildMRPlan(pp, pc);
      MapReduceOper mrOper = mrPlan.getRoots().get(0);
      int count = 1;
     
      while(mrPlan.getSuccessors(mrOper) != null) {
View Full Code Here

Examples of org.apache.pig.backend.hadoop.executionengine.physicalLayer.plans.PhysicalPlan

        planTester.buildPlan("a = load 'input1' using BinStorage();");
        planTester.buildPlan("b = load 'input2';");
        planTester.buildPlan("c = join a by $0, b by $0;");
        LogicalPlan lp = planTester.buildPlan("store c into '/tmp';");
       
        PhysicalPlan pp = Util.buildPhysicalPlan(lp, pc);
        MROperPlan mrPlan = Util.buildMRPlan(pp, pc);
        MapReduceOper mrOper = mrPlan.getRoots().get(0);
       
        assertTrue(mrOper.UDFs.size()==2);
        assertTrue(mrOper.UDFs.size()==2);
View Full Code Here

Examples of org.apache.pig.backend.hadoop.executionengine.physicalLayer.plans.PhysicalPlan

        planTester.buildPlan("a = load '/tmp/input1';");
        planTester.buildPlan("b = load '/tmp/input2';");
        planTester.buildPlan("c = join a by $0, b by $0 using \"merge\";");
        LogicalPlan lp = planTester.buildPlan("store c into '/tmp';");
       
        PhysicalPlan pp = Util.buildPhysicalPlan(lp, pc);
        run(pp, "test/org/apache/pig/test/data/GoldenFiles/MRC18.gld");
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.