Package org.apache.pig.impl.plan

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


    public void rewire(Operator oldPred, int oldPredIndex, Operator newPred, boolean useOldPred) throws PlanException {
        super.rewire(oldPred, oldPredIndex, newPred, useOldPred);
        if(newPred == null) {
            int errCode = 1097;
            String msg = "Replacement node cannot be null.";
            throw new PlanException(msg, errCode, PigException.INPUT);
        }
        LogicalOperator previous = (LogicalOperator) oldPred;
        LogicalOperator current = (LogicalOperator) newPred;
        Set<LogicalOperator> cogroupInputs = new HashSet<LogicalOperator>(mGroupByPlans.keySet());
        for(LogicalOperator input: cogroupInputs) {
            if(input.equals(previous)) {
                //replace the references to the key(i.e., previous) in the values with current
                for(LogicalPlan plan: mGroupByPlans.get(input)) {
                    try {
                        ProjectFixerUpper projectFixer = new ProjectFixerUpper(
                                plan, previous, oldPredIndex, current, useOldPred, this);
                        projectFixer.visit();
                    } catch (VisitorException ve) {
                        int errCode = 2144;
                        String msg = "Problem while fixing project inputs during rewiring.";
                        throw new PlanException(msg, errCode, PigException.BUG, ve);
                    }
                }
                //remove the key and the values
                List<LogicalPlan> plans = (List<LogicalPlan>)mGroupByPlans.get(previous);
                mGroupByPlans.removeKey(previous);
View Full Code Here


                    mCondPlan, previous, oldPredIndex, current, useOldPred, this);
            projectFixer.visit();
        } catch (VisitorException ve) {
            int errCode = 2144;
            String msg = "Problem while fixing project inputs during rewiring.";
            throw new PlanException(msg, errCode, PigException.BUG, ve);
        }
       
        //ideally we should be fixing mIndex too but split and split output should always
        //be treated as one operator. Any operations on split will imply an operation on
        //split output
View Full Code Here

                        plan, previous, oldPredIndex, current, useOldPred, this);
                projectFixer.visit();
            } catch (VisitorException ve) {
                int errCode = 2144;
                String msg = "Problem while fixing project inputs during rewiring.";
                throw new PlanException(msg, errCode, PigException.BUG, ve);
            }
        }
    }
View Full Code Here

                        plan, previous, oldPredIndex, current, useOldPred, this);
                projectFixer.visit();
            } catch (VisitorException ve) {
                int errCode = 2144;
                String msg = "Problem while fixing project inputs during rewiring.";
                throw new PlanException(msg, errCode, PigException.BUG, ve);
            }
        }
    }
View Full Code Here

            if (op instanceof POLoad) {

                if (predecessors.size() != 1) {
                    int errCode = 2125;
                    String msg = "Expected at most one predecessor of load. Got "+predecessors.size();
                    throw new PlanException(msg, errCode, PigException.BUG);
                }

                PhysicalOperator p = predecessors.get(0);
                if (!(p instanceof POStore)) {
                    int errCode = 2126;
                    String msg = "Predecessor of load should be a store. Got "+p.getClass();
                    throw new PlanException(msg, errCode, PigException.BUG);
                }

                // Need new operator
                curMROp = getMROp();
                curMROp.mapPlan.add(op);
View Full Code Here

            } else if (mro.isMapDone() && !mro.isReduceDone()) {
                mro.reducePlan.addAsLeaf(op);
            } else {
                int errCode = 2022;
                String msg = "Both map and reduce phases have been done. This is unexpected while compiling.";               
                throw new PlanException(msg, errCode, PigException.BUG);
            }
            curMROp = mro;
        } else {
            List<MapReduceOper> mergedPlans = merge(compiledInputs);
           
View Full Code Here

     */
    private MapReduceOper endSingleInputPlanWithStr(FileSpec fSpec) throws PlanException{
        if(compiledInputs.length>1) {
            int errCode = 2023;
            String msg = "Received a multi input plan when expecting only a single input one.";
            throw new PlanException(msg, errCode, PigException.BUG);
        }
        MapReduceOper mro = compiledInputs[0];
        POStore str = getStore();
        str.setSFile(fSpec);
        if (!mro.isMapDone()) {
            mro.mapPlan.addAsLeaf(str);
            mro.setMapDoneSingle(true);
        } else if (mro.isMapDone() && !mro.isReduceDone()) {
            mro.reducePlan.addAsLeaf(str);
            mro.setReduceDone(true);
        } else {
            int errCode = 2022;
            String msg = "Both map and reduce phases have been done. This is unexpected while compiling.";
            throw new PlanException(msg, errCode, PigException.BUG);
        }
        return mro;
    }
View Full Code Here

            } else if (mro.isMapDone() && !mro.isReduceDone()) {
                ret.add(mro);
            } else {
                int errCode = 2027;
                String msg = "Both map and reduce phases have been done. This is unexpected for a merge.";
                throw new PlanException(msg, errCode, PigException.BUG);
            }
        }
        merge(ret.get(0).mapPlan, mpLst);
       
        Iterator<MapReduceOper> it = toBeConnected.iterator();
View Full Code Here

        try {
            lr.setIndex(0);
        } catch (ExecException e) {
            int errCode = 2058;
            String msg = "Unable to set index on the newly created POLocalRearrange.";
            throw new PlanException(msg, errCode, PigException.BUG, e);
        }
        lr.setKeyType(DataType.TUPLE);
        lr.setPlans(eps);
        lr.setResultType(DataType.TUPLE);
       
View Full Code Here

                    mro.reducePlan.addAsLeaf(str);
                    mro.setReduceDone(true);
                } else {
                  int errCode = 2022;
                    String msg = "Both map and reduce phases have been done. This is unexpected while compiling.";
                    throw new PlanException(msg, errCode, PigException.BUG);
                }
            }
            for(int i=0;i<compiledInputs.length;i++){
                if(i==fragPlan) continue;
                MRPlan.connect(compiledInputs[i], curMROp);
            }
           
            if (!curMROp.isMapDone()) {
                curMROp.mapPlan.addAsLeaf(op);
            } else if (curMROp.isMapDone() && !curMROp.isReduceDone()) {
                curMROp.reducePlan.addAsLeaf(op);
            } else {
              int errCode = 2022;
                String msg = "Both map and reduce phases have been done. This is unexpected while compiling.";
                throw new PlanException(msg, errCode, PigException.BUG);
            }
            List<List<PhysicalPlan>> joinPlans = op.getJoinPlans();
            if(joinPlans!=null)
                for (List<PhysicalPlan> joinPlan : joinPlans) {
                    if(joinPlan!=null)
View Full Code Here

TOP

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

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.