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 voidcheckNotNull(ElementSymbol param, Object value, QueryMetadataInterface metadata)ProcessorPlanclone()Return a safe clone of the ProcessorPlan.voidclose()Close the plan after processing.voidexecutePlan(ProcessorPlan command, String rsName, Map<ElementSymbol,ElementSymbol> procAssignments, CreateCursorResultSetInstruction.Mode mode, boolean usesLocalTemp)CommandContextgetContext()Get the processor context, which can be modified.List<?>getCurrentRow(String rsName)VariableContextgetCurrentVariableContext()Get the currentVariavleContexton this environment.ProcessorDataManagergetDataManager()PlanNodegetDescriptionProperties()EventDistributorgetEventDistributor()ProgramgetOriginalProgram()ListgetOutputElements()Get list of resolved elements describing output columns for this plan.ListgetSchema(String rsName)Get the schema from the tuple source that represents the columns in a result setTempTableStoregetTempTableStore()voidincrementProgramCounter()voidinitialize(CommandContext context, ProcessorDataManager dataMgr, BufferManager buffer)Initialize the plan with some required pieces of data for making queries.protected booleanisBatchFull()booleanisValidateAccess()booleaniterateCursor(String rsName)ObjectlookupCodeValue(CommandContext context, String codeTableName, String returnElementName, String keyElementName, Object keyValue)Lookup a value from a cached code table.TupleBatchnextBatch()Get a batch of results or possibly an Exception.TupleBatchnextBatchDirect()voidopen()Open the plan for processing.Programpeek()voidpop(boolean success)protected TupleBatchpullBatch()voidpush(Program program)TupleSourceregisterRequest(CommandContext context, Command command, String modelName, RegisterRequestParameter parameterObject)voidremoveResults(String rsName)BooleanrequiresTransaction(boolean transactionalReads)voidreset()Reset a plan so that it can be processed again.booleanresultSetExists(String rsName)voidsetMetadata(QueryMetadataInterface metadata)voidsetOutParams(List<ElementSymbol> outParams)voidsetOutputElements(List outputElements)protected voidsetParameterValue(ElementSymbol param, VariableContext context, Object value)voidsetParams(LinkedHashMap<ElementSymbol,Expression> params)voidsetRunInContext(boolean runInContext)For procedures without explicit parameters, sets whether the procedure should run in the parent variable context.voidsetUpdateCount(int updateCount)voidsetValidateAccess(boolean b)protected voidterminateBatches()StringtoString()-
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:ProcessorPlanInitialize 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:
initializein classProcessorPlan- Parameters:
context- Process execution contextdataMgr- Data manager referencebuffer- Buffer manager reference
-
reset
public void reset()
Description copied from class:ProcessorPlanReset a plan so that it can be processed again.- Overrides:
resetin classProcessorPlan
-
getDataManager
public ProcessorDataManager getDataManager()
-
open
public void open() throws TeiidProcessingException, TeiidComponentExceptionDescription copied from class:ProcessorPlanOpen the plan for processing.- Specified by:
openin classProcessorPlan- Throws:
TeiidComponentExceptionTeiidProcessingException
-
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:ProcessorPlanGet a batch of results or possibly an Exception.- Specified by:
nextBatchin interfaceBatchCollector.BatchProducer- Specified by:
nextBatchin 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 TeiidComponentExceptionDescription copied from class:ProcessorPlanClose the plan after processing.- Specified by:
closein interfaceBatchCollector.BatchProducer- Specified by:
closein classProcessorPlan- Throws:
TeiidComponentException
-
clone
public ProcessorPlan clone()
Description copied from class:ProcessorPlanReturn 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 isopenedor after it isclosed.- Specified by:
clonein 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:
getDescriptionPropertiesin 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
VariavleContexton this environment. The VariableContext is updated with variables and their values byProgramInstructions 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:
TeiidComponentExceptionTeiidProcessingException
-
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:ProcessorPlanGet the processor context, which can be modified.- Overrides:
getContextin classProcessorPlan- Returns:
- context object
-
getOutputElements
public List getOutputElements()
Description copied from class:ProcessorPlanGet list of resolved elements describing output columns for this plan.- Specified by:
getOutputElementsin interfaceBatchCollector.BatchProducer- Specified by:
getOutputElementsin 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:
requiresTransactionin 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:
registerRequestin interfaceProcessorDataManager- Throws:
TeiidComponentExceptionTeiidProcessingException
-
lookupCodeValue
public Object lookupCodeValue(CommandContext context, String codeTableName, String returnElementName, String keyElementName, Object keyValue) throws BlockedException, TeiidComponentException, TeiidProcessingException
Description copied from interface:ProcessorDataManagerLookup 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:
lookupCodeValuein interfaceProcessorDataManager- Throws:
BlockedExceptionTeiidComponentExceptionTeiidProcessingException
-
getEventDistributor
public EventDistributor getEventDistributor()
- Specified by:
getEventDistributorin interfaceProcessorDataManager
-
setValidateAccess
public void setValidateAccess(boolean b)
-
isValidateAccess
public boolean isValidateAccess()
-
-