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 void
addWarning(TeiidException warning)
abstract ProcessorPlan
clone()
Return a safe clone of the ProcessorPlan.abstract void
close()
Close the plan after processing.TupleBuffer
getBuffer(int maxRows)
return the final tuple buffer or null if not availableCommandContext
getContext()
Get the processor context, which can be modified.PlanNode
getDescriptionProperties()
abstract List
getOutputElements()
Get list of resolved elements describing output columns for this plan.boolean
hasBuffer()
Return true if the plan provides a final buffer via getBuffervoid
initialize(CommandContext context, ProcessorDataManager dataMgr, BufferManager bufferMgr)
Initialize the plan with some required pieces of data for making queries.abstract TupleBatch
nextBatch()
Get a batch of results or possibly an Exception.abstract void
open()
Open the plan for processing.Boolean
requiresTransaction(boolean transactionalReads)
void
reset()
Reset a plan so that it can be processed again.void
setContext(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:
getOutputElements
in 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, TeiidProcessingException
Open the plan for processing.
-
nextBatch
public abstract TupleBatch nextBatch() throws BlockedException, TeiidComponentException, TeiidProcessingException
Get a batch of results or possibly an Exception.- Specified by:
nextBatch
in 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 TeiidComponentException
Close the plan after processing.- Specified by:
close
in 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:
getBuffer
in interfaceBatchCollector.BatchProducer
- Returns:
- Throws:
TeiidProcessingException
TeiidComponentException
BlockedException
-
hasBuffer
public boolean hasBuffer()
Return true if the plan provides a final buffer via getBuffer- Specified by:
hasBuffer
in interfaceBatchCollector.BatchProducer
-
-