Search in sources :

Example 1 with AbstractValidationVisitor

use of org.teiid.query.validator.AbstractValidationVisitor in project teiid by teiid.

the class QueryProcessorFactoryImpl method getPreparedPlan.

@Override
public PreparedPlan getPreparedPlan(String query, String recursionGroup, CommandContext commandContext, QueryMetadataInterface metadata) throws TeiidComponentException, TeiidProcessingException {
    if (recursionGroup != null) {
        commandContext.pushCall(recursionGroup);
    }
    PreparedPlan pp = commandContext.getPlan(query);
    if (pp == null) {
        ParseInfo parseInfo = new ParseInfo();
        Command newCommand = QueryParser.getQueryParser().parseCommand(query, parseInfo);
        QueryResolver.resolveCommand(newCommand, metadata);
        List<Reference> references = ReferenceCollectorVisitor.getReferences(newCommand);
        AbstractValidationVisitor visitor = new ValidationVisitor();
        Request.validateWithVisitor(visitor, metadata, newCommand);
        newCommand = QueryRewriter.rewrite(newCommand, metadata, commandContext);
        AnalysisRecord record = new AnalysisRecord(false, false);
        ProcessorPlan plan = QueryOptimizer.optimizePlan(newCommand, metadata, idGenerator, finder, record, commandContext);
        pp = new PreparedPlan();
        pp.setPlan(plan, commandContext);
        pp.setReferences(references);
        pp.setAnalysisRecord(record);
        pp.setCommand(newCommand);
        commandContext.putPlan(query, pp, commandContext.getDeterminismLevel());
    }
    return pp;
}
Also used : AbstractValidationVisitor(org.teiid.query.validator.AbstractValidationVisitor) ValidationVisitor(org.teiid.query.validator.ValidationVisitor) AnalysisRecord(org.teiid.query.analysis.AnalysisRecord) Command(org.teiid.query.sql.lang.Command) Reference(org.teiid.query.sql.symbol.Reference) ParseInfo(org.teiid.query.parser.ParseInfo) AbstractValidationVisitor(org.teiid.query.validator.AbstractValidationVisitor) ProcessorPlan(org.teiid.query.processor.ProcessorPlan)

Example 2 with AbstractValidationVisitor

use of org.teiid.query.validator.AbstractValidationVisitor in project teiid by teiid.

the class Request method validateQuery.

private void validateQuery(Command command) throws QueryValidatorException, TeiidComponentException {
    // Create generic sql validation visitor
    AbstractValidationVisitor visitor = new ValidationVisitor();
    validateWithVisitor(visitor, metadata, command);
}
Also used : AbstractValidationVisitor(org.teiid.query.validator.AbstractValidationVisitor) ValidationVisitor(org.teiid.query.validator.ValidationVisitor) AbstractValidationVisitor(org.teiid.query.validator.AbstractValidationVisitor)

Aggregations

AbstractValidationVisitor (org.teiid.query.validator.AbstractValidationVisitor)2 ValidationVisitor (org.teiid.query.validator.ValidationVisitor)2 AnalysisRecord (org.teiid.query.analysis.AnalysisRecord)1 ParseInfo (org.teiid.query.parser.ParseInfo)1 ProcessorPlan (org.teiid.query.processor.ProcessorPlan)1 Command (org.teiid.query.sql.lang.Command)1 Reference (org.teiid.query.sql.symbol.Reference)1