Examples of PlanValidationException


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

            errCode = ((PigException)ioe).getErrorCode();
          }
          String exceptionMsg = ioe.getMessage();
          validationErrStr += (exceptionMsg == null) ? "" : " More info to follow:\n" +exceptionMsg;
          msgCollector.collect(validationErrStr, MessageType.Error) ;
            throw new PlanValidationException(validationErrStr, errCode, pigCtx.getErrorSource(), ioe);
        }
       
        validationErrStr += " More info to follow:\n";
        try {
            sf.getOutputFormat().checkOutputSpecs(dummyJob);
        } catch (IOException ioe) {
            byte errSrc = pigCtx.getErrorSource();
            switch(errSrc) {
            case PigException.BUG:
                errCode = 2002;
                break;
            case PigException.REMOTE_ENVIRONMENT:
                errCode = 6000;
                break;
            case PigException.USER_ENVIRONMENT:
                errCode = 4000;
                break;
            }
          validationErrStr  += ioe.getMessage();
          msgCollector.collect(validationErrStr, MessageType.Error) ;
            throw new PlanValidationException(validationErrStr, errCode, errSrc, ioe);
        } catch (InterruptedException ie) {
          validationErrStr += ie.getMessage();
          msgCollector.collect(validationErrStr, MessageType.Error) ;
            throw new PlanValidationException(validationErrStr, errCode, pigCtx.getErrorSource(), ie);
        }
    }
View Full Code Here

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

                            int errCode = 1108;
                            String msg = "Duplicate schema alias: "
                                    + schema.getField(i).alias;
                            if (lo.getAlias()!=null)
                                msg = msg + " in \"" + lo.getAlias()+"\"";
                            throw new PlanValidationException(msg, errCode,
                                    PigException.INPUT);
                        }
                    }
            }
        } catch (PlanValidationException e) {
            throw e;
        } catch (FrontendException e) {
            int errCode = 2201;
            String msg = "Could not validate schema alias";
            throw new PlanValidationException(msg, errCode, PigException.INPUT);
        }
    }
View Full Code Here

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

            if(store.getSchema() != null){
                sf.checkSchema(new ResourceSchema(store.getSchema(), store.getSortInfo()));               
            }
        } catch (FrontendException e) {
            msgCollector.collect(errMsg, MessageType.Error) ;
            throw new PlanValidationException(errMsg, errCode, pigCtx.getErrorSource(), e);
        } catch (IOException e) {
            msgCollector.collect(errMsg, MessageType.Error) ;
            throw new PlanValidationException(errMsg, errCode, pigCtx.getErrorSource(), e);
        }

        Job dummyJob;
       
        try {
            dummyJob = new Job(ConfigurationUtil.toConfiguration(pigCtx.getProperties()));
            sf.setStoreLocation(outLoc, dummyJob);
        } catch (IOException ioe) {
            msgCollector.collect(errMsg, MessageType.Error) ;
            throw new PlanValidationException(errMsg, errCode, pigCtx.getErrorSource(), ioe);
        }
        try {
            sf.getOutputFormat().checkOutputSpecs(dummyJob);
        } catch (IOException ioe) {
            byte errSrc = pigCtx.getErrorSource();
            errCode = 0;
            switch(errSrc) {
            case PigException.BUG:
                errCode = 2002;
                break;
            case PigException.REMOTE_ENVIRONMENT:
                errCode = 6000;
                break;
            case PigException.USER_ENVIRONMENT:
                errCode = 4000;
                break;
            }
            errMsg = "Output specification '"+outLoc+"' is invalid or already exists";
            msgCollector.collect(errMsg, MessageType.Error) ;
            throw new PlanValidationException(errMsg, errCode, errSrc, ioe);
        } catch (InterruptedException ie) {
            msgCollector.collect(errMsg, MessageType.Error) ;
            throw new PlanValidationException(errMsg, errCode, pigCtx.getErrorSource(), ie);
        }
    }
View Full Code Here

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

                            int errCode = 1108;
                            String msg = "Duplicate schema alias: "
                                    + schema.getField(i).alias;
                            if (lo.getAlias()!=null)
                                msg = msg + " in \"" + lo.getAlias()+"\"";
                            throw new PlanValidationException(msg, errCode,
                                    PigException.INPUT);
                        }
                    }
            }
        } catch (PlanValidationException e) {
            throw e;
        } catch (FrontendException e) {
            int errCode = 2201;
            String msg = "Could not validate schema alias";
            throw new PlanValidationException(msg, errCode, PigException.INPUT);
        }
    }
View Full Code Here

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

                int col = -1;
                for( Object rc : rawCols ) {
                    if( rc instanceof Integer ) {
                      col = (Integer)rc;
                      if( schema != null && schema.size()!=0 && col >= schema.size() ) {
                            throw new PlanValidationException( expr, "Out of bound access. Trying to access non-existent column: " +
                                    col + ". Schema " + schema.toString(false) + " has " + schema.size() + " column(s).", 1000 );
                      }
                        cols.add( (Integer)rc );
                    } else {
                        col = schema == null ? -1 : schema.getFieldPosition( (String)rc );
                        if( col == -1 ) {
                            throw new PlanValidationException( expr, "Invalid field reference. Referenced field [" +
                                rc + "] does not exist in schema: " + (schema!=null?schema.toString(false):"") + "." , 1000);
                        }
                        cols.add( col );
                    }
                }
View Full Code Here

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

                endAlias = null;
            }
            if(startCol < 0){
                String msg = "Invalid start column position in " +
                "range projection (..) " + startCol;
                throw new PlanValidationException(this, msg, 2270, PigException.BUG);
            }

            if(endCol > 0 && startCol > endCol){
                String msg = "start column appears after end column in " +
                "range projection (..) . Start column position " + startCol +
                " End column position " + endCol;
                throw new PlanValidationException(this, msg, 1127, PigException.INPUT);
            }
        }else{
            setColNum(findColNum(alias));
        }
    }
View Full Code Here

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

            if( colNum == -1 ) {
              String msg = "Invalid field projection. Projected field [" + alias + "] does not exist";
                if( inputSchema != null )
                  msg += " in schema: " + inputSchema.toString( false );
                msg += ".";
                throw new PlanValidationException( this, msg, 1025 );
            }
            return colNum;
        } else {
            int col = getColNum();
            if( inputSchema != null && col >= inputSchema.size() ) {
                throw new PlanValidationException( this,
                        "Out of bound access. Trying to access non-existent column: " +
                        col + ". Schema " +  inputSchema.toString(false) +
                        " has " + inputSchema.size() + " column(s)." , 1000);
            }
            return col;
View Full Code Here

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

                //check duplicate uid
                if(!uidsSeen.add(fs.uid)){
                    // uid already seen
                    String msg = "Logical plan invalid state: duplicate uid in " +
                            "schema : " + schema;
                    throw new PlanValidationException(
                            msg,
                            2270,
                            PigException.BUG
                            );
                }
            }
           
            if(fs.uid < 0){
                String msg = "Logical plan invalid state: invalid uid " + fs.uid +
                        " in schema : " + schema;
                throw new PlanValidationException(
                        msg,
                        2271,
                        PigException.BUG
                        );
               
View Full Code Here

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

                    if(seenAliases.contains(alias)){
                        int errCode = 1108;
                        String msg = "Duplicate schema alias: " + schema.getField( i ).alias;
                        if( op.getAlias() != null )
                            msg = msg + " in \"" + op.getAlias() + "\"";
                        throw new PlanValidationException( op, msg, errCode, PigException.INPUT );
                    }
                    seenAliases.add(alias);
                }
            }
        }
View Full Code Here

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

                if( store == null ) {
                    FileSpec fileSpec;
                    try {
                        fileSpec = new FileSpec( FileLocalizer.getTemporaryPath( pigContext ).toString(), interStorageFuncSpec );                    // TODO: need to hookup the pigcontext.
                    } catch (IOException e) {
                        throw new PlanValidationException( expr, "Failed to process scalar" + e);
                    }
                    StoreFuncInterface stoFunc = (StoreFuncInterface)PigContext.instantiateFuncFromSpec(interStorageFuncSpec);
                    String sig = LogicalPlanBuilder.newOperatorKey(scope);
                    stoFunc.setStoreFuncUDFContextSignature(sig);
                    store = new LOStore(lp, fileSpec, stoFunc, sig);
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.