Package org.teiid.query.processor.proc
Class ProcedurePlan
- java.lang.Object
-
- org.teiid.query.processor.ProcessorPlan
-
- org.teiid.query.processor.proc.ProcedurePlan
-
- All Implemented Interfaces:
Cloneable
,BatchCollector.BatchProducer
,ProcessorDataManager
public class ProcedurePlan extends ProcessorPlan implements ProcessorDataManager
-
-
Constructor Summary
Constructors Constructor Description ProcedurePlan(Program originalProgram)
Constructor for ProcedurePlan.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static void
checkNotNull(ElementSymbol param, Object value, QueryMetadataInterface metadata)
ProcessorPlan
clone()
Return a safe clone of the ProcessorPlan.void
close()
Close the plan after processing.void
executePlan(ProcessorPlan command, String rsName, Map<ElementSymbol,ElementSymbol> procAssignments, CreateCursorResultSetInstruction.Mode mode, boolean usesLocalTemp)
CommandContext
getContext()
Get the processor context, which can be modified.List<?>
getCurrentRow(String rsName)
VariableContext
getCurrentVariableContext()
Get the currentVariavleContext
on this environment.ProcessorDataManager
getDataManager()
PlanNode
getDescriptionProperties()
EventDistributor
getEventDistributor()
Program
getOriginalProgram()
List
getOutputElements()
Get list of resolved elements describing output columns for this plan.List
getSchema(String rsName)
Get the schema from the tuple source that represents the columns in a result setTempTableStore
getTempTableStore()
void
incrementProgramCounter()
void
initialize(CommandContext context, ProcessorDataManager dataMgr, BufferManager buffer)
Initialize the plan with some required pieces of data for making queries.protected boolean
isBatchFull()
boolean
isValidateAccess()
boolean
iterateCursor(String rsName)
Object
lookupCodeValue(CommandContext context, String codeTableName, String returnElementName, String keyElementName, Object keyValue)
Lookup a value from a cached code table.TupleBatch
nextBatch()
Get a batch of results or possibly an Exception.TupleBatch
nextBatchDirect()
void
open()
Open the plan for processing.Program
peek()
void
pop(boolean success)
protected TupleBatch
pullBatch()
void
push(Program program)
TupleSource
registerRequest(CommandContext context, Command command, String modelName, RegisterRequestParameter parameterObject)
void
removeResults(String rsName)
Boolean
requiresTransaction(boolean transactionalReads)
void
reset()
Reset a plan so that it can be processed again.boolean
resultSetExists(String rsName)
void
setMetadata(QueryMetadataInterface metadata)
void
setOutParams(List<ElementSymbol> outParams)
void
setOutputElements(List outputElements)
protected void
setParameterValue(ElementSymbol param, VariableContext context, Object value)
void
setParams(LinkedHashMap<ElementSymbol,Expression> params)
void
setRunInContext(boolean runInContext)
For procedures without explicit parameters, sets whether the procedure should run in the parent variable context.void
setUpdateCount(int updateCount)
void
setValidateAccess(boolean b)
protected void
terminateBatches()
String
toString()
-
Methods inherited from class org.teiid.query.processor.ProcessorPlan
addWarning, getBuffer, hasBuffer, setContext
-
-
-
-
Constructor Detail
-
ProcedurePlan
public ProcedurePlan(Program originalProgram)
Constructor for ProcedurePlan.
-
-
Method Detail
-
getOriginalProgram
public Program getOriginalProgram()
-
initialize
public void initialize(CommandContext context, ProcessorDataManager dataMgr, BufferManager buffer)
Description copied from class:ProcessorPlan
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.- Overrides:
initialize
in classProcessorPlan
- Parameters:
context
- Process execution contextdataMgr
- Data manager referencebuffer
- Buffer manager reference
-
reset
public void reset()
Description copied from class:ProcessorPlan
Reset a plan so that it can be processed again.- Overrides:
reset
in classProcessorPlan
-
getDataManager
public ProcessorDataManager getDataManager()
-
open
public void open() throws TeiidProcessingException, TeiidComponentException
Description copied from class:ProcessorPlan
Open the plan for processing.- Specified by:
open
in classProcessorPlan
- Throws:
TeiidComponentException
TeiidProcessingException
-
checkNotNull
public static void checkNotNull(ElementSymbol param, Object value, QueryMetadataInterface metadata) throws TeiidComponentException, QueryMetadataException, QueryValidatorException
-
setParameterValue
protected void setParameterValue(ElementSymbol param, VariableContext context, Object value)
-
nextBatch
public TupleBatch nextBatch() throws BlockedException, TeiidComponentException, TeiidProcessingException
Description copied from class:ProcessorPlan
Get a batch of results or possibly an Exception.- Specified by:
nextBatch
in interfaceBatchCollector.BatchProducer
- Specified by:
nextBatch
in classProcessorPlan
- 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
-
nextBatchDirect
public TupleBatch nextBatchDirect() throws TeiidComponentException, TeiidProcessingException, BlockedException
-
close
public void close() throws TeiidComponentException
Description copied from class:ProcessorPlan
Close the plan after processing.- Specified by:
close
in interfaceBatchCollector.BatchProducer
- Specified by:
close
in classProcessorPlan
- Throws:
TeiidComponentException
-
clone
public ProcessorPlan clone()
Description copied from class:ProcessorPlan
Return a safe clone of the ProcessorPlan. A ProcessorPlan may only be safely cloned in between processings. That is, it is only safe to clone a plan before it isopened
or after it isclosed
.- Specified by:
clone
in classProcessorPlan
- Returns:
- safe clone of this ProcessorPlan, as long as it is not open for processing
-
terminateBatches
protected void terminateBatches()
-
isBatchFull
protected boolean isBatchFull()
-
pullBatch
protected TupleBatch pullBatch()
-
getDescriptionProperties
public PlanNode getDescriptionProperties()
- Overrides:
getDescriptionProperties
in classProcessorPlan
-
setMetadata
public void setMetadata(QueryMetadataInterface metadata)
-
setOutParams
public void setOutParams(List<ElementSymbol> outParams)
-
setParams
public void setParams(LinkedHashMap<ElementSymbol,Expression> params)
-
getCurrentVariableContext
public VariableContext getCurrentVariableContext()
Get the current
VariavleContext
on this environment. The VariableContext is updated with variables and their values byProgramInstruction
s that are part of the ProcedurePlan that use this environment.- Returns:
- The current
VariariableContext
.
-
executePlan
public void executePlan(ProcessorPlan command, String rsName, Map<ElementSymbol,ElementSymbol> procAssignments, CreateCursorResultSetInstruction.Mode mode, boolean usesLocalTemp) throws TeiidComponentException, TeiidProcessingException
- Parameters:
command
-rsName
-procAssignments
-mode
-usesLocalTemp
- - only matters in HOLD mode- Throws:
TeiidComponentException
TeiidProcessingException
-
pop
public void pop(boolean success) throws TeiidComponentException
- Parameters:
success
-- Throws:
TeiidComponentException
-
push
public void push(Program program) throws XATransactionException
- Throws:
XATransactionException
-
incrementProgramCounter
public void incrementProgramCounter() throws TeiidComponentException
- Throws:
TeiidComponentException
-
getCurrentRow
public List<?> getCurrentRow(String rsName) throws TeiidComponentException
- Throws:
TeiidComponentException
-
iterateCursor
public boolean iterateCursor(String rsName) throws TeiidComponentException, TeiidProcessingException
-
removeResults
public void removeResults(String rsName)
-
getSchema
public List getSchema(String rsName) throws TeiidComponentException
Get the schema from the tuple source that represents the columns in a result set- Parameters:
rsName
- the ResultSet name (not a temp group)- Returns:
- List of elements
- Throws:
TeiidComponentException
-
resultSetExists
public boolean resultSetExists(String rsName)
-
getContext
public CommandContext getContext()
Description copied from class:ProcessorPlan
Get the processor context, which can be modified.- Overrides:
getContext
in classProcessorPlan
- Returns:
- context object
-
getOutputElements
public List getOutputElements()
Description copied from class:ProcessorPlan
Get list of resolved elements describing output columns for this plan.- Specified by:
getOutputElements
in interfaceBatchCollector.BatchProducer
- Specified by:
getOutputElements
in classProcessorPlan
- Returns:
- List of SingleElementSymbol
-
setOutputElements
public void setOutputElements(List outputElements)
-
getTempTableStore
public TempTableStore getTempTableStore()
- Returns:
- Returns the tempTableStore.
- Since:
- 5.5
-
peek
public Program peek()
-
setUpdateCount
public void setUpdateCount(int updateCount)
-
requiresTransaction
public Boolean requiresTransaction(boolean transactionalReads)
- Overrides:
requiresTransaction
in classProcessorPlan
-
setRunInContext
public void setRunInContext(boolean runInContext)
For procedures without explicit parameters, sets whether the procedure should run in the parent variable context.- Parameters:
runInContext
-
-
registerRequest
public TupleSource registerRequest(CommandContext context, Command command, String modelName, RegisterRequestParameter parameterObject) throws TeiidComponentException, TeiidProcessingException
- Specified by:
registerRequest
in interfaceProcessorDataManager
- Throws:
TeiidComponentException
TeiidProcessingException
-
lookupCodeValue
public Object lookupCodeValue(CommandContext context, String codeTableName, String returnElementName, String keyElementName, Object keyValue) throws BlockedException, TeiidComponentException, TeiidProcessingException
Description copied from interface:ProcessorDataManager
Lookup a value from a cached code table. If the code table is not loaded, it will be loaded on the first query. Code tables should be cached based on a combination of the codeTableName, returnElementName, and keyElementName. If the table is not loaded, a request will be made and the method should throw a BlockedException.- Specified by:
lookupCodeValue
in interfaceProcessorDataManager
- Throws:
BlockedException
TeiidComponentException
TeiidProcessingException
-
getEventDistributor
public EventDistributor getEventDistributor()
- Specified by:
getEventDistributor
in interfaceProcessorDataManager
-
setValidateAccess
public void setValidateAccess(boolean b)
-
isValidateAccess
public boolean isValidateAccess()
-
-