Package org.apache.pig.impl.plan

Examples of org.apache.pig.impl.plan.VisitorException


                                          inp, ppLists, keyTypes, null, fragment, isLeftOuter, nullTuple);
              pfrj.setAlias(loj.getAlias());
          } catch (ExecException e1) {
              int errCode = 2058;
              String msg = "Unable to set index on newly create POLocalRearrange.";
              throw new VisitorException(msg, errCode, PigException.BUG, e1);
          }
          pfrj.setResultType(DataType.TUPLE);
          currentPlan.add(pfrj);
          for (LogicalOperator op : inputs) {
              try {
                  currentPlan.connect(logToPhyMap.get(op), pfrj);
              } catch (PlanException e) {
                  int errCode = 2015;
                  String msg = "Invalid physical operators in the physical plan" ;
                  throw new LogicalToPhysicalTranslatorException(msg, errCode, PigException.BUG, e);
              }
          }
          logToPhyMap.put(loj, pfrj);
    }
   
    else if (loj.getJoinType() == LOJoin.JOINTYPE.MERGE && validateMergeJoin(loj)) {
           
        POMergeJoin smj;
            try {
                smj = new POMergeJoin(new OperatorKey(scope,nodeGen.getNextNodeId(scope)),loj.getRequestedParallelism(),inp,joinPlans,keyTypes);
            }
            catch (Exception e) {
                int errCode = 2042;
                String msg = "Merge Join creation failed";
                throw new LogicalToPhysicalTranslatorException(msg, errCode, PigException.BUG, e);
            }

            smj.setResultType(DataType.TUPLE);
            currentPlan.add(smj);

            for (LogicalOperator op : inputs) {
                try {
                    currentPlan.connect(logToPhyMap.get(op), smj);
                } catch (PlanException e) {
                    int errCode = 2015;
                    String msg = "Invalid physical operators in the physical plan" ;
                    throw new LogicalToPhysicalTranslatorException(msg, errCode, PigException.BUG, e);
                }
            }
            logToPhyMap.put(loj, smj);
            return;
        }
    else if (loj.getJoinType() == LOJoin.JOINTYPE.HASH){
          POGlobalRearrange poGlobal = new POGlobalRearrange(new OperatorKey(
                  scope, nodeGen.getNextNodeId(scope)), loj
                  .getRequestedParallelism());
          poGlobal.setAlias(loj.getAlias());
          POPackage poPackage = new POPackage(new OperatorKey(scope, nodeGen
                  .getNextNodeId(scope)), loj.getRequestedParallelism());
          poPackage.setAlias(loj.getAlias());
          currentPlan.add(poGlobal);
          currentPlan.add(poPackage);
         
          int count = 0;
            Byte type = null;
         
          try {
              currentPlan.connect(poGlobal, poPackage);
              for (LogicalOperator op : inputs) {
                  List<LogicalPlan> plans = (List<LogicalPlan>) loj.getJoinPlans()
                          .get(op);
                  POLocalRearrange physOp = new POLocalRearrange(new OperatorKey(
                          scope, nodeGen.getNextNodeId(scope)), loj
                          .getRequestedParallelism());
                  List<PhysicalPlan> exprPlans = new ArrayList<PhysicalPlan>();
                  currentPlans.push(currentPlan);
                  for (LogicalPlan lp : plans) {
                      currentPlan = new PhysicalPlan();
                      PlanWalker<LogicalOperator, LogicalPlan> childWalker = mCurrentWalker
                              .spawnChildWalker(lp);
                      pushWalker(childWalker);
                      mCurrentWalker.walk(this);
                      exprPlans.add(currentPlan);
                      popWalker();

                  }
                  currentPlan = currentPlans.pop();
                  try {
                      physOp.setPlans(exprPlans);
                  } catch (PlanException pe) {
                      int errCode = 2071;
                      String msg = "Problem with setting up local rearrange's plans.";
                      throw new LogicalToPhysicalTranslatorException(msg, errCode, PigException.BUG, pe);
                  }
                  try {
                      physOp.setIndex(count++);
                  } catch (ExecException e1) {
                      int errCode = 2058;
                      String msg = "Unable to set index on newly create POLocalRearrange.";
                      throw new VisitorException(msg, errCode, PigException.BUG, e1);
                  }
                  if (plans.size() > 1) {
                      type = DataType.TUPLE;
                      physOp.setKeyType(type);
                  } else {
View Full Code Here


            // in JobControlCompiler
            store.setSchema(new Schema(loStore.getSchema()));
        } catch (FrontendException e1) {
            int errorCode = 1060;
            String message = "Cannot resolve Store output schema"
            throw new VisitorException(message, errorCode, PigException.BUG, e1);   
        }
        currentPlan.add(store);
       
        PhysicalOperator from = logToPhyMap.get(loStore.getPlan().getPredecessors(loStore).get(0));
       
View Full Code Here

            UidStamper stamper = new UidStamper(newPlan);
            stamper.visit();
           
            return newPlan;
        }catch(Exception e) {
            throw new VisitorException(e);
        }
    }
View Full Code Here

                 setupDistributedCache(pigContext, conf, replicatedPath
                         .toArray(new String[0]), false);
             } catch (IOException e) {
                 String msg = "Internal error. Distributed cache could not " +
                               "be set up for the replicated files";
                 throw new VisitorException(msg, e);
             }
         }
View Full Code Here

                        conf, indexFile, "indexfile_");
                join.setIndexFile(symlink);
            } catch (IOException e) {
                String msg = "Internal error. Distributed cache could not " +
                        "be set up for merge join index file";
                throw new VisitorException(msg, e);
            }
         }
View Full Code Here

       
        try {
            UidStamper stamper = new UidStamper(expected);
            stamper.visit();        
        }catch(Exception e) {
            throw new VisitorException(e);
        }

        assertTrue(expected.isEqual(newPlan));
       
        LogicalSchema schema = foreach.getSchema();
View Full Code Here

        expected.connect(foreach2, s);
        try {
            UidStamper stamper = new UidStamper(expected);
            stamper.visit();        
        }catch(Exception e) {
            throw new VisitorException(e);
        }
       
        assertTrue(expected.isEqual(newPlan));
       
        LogicalSchema schema = foreach2.getSchema();
View Full Code Here

            UidStamper stamper = new UidStamper(newPlan);
            stamper.visit();
           
            return newPlan;
        }catch(Exception e) {
            throw new VisitorException(e);
        }
    }   
View Full Code Here

            optimizer.addPlanTransformListener(new SchemaPatcher());
            optimizer.optimize();
           
            return newPlan;
        }catch(Exception e) {
            throw new VisitorException(e);
        }
    }
View Full Code Here

    protected void visit(LOCogroup cg) throws VisitorException {
        try {
            cg.getSchema();
            super.visit(cg);
        } catch (FrontendException fe) {
            throw new VisitorException(fe);
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.pig.impl.plan.VisitorException

Copyright © 2018 www.massapicom. 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.