Class SingleInputAggregationOperator
- java.lang.Object
-
- org.apache.iotdb.db.mpp.execution.operator.process.SingleInputAggregationOperator
-
- All Implemented Interfaces:
java.lang.AutoCloseable,Operator,ProcessOperator
- Direct Known Subclasses:
RawDataAggregationOperator,SlidingWindowAggregationOperator
public abstract class SingleInputAggregationOperator extends java.lang.Object implements ProcessOperator
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.List<Aggregator>aggregatorsprotected booleanascendingprotected booleancanCallNextprotected Operatorchildprotected org.apache.iotdb.tsfile.read.common.TimeRangecurTimeRangeprotected org.apache.iotdb.tsfile.read.common.block.TsBlockinputTsBlockprotected longmaxRetainedSizeprotected longmaxReturnSizeprotected OperatorContextoperatorContextprotected org.apache.iotdb.tsfile.read.common.block.TsBlockBuilderresultTsBlockBuilderprotected ITimeRangeIteratortimeRangeIterator-
Fields inherited from interface org.apache.iotdb.db.mpp.execution.operator.Operator
NOT_BLOCKED
-
-
Constructor Summary
Constructors Constructor Description SingleInputAggregationOperator(OperatorContext operatorContext, java.util.List<Aggregator> aggregators, Operator child, boolean ascending, ITimeRangeIterator timeRangeIterator, long maxReturnSize)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description longcalculateMaxPeekMemory()We should also consider the memory used by its children operator, so the calculation logic may be like: long estimatedOfCurrentOperator = XXXXX; return max(estimatedOfCurrentOperator, child1.calculateMaxPeekMemory(), child2.calculateMaxPeekMemory(), ....)longcalculateMaxReturnSize()protected abstract booleancalculateNextAggregationResult()longcalculateRetainedSizeAfterCallingNext()voidclose()This method will always be called before releasing the Operator reference.OperatorContextgetOperatorContext()booleanhasNext()com.google.common.util.concurrent.ListenableFuture<?>isBlocked()Returns a future that will be completed when the operator becomes unblocked.booleanisFinished()Is this operator completely finished processing and no more output TsBlock will be produced.org.apache.iotdb.tsfile.read.common.block.TsBlocknext()Gets next tsBlock from this operator.protected voidupdateResultTsBlock()
-
-
-
Field Detail
-
operatorContext
protected final OperatorContext operatorContext
-
ascending
protected final boolean ascending
-
child
protected final Operator child
-
inputTsBlock
protected org.apache.iotdb.tsfile.read.common.block.TsBlock inputTsBlock
-
canCallNext
protected boolean canCallNext
-
timeRangeIterator
protected final ITimeRangeIterator timeRangeIterator
-
curTimeRange
protected org.apache.iotdb.tsfile.read.common.TimeRange curTimeRange
-
aggregators
protected final java.util.List<Aggregator> aggregators
-
resultTsBlockBuilder
protected final org.apache.iotdb.tsfile.read.common.block.TsBlockBuilder resultTsBlockBuilder
-
maxRetainedSize
protected final long maxRetainedSize
-
maxReturnSize
protected final long maxReturnSize
-
-
Constructor Detail
-
SingleInputAggregationOperator
public SingleInputAggregationOperator(OperatorContext operatorContext, java.util.List<Aggregator> aggregators, Operator child, boolean ascending, ITimeRangeIterator timeRangeIterator, long maxReturnSize)
-
-
Method Detail
-
getOperatorContext
public OperatorContext getOperatorContext()
- Specified by:
getOperatorContextin interfaceOperator
-
isBlocked
public com.google.common.util.concurrent.ListenableFuture<?> isBlocked()
Description copied from interface:OperatorReturns a future that will be completed when the operator becomes unblocked. If the operator is not blocked, this method should returnNOT_BLOCKED.
-
hasNext
public boolean hasNext()
-
next
public org.apache.iotdb.tsfile.read.common.block.TsBlock next()
Description copied from interface:OperatorGets next tsBlock from this operator. If no data is currently available, return null.
-
isFinished
public boolean isFinished()
Description copied from interface:OperatorIs this operator completely finished processing and no more output TsBlock will be produced.- Specified by:
isFinishedin interfaceOperator
-
close
public void close() throws java.lang.ExceptionDescription copied from interface:OperatorThis method will always be called before releasing the Operator reference.
-
calculateNextAggregationResult
protected abstract boolean calculateNextAggregationResult()
-
updateResultTsBlock
protected void updateResultTsBlock()
-
calculateMaxPeekMemory
public long calculateMaxPeekMemory()
Description copied from interface:OperatorWe should also consider the memory used by its children operator, so the calculation logic may be like: long estimatedOfCurrentOperator = XXXXX; return max(estimatedOfCurrentOperator, child1.calculateMaxPeekMemory(), child2.calculateMaxPeekMemory(), ....)Each operator's MaxPeekMemory should also take retained size of each child operator into account.
- Specified by:
calculateMaxPeekMemoryin interfaceOperator- Returns:
- estimated max memory footprint that the Operator Tree(rooted from this operator) will use while doing its own query processing
-
calculateMaxReturnSize
public long calculateMaxReturnSize()
- Specified by:
calculateMaxReturnSizein interfaceOperator- Returns:
- estimated max memory footprint for returned TsBlock when calling operator.next()
-
calculateRetainedSizeAfterCallingNext
public long calculateRetainedSizeAfterCallingNext()
- Specified by:
calculateRetainedSizeAfterCallingNextin interfaceOperator- Returns:
- each operator's retained size(including all its children's retained size) after calling its next() method
-
-