}
@Override
public QueryProcessor createQueryProcessor(String query, String recursionGroup, CommandContext commandContext, Object... params) throws TeiidProcessingException, TeiidComponentException {
PreparedPlan pp = commandContext.getPlan(query);
CommandContext copy = commandContext.clone();
if (recursionGroup != null) {
copy.pushCall(recursionGroup);
}
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);
Determinism determinismLevel = copy.resetDeterminismLevel();
newCommand = QueryRewriter.rewrite(newCommand, metadata, copy);
AnalysisRecord record = new AnalysisRecord(false, false);
ProcessorPlan plan = QueryOptimizer.optimizePlan(newCommand, metadata, idGenerator, finder, record, copy);
pp = new PreparedPlan();
pp.setPlan(plan, copy);
pp.setReferences(references);
pp.setAnalysisRecord(record);
pp.setCommand(newCommand);
commandContext.putPlan(query, pp, copy.getDeterminismLevel());
copy.setDeterminismLevel(determinismLevel);
}
copy.pushVariableContext(new VariableContext());
PreparedStatementRequest.resolveParameterValues(pp.getReferences(), Arrays.asList(params), copy, metadata);
return new QueryProcessor(pp.getPlan().clone(), copy, bufferMgr, dataMgr);
}