Пример #1
0
 public POJoinPackage(OperatorKey k, int rp, POPackage p, POForEach f) {
   super(k, rp);
   String scope = getOperatorKey().getScope();
   NodeIdGenerator nig = NodeIdGenerator.getGenerator();
   forEach = new POOptimizedForEach(new OperatorKey(scope, nig.getNextNodeId(scope)));
   if (p != null) {
     setKeyType(p.getKeyType());
     setNumInps(p.getNumInps());
     lastBagIndex = numInputs - 1;
     setInner(p.getInner());
     setKeyInfo(p.getKeyInfo());
     this.isKeyTuple = p.isKeyTuple;
   }
   if (f != null) {
     setInputPlans(f.getInputPlans());
     setToBeFlattened(f.getToBeFlattened());
   }
 }
Пример #2
0
 /**
  * Make a deep copy of this operator.
  *
  * @throws CloneNotSupportedException
  */
 @Override
 public POPackage clone() throws CloneNotSupportedException {
   POPackage clone = (POPackage) super.clone();
   clone.mKey =
       new OperatorKey(mKey.scope, NodeIdGenerator.getGenerator().getNextNodeId(mKey.scope));
   clone.requestedParallelism = requestedParallelism;
   clone.resultType = resultType;
   clone.keyType = keyType;
   clone.numInputs = numInputs;
   if (inner != null) {
     clone.inner = new boolean[inner.length];
     for (int i = 0; i < inner.length; i++) {
       clone.inner[i] = inner[i];
     }
   } else clone.inner = null;
   return clone;
 }
Пример #3
0
  public void testSpl3() throws Exception {
    PhysicalPlan php = new PhysicalPlan();

    POLoad lA = GenPhyOp.topLoadOp();
    POSplit spl = GenPhyOp.topSplitOp();
    php.add(lA);
    php.add(spl);
    php.connect(lA, spl);

    POFilter fl1 = GenPhyOp.topFilterOp();
    fl1.setRequestedParallelism(10);
    POFilter fl2 = GenPhyOp.topFilterOp();
    fl2.setRequestedParallelism(20);
    php.add(fl1);
    php.add(fl2);
    php.connect(spl, fl1);
    php.connect(spl, fl2);

    POSplit sp11 = GenPhyOp.topSplitOp();
    POSplit sp21 = GenPhyOp.topSplitOp();
    php.add(sp11);
    php.add(sp21);
    php.connect(fl1, sp11);
    php.connect(fl2, sp21);

    POFilter fl11 = GenPhyOp.topFilterOp();
    fl11.setRequestedParallelism(10);
    POFilter fl21 = GenPhyOp.topFilterOp();
    fl21.setRequestedParallelism(20);
    POFilter fl22 = GenPhyOp.topFilterOp();
    fl22.setRequestedParallelism(30);
    php.add(fl11);
    php.add(fl21);
    php.add(fl22);
    php.connect(sp11, fl11);
    php.connect(sp21, fl21);
    php.connect(sp21, fl22);

    POLocalRearrange lr1 = GenPhyOp.topLocalRearrangeOp();
    lr1.setRequestedParallelism(40);
    POLocalRearrange lr21 = GenPhyOp.topLocalRearrangeOp();
    lr21.setRequestedParallelism(15);
    POLocalRearrange lr22 = GenPhyOp.topLocalRearrangeOp();
    lr22.setRequestedParallelism(35);
    php.add(lr1);
    php.add(lr21);
    php.add(lr22);
    php.connect(fl11, lr1);
    php.connect(fl21, lr21);
    php.connect(fl22, lr22);

    POGlobalRearrange gr = GenPhyOp.topGlobalRearrangeOp();
    php.addAsLeaf(gr);

    POPackage pk = GenPhyOp.topPackageOp();
    pk.setRequestedParallelism(25);
    php.addAsLeaf(pk);

    POSplit sp2 = GenPhyOp.topSplitOp();
    php.addAsLeaf(sp2);

    POFilter fl3 = GenPhyOp.topFilterOp();
    fl3.setRequestedParallelism(100);
    POFilter fl4 = GenPhyOp.topFilterOp();
    fl4.setRequestedParallelism(80);
    php.add(fl3);
    php.add(fl4);
    php.connect(sp2, fl3);
    php.connect(sp2, fl4);

    POUnion un = GenPhyOp.topUnionOp();
    php.addAsLeaf(un);

    POStore st = GenPhyOp.topStoreOp();
    php.addAsLeaf(st);
    run(php, "test/org/apache/pig/test/data/GoldenFiles/MRC14.gld");
  }
Пример #4
0
  @Test
  public void testRun1() throws Exception {
    PhysicalPlan php = new PhysicalPlan();

    PhysicalPlan part1 = new PhysicalPlan();
    POLoad lC = GenPhyOp.topLoadOp();
    POFilter fC = GenPhyOp.topFilterOp();
    fC.setRequestedParallelism(20);
    POLocalRearrange lrC = GenPhyOp.topLocalRearrangeOp();
    lrC.setRequestedParallelism(10);
    POGlobalRearrange grC = GenPhyOp.topGlobalRearrangeOp();
    POPackage pkC = GenPhyOp.topPackageOp();
    part1.add(lC);
    part1.add(fC);
    part1.connect(lC, fC);
    part1.add(lrC);
    part1.connect(fC, lrC);
    part1.add(grC);
    part1.connect(lrC, grC);
    part1.add(pkC);
    part1.connect(grC, pkC);

    POPackage pkD = GenPhyOp.topPackageOp();
    pkD.setRequestedParallelism(20);
    POLocalRearrange lrD = GenPhyOp.topLocalRearrangeOp();
    lrD.setRequestedParallelism(30);
    POGlobalRearrange grD = GenPhyOp.topGlobalRearrangeOp();
    POLoad lD = GenPhyOp.topLoadOp();
    part1.add(lD);
    part1.add(lrD);
    part1.connect(lD, lrD);

    part1.add(grD);
    part1.connect(lrD, grD);
    part1.add(pkD);
    part1.connect(grD, pkD);

    POPackage pkCD = GenPhyOp.topPackageOp();
    POLocalRearrange lrCD1 = GenPhyOp.topLocalRearrangeOp();
    POLocalRearrange lrCD2 = GenPhyOp.topLocalRearrangeOp();
    POGlobalRearrange grCD = GenPhyOp.topGlobalRearrangeOp();
    part1.add(lrCD1);
    part1.add(lrCD2);
    part1.connect(pkC, lrCD1);
    part1.connect(pkD, lrCD2);
    part1.add(grCD);
    part1.connect(lrCD1, grCD);
    part1.connect(lrCD2, grCD);
    part1.add(pkCD);
    part1.connect(grCD, pkCD);

    POLoad lA = GenPhyOp.topLoadOp();
    POLoad lB = GenPhyOp.topLoadOp();

    // POLoad lC = lA;
    POFilter fA = GenPhyOp.topFilterOp();

    POLocalRearrange lrA = GenPhyOp.topLocalRearrangeOp();
    POLocalRearrange lrB = GenPhyOp.topLocalRearrangeOp();

    POGlobalRearrange grAB = GenPhyOp.topGlobalRearrangeOp();

    POPackage pkAB = GenPhyOp.topPackageOp();

    POFilter fAB = GenPhyOp.topFilterOp();
    POUnion unABC = GenPhyOp.topUnionOp();

    php.add(lA);
    php.add(lB);

    php.add(fA);

    php.connect(lA, fA);

    php.add(lrA);
    php.add(lrB);

    php.connect(fA, lrA);
    php.connect(lB, lrB);

    php.add(grAB);
    php.connect(lrA, grAB);
    php.connect(lrB, grAB);

    php.add(pkAB);
    php.connect(grAB, pkAB);

    php.add(fAB);
    php.connect(pkAB, fAB);

    php.merge(part1);

    List<PhysicalOperator> leaves = new ArrayList<PhysicalOperator>();
    for (PhysicalOperator phyOp : php.getLeaves()) {
      leaves.add(phyOp);
    }

    php.add(unABC);
    for (PhysicalOperator physicalOperator : leaves) {
      php.connect(physicalOperator, unABC);
    }

    POStore st = GenPhyOp.topStoreOp();

    php.add(st);
    php.connect(unABC, st);
    run(php, "test/org/apache/pig/test/data/GoldenFiles/MRC10.gld");
  }