Class TransferableBlock

  • All Implemented Interfaces:
    Block

    public class TransferableBlock
    extends Object
    implements Block
    A TransferableBlock is a wrapper around DataBlock for transferring data using Mailbox.
    • Method Detail

      • getNumRows

        public int getNumRows()
      • getDataSchema

        public DataSchema getDataSchema()
      • getContainer

        public List<Object[]> getContainer()
        Retrieve the extracted _container of the transferable block. If not already constructed. It will use DataBlockUtils to extract the row/columnar data from the binary-packed format.
        Returns:
        data container.
      • getDataBlock

        public DataBlock getDataBlock()
        Retrieve the binary-packed version of the data block. If not already constructed. It will use DataBlockBuilder to construct the binary-packed format from the _container.
        Returns:
        data block.
      • addException

        public void addException​(int errCode,
                                 String errMsg)
      • getType

        public DataBlock.Type getType()
        Return the type of block (one of ROW, COLUMNAR, or METADATA).
        Returns:
        return type of block
      • isEndOfStreamBlock

        public boolean isEndOfStreamBlock()
        Return whether a transferable block is at the end of a stream.

        End of stream is different from data block with 0-rows. which can indicate that one partition of the execution returns no rows. but that doesn't mean the rest of the partitions are also finished.

        When an exception is caught within a stream, no matter how many outstanding data is pending to be received, it is considered end of stream because the exception should bubble up immediately.

        Returns:
        whether this block is the end of stream.
      • isSuccessfulEndOfStreamBlock

        public boolean isSuccessfulEndOfStreamBlock()
        Returns:
        true when the block is a real end of stream block instead of error block.
      • isDataBlock

        public boolean isDataBlock()
      • isErrorBlock

        public boolean isErrorBlock()
        Return whether a transferable block contains exception.
        Returns:
        true if contains exception.