Command command = helpGetCommand(sql, metadata);
AnalysisRecord analysisRecord = new AnalysisRecord(false, DEBUG);
try {
CommandContext planningContext = new CommandContext(); //this should be the same as the processing context, but that's not easy to do
planningContext.setMetadata(new TempMetadataAdapter(metadata, new TempMetadataStore()));
ProcessorPlan plan = QueryOptimizer.optimizePlan(command, metadata, null, capFinder, analysisRecord, planningContext);
if(DEBUG) {
System.out.println(analysisRecord.getDebugLog());
}