if (this.with != null) {
if (withToProcess == null) {
withToProcess = new LinkedList<WithQueryCommand>(with);
}
while (!withToProcess.isEmpty()) {
WithQueryCommand withCommand = withToProcess.get(0);
if (withProcessor == null) {
ProcessorPlan plan = withCommand.getCommand().getProcessorPlan();
withProcessor = new QueryProcessor(plan, getContext(), this.root.getBufferManager(), this.root.getDataManager());
Create create = new Create();
create.setElementSymbolsAsColumns(withCommand.getColumns());
create.setTable(withCommand.getGroupSymbol());
this.root.getDataManager().registerRequest(getContext(), create, TempMetadataAdapter.TEMP_MODEL.getID(), null, 0, -1);
}
while (true) {
TupleBatch batch = withProcessor.nextBatch();
Insert insert = new Insert(withCommand.getGroupSymbol(), withCommand.getColumns(), null);
insert.setTupleSource(new CollectionTupleSource(batch.getTuples().iterator()));
this.root.getDataManager().registerRequest(getContext(), insert, TempMetadataAdapter.TEMP_MODEL.getID(), null, 0, -1);
if (batch.getTerminationFlag()) {
break;
}
}
this.tempTableStore.setUpdatable(withCommand.getGroupSymbol().getCanonicalName(), false);
withToProcess.remove(0);
withProcessor = null;
}
}
this.root.open();