static ProcessorPlan optimizePlan(Command query, XMLPlannerEnvironment planEnv) throws QueryPlannerException, QueryMetadataException, TeiidComponentException { TempMetadataAdapter metadata = planEnv.getGlobalMetadata(); ProcessorPlan plan = QueryOptimizer.optimizePlan(query, metadata, planEnv.idGenerator, planEnv.capFinder, planEnv.analysisRecord, planEnv.context); return plan; }
try { plan = QueryOptimizer.optimizePlan(command, md, null, capFinder, analysisRecord, null); try { QueryOptimizer.optimizePlan(command, md, null, capFinder, analysisRecord, null);
@Test(expected=QueryPlannerException.class) public void testInvalidSource() throws Exception { String sql = "select * from pm1.g1"; //$NON-NLS-1$ QueryMetadataInterface md = RealMetadataFactory.example1Cached(); QueryOptimizer.optimizePlan(helpGetCommand(sql, md), md, null, new DefaultCapabilitiesFinder() { @Override public boolean isValid(String modelName) { return false; } }, null, new CommandContext()); }
result.setSingleRow(singleRow); result.setParams(params); ProcessorPlan queryPlan = QueryOptimizer.optimizePlan(query, metadata, idGenerator, capFinder, analysisRecord, context); result.setQueryPlan(queryPlan); result.setLookupMap(RelationalNode.createLookupMap(query.getProjectedSymbols())); command.setVirtualGroup(ta.getView()); command.setUpdateType(userCommand.getType()); ProcedurePlan rowProcedure = (ProcedurePlan)QueryOptimizer.optimizePlan(command, metadata, idGenerator, capFinder, analysisRecord, context); rowProcedure.setRunInContext(false); result.setRowProcedure(rowProcedure);
result.setSingleRow(singleRow); result.setParams(params); ProcessorPlan queryPlan = QueryOptimizer.optimizePlan(query, metadata, idGenerator, capFinder, analysisRecord, context); result.setQueryPlan(queryPlan); result.setLookupMap(RelationalNode.createLookupMap(query.getProjectedSymbols())); command.setVirtualGroup(ta.getView()); command.setUpdateType(userCommand.getType()); ProcedurePlan rowProcedure = (ProcedurePlan)QueryOptimizer.optimizePlan(command, metadata, idGenerator, capFinder, analysisRecord, context); rowProcedure.setRunInContext(false); result.setRowProcedure(rowProcedure);
result.setSingleRow(singleRow); result.setParams(params); ProcessorPlan queryPlan = QueryOptimizer.optimizePlan(query, metadata, idGenerator, capFinder, analysisRecord, context); result.setQueryPlan(queryPlan); result.setLookupMap(RelationalNode.createLookupMap(query.getProjectedSymbols())); command.setVirtualGroup(ta.getView()); command.setUpdateType(userCommand.getType()); ProcedurePlan rowProcedure = (ProcedurePlan)QueryOptimizer.optimizePlan(command, metadata, idGenerator, capFinder, analysisRecord, context); rowProcedure.setRunInContext(false); result.setRowProcedure(rowProcedure);
public static ProcessorPlan getProcedurePlan(String userQuery, QueryMetadataInterface metadata, CapabilitiesFinder capabilitiesFinder) throws Exception { Command userCommand = QueryParser.getQueryParser().parseCommand(userQuery); QueryResolver.resolveCommand(userCommand, metadata); ValidatorReport report = Validator.validate(userCommand, metadata); if (report.hasItems()) { ValidatorFailure firstFailure = report.getItems().iterator().next(); throw new QueryValidatorException(firstFailure.getMessage()); } QueryRewriter.rewrite(userCommand, metadata, new CommandContext()); AnalysisRecord analysisRecord = new AnalysisRecord(false, DEBUG); try { if ( capabilitiesFinder == null ) { capabilitiesFinder = new DefaultCapabilitiesFinder(); } ProcessorPlan plan = QueryOptimizer.optimizePlan(userCommand, metadata, null, capabilitiesFinder, analysisRecord, null); return plan; } finally { if(DEBUG) { System.out.println(analysisRecord.getDebugLog()); } } }
try { plan = QueryOptimizer.optimizePlan(command, md, null, capFinder, analysisRecord, cc); } catch (QueryPlannerException e) { exception = e;
ProcessorPlan process = QueryOptimizer.optimizePlan(command, metadata, null, capFinder, analysisRecord, context); if(DEBUG) System.out.println("\n" + process); //$NON-NLS-1$
@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; }
return QueryOptimizer.optimizePlan(userCommand, metadata, null, new DefaultCapabilitiesFinder(), analysisRecord, null); } finally { if(DEBUG) {
@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; }
@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; }
command.setProcessorPlan(QueryOptimizer.optimizePlan(command, metadata, idGenerator, capFinder, analysisRecord, context));
command.setProcessorPlan(QueryOptimizer.optimizePlan(command, metadata, idGenerator, capFinder, analysisRecord, context));
command.setProcessorPlan(QueryOptimizer.optimizePlan(command, metadata, idGenerator, capFinder, analysisRecord, context));
ProcessorPlan plan = QueryOptimizer.optimizePlan(subCommand, metadata, null, capFinder, analysisRecord, context); subqueryContainer.getCommand().setProcessorPlan(plan);
ProcessorPlan plan = QueryOptimizer.optimizePlan(subCommand, metadata, null, capFinder, analysisRecord, context); subqueryContainer.getCommand().setProcessorPlan(plan);
ProcessorPlan plan = QueryOptimizer.optimizePlan(subCommand, metadata, null, capFinder, analysisRecord, context); subqueryContainer.getCommand().setProcessorPlan(plan);
context.setDQPWorkContext(workContext); context.setOptions(options); ProcessorPlan plan = QueryOptimizer.optimizePlan(command, wrapper, idGenerator, finder, analysis, context);