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);
}
}