Class DeviceViewOperator

  • All Implemented Interfaces:
    java.lang.AutoCloseable, Operator, ProcessOperator

    public class DeviceViewOperator
    extends java.lang.Object
    implements ProcessOperator
    Since devices have been sorted by the merge order as expected, what DeviceViewOperator need to do is traversing the device child operators, get all tsBlocks of one device and transform it to the form we need, adding the device column and allocating value column to its expected location, then get the next device operator until no next device.

    The deviceOperators can be timeJoinOperator or seriesScanOperator that have not transformed the result form.

    Attention! If some columns are not existing in one device, those columns will be null. e.g. [s1,s2,s3] is query, but only [s1, s3] exists in device1, then the column of s2 will be filled with NullColumn.

    • Field Summary

    • Constructor Summary

      Constructors 
      Constructor Description
      DeviceViewOperator​(OperatorContext operatorContext, java.util.List<java.lang.String> devices, java.util.List<Operator> deviceOperators, java.util.List<java.util.List<java.lang.Integer>> deviceColumnIndex, java.util.List<org.apache.iotdb.tsfile.file.metadata.enums.TSDataType> dataTypes)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      long calculateMaxPeekMemory()
      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(), ....)
      long calculateMaxReturnSize()  
      long calculateRetainedSizeAfterCallingNext()  
      void close()
      This method will always be called before releasing the Operator reference.
      OperatorContext getOperatorContext()  
      boolean hasNext()  
      com.google.common.util.concurrent.ListenableFuture<?> isBlocked()
      Returns a future that will be completed when the operator becomes unblocked.
      boolean isFinished()
      Is this operator completely finished processing and no more output TsBlock will be produced.
      org.apache.iotdb.tsfile.read.common.block.TsBlock next()
      Gets next tsBlock from this operator.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • DeviceViewOperator

        public DeviceViewOperator​(OperatorContext operatorContext,
                                  java.util.List<java.lang.String> devices,
                                  java.util.List<Operator> deviceOperators,
                                  java.util.List<java.util.List<java.lang.Integer>> deviceColumnIndex,
                                  java.util.List<org.apache.iotdb.tsfile.file.metadata.enums.TSDataType> dataTypes)
    • Method Detail

      • isBlocked

        public com.google.common.util.concurrent.ListenableFuture<?> isBlocked()
        Description copied from interface: Operator
        Returns a future that will be completed when the operator becomes unblocked. If the operator is not blocked, this method should return NOT_BLOCKED.
        Specified by:
        isBlocked in interface Operator
      • next

        public org.apache.iotdb.tsfile.read.common.block.TsBlock next()
        Description copied from interface: Operator
        Gets next tsBlock from this operator. If no data is currently available, return null.
        Specified by:
        next in interface Operator
      • hasNext

        public boolean hasNext()
        Specified by:
        hasNext in interface Operator
        Returns:
        true if the operator has more data, otherwise false
      • close

        public void close()
                   throws java.lang.Exception
        Description copied from interface: Operator
        This method will always be called before releasing the Operator reference.
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface Operator
        Throws:
        java.lang.Exception
      • isFinished

        public boolean isFinished()
        Description copied from interface: Operator
        Is this operator completely finished processing and no more output TsBlock will be produced.
        Specified by:
        isFinished in interface Operator
      • calculateMaxPeekMemory

        public long calculateMaxPeekMemory()
        Description copied from interface: Operator
        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(), ....)

        Each operator's MaxPeekMemory should also take retained size of each child operator into account.

        Specified by:
        calculateMaxPeekMemory in interface Operator
        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:
        calculateMaxReturnSize in interface Operator
        Returns:
        estimated max memory footprint for returned TsBlock when calling operator.next()
      • calculateRetainedSizeAfterCallingNext

        public long calculateRetainedSizeAfterCallingNext()
        Specified by:
        calculateRetainedSizeAfterCallingNext in interface Operator
        Returns:
        each operator's retained size(including all its children's retained size) after calling its next() method