Package org.teiid.query.processor
Class ProcessorPlan
- java.lang.Object
-
- org.teiid.query.processor.ProcessorPlan
-
- All Implemented Interfaces:
Cloneable,BatchCollector.BatchProducer
- Direct Known Subclasses:
BatchedUpdatePlan,DdlPlan,ExplainProcessPlan,ForEachRowPlan,ProcedurePlan,RelationalPlan,SourceTriggerActionPlanner.CompositeProcessorPlan
public abstract class ProcessorPlan extends Object implements Cloneable, BatchCollector.BatchProducer
This class represents a processor plan. It is generic in that it abstracts the interface to the plan by the processor, meaning that the actual implementation of the plan or the types of processing done by the plan is not important to the processor.
All the implementations of this interface need to implement
clone()method. The plan is only clonable in the pre or post-processing stage, not during the processing state (things like program state, result sets, etc). It's only safe to clone in between query processings. In other words, it's only safe to callclone()before the call toopen()or after the call toclose().
-
-
Constructor Summary
Constructors Constructor Description ProcessorPlan()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidaddWarning(TeiidException warning)abstract ProcessorPlanclone()Return a safe clone of the ProcessorPlan.abstract voidclose()Close the plan after processing.TupleBuffergetBuffer(int maxRows)return the final tuple buffer or null if not availableCommandContextgetContext()Get the processor context, which can be modified.PlanNodegetDescriptionProperties()abstract ListgetOutputElements()Get list of resolved elements describing output columns for this plan.booleanhasBuffer()Return true if the plan provides a final buffer via getBuffervoidinitialize(CommandContext context, ProcessorDataManager dataMgr, BufferManager bufferMgr)Initialize the plan with some required pieces of data for making queries.abstract TupleBatchnextBatch()Get a batch of results or possibly an Exception.abstract voidopen()Open the plan for processing.BooleanrequiresTransaction(boolean transactionalReads)voidreset()Reset a plan so that it can be processed again.voidsetContext(CommandContext context)
-
-
-
Method Detail
-
initialize
public void initialize(CommandContext context, ProcessorDataManager dataMgr, BufferManager bufferMgr)
Initialize the plan with some required pieces of data for making queries. The data manager is used to make queries and the processorID must be passed with the request so the data manager can find the processor again.- Parameters:
context- Process execution contextdataMgr- Data manager referencebufferMgr- Buffer manager reference
-
addWarning
public void addWarning(TeiidException warning)
-
reset
public void reset()
Reset a plan so that it can be processed again.
-
getOutputElements
public abstract List getOutputElements()
Get list of resolved elements describing output columns for this plan.- Specified by:
getOutputElementsin interfaceBatchCollector.BatchProducer- Returns:
- List of SingleElementSymbol
-
getContext
public CommandContext getContext()
Get the processor context, which can be modified.- Returns:
- context object
-
setContext
public void setContext(CommandContext context)
-
open
public abstract void open() throws TeiidComponentException, TeiidProcessingExceptionOpen the plan for processing.
-
nextBatch
public abstract TupleBatch nextBatch() throws BlockedException, TeiidComponentException, TeiidProcessingException
Get a batch of results or possibly an Exception.- Specified by:
nextBatchin interfaceBatchCollector.BatchProducer- Returns:
- Batch of results
- Throws:
BlockedException- indicating next batch is not available yetTeiidComponentException- for non-business rule exceptionTeiidProcessingException- for business rule exception, related to user input or modeling
-
close
public abstract void close() throws TeiidComponentExceptionClose the plan after processing.- Specified by:
closein interfaceBatchCollector.BatchProducer- Throws:
TeiidComponentException
-
clone
public abstract ProcessorPlan clone()
-
requiresTransaction
public Boolean requiresTransaction(boolean transactionalReads)
-
getDescriptionProperties
public PlanNode getDescriptionProperties()
-
getBuffer
public TupleBuffer getBuffer(int maxRows) throws BlockedException, TeiidComponentException, TeiidProcessingException
return the final tuple buffer or null if not available- Specified by:
getBufferin interfaceBatchCollector.BatchProducer- Returns:
- Throws:
TeiidProcessingExceptionTeiidComponentExceptionBlockedException
-
hasBuffer
public boolean hasBuffer()
Return true if the plan provides a final buffer via getBuffer- Specified by:
hasBufferin interfaceBatchCollector.BatchProducer
-
-