Package org.teiid.query.processor
Class QueryProcessor
- java.lang.Object
-
- org.teiid.query.processor.QueryProcessor
-
- All Implemented Interfaces:
BatchCollector.BatchProducer
public class QueryProcessor extends Object implements BatchCollector.BatchProducer
Driver for plan processing.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classQueryProcessor.ExpiredTimeSliceExceptionstatic interfaceQueryProcessor.ProcessorFactory
-
Constructor Summary
Constructors Constructor Description QueryProcessor(ProcessorPlan plan, CommandContext context, BufferManager bufferMgr, ProcessorDataManager dataMgr)Construct a processor with all necessary information to process.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()voidcloseProcessing()Close processing and clean everything up.BatchCollectorcreateBatchCollector()List<Exception>getAndClearWarnings()TupleBuffergetBuffer(int maxRows)return the final tuple buffer or null if not availableBufferManagergetBufferManager()CommandContextgetContext()ListgetOutputElements()Get list of resolved elements describing output columns for this plan.ProcessorDataManagergetProcessorDataManager()ProcessorPlangetProcessorPlan()booleanhasBuffer()voidinit()TupleBatchnextBatch()Get a batch of results or possibly an Exception.voidrequestCanceled()Asynch shutdown of the QueryProcessor, which may trigger exceptions in the processing threadvoidsetContinuous(PreparedPlan prepPlan, String query)voidsetNonBlocking(boolean nonBlocking)
-
-
-
Constructor Detail
-
QueryProcessor
public QueryProcessor(ProcessorPlan plan, CommandContext context, BufferManager bufferMgr, ProcessorDataManager dataMgr)
Construct a processor with all necessary information to process.- Parameters:
plan- The plan to processcontext- The context that this plan is being processed in. Should be cloned from the parent to properly scope the tuplebuffer cachebufferMgr- The buffer manager that provides access to tuple sourcesdataMgr- The data manager that provides access to get data
-
-
Method Detail
-
getContext
public CommandContext getContext()
-
getProcessorPlan
public ProcessorPlan getProcessorPlan()
-
nextBatch
public TupleBatch nextBatch() throws BlockedException, TeiidProcessingException, TeiidComponentException
Description copied from interface:BatchCollector.BatchProducerGet 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 yetTeiidProcessingException- for business rule exception, related to user input or modelingTeiidComponentException- for non-business rule exception
-
init
public void init() throws TeiidComponentException, TeiidProcessingException
-
closeProcessing
public void closeProcessing()
Close processing and clean everything up. Should only be called by the same thread that called process.
-
getOutputElements
public List getOutputElements()
Description copied from interface:BatchCollector.BatchProducerGet list of resolved elements describing output columns for this plan.- Specified by:
getOutputElementsin interfaceBatchCollector.BatchProducer- Returns:
- List of SingleElementSymbol
-
requestCanceled
public void requestCanceled()
Asynch shutdown of the QueryProcessor, which may trigger exceptions in the processing thread
-
createBatchCollector
public BatchCollector createBatchCollector() throws TeiidComponentException
- Throws:
TeiidComponentException
-
setNonBlocking
public void setNonBlocking(boolean nonBlocking)
-
getBuffer
public TupleBuffer getBuffer(int maxRows) throws BlockedException, TeiidComponentException, TeiidProcessingException
Description copied from interface:BatchCollector.BatchProducerreturn the final tuple buffer or null if not available- Specified by:
getBufferin interfaceBatchCollector.BatchProducer- Returns:
- Throws:
BlockedExceptionTeiidComponentExceptionTeiidProcessingException
-
hasBuffer
public boolean hasBuffer()
- Specified by:
hasBufferin interfaceBatchCollector.BatchProducer
-
getBufferManager
public BufferManager getBufferManager()
-
setContinuous
public void setContinuous(PreparedPlan prepPlan, String query)
-
close
public void close() throws TeiidComponentException- Specified by:
closein interfaceBatchCollector.BatchProducer- Throws:
TeiidComponentException
-
getProcessorDataManager
public ProcessorDataManager getProcessorDataManager()
-
-