private void validateQuery() throws FrontendException {
String query = buildQuery();
QueryParserDriver parserDriver = new QueryParserDriver( pigContext, scope, fileNameMap );
try {
LogicalPlan plan = parserDriver.parse( query );
plan.validate(pigContext, scope, true);
} catch(FrontendException ex) {
scriptCache.remove( scriptCache.size() -1 );
throw ex;
}
}