Class AbstractSingleMapBlock

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int bytesCompare​(int position, int offset, int length, io.airlift.slice.Slice otherSlice, int otherOffset, int otherLength)
      Compares the byte sequences at offset in the value at position to the byte sequence at otherOffset in otherSlice.
      boolean bytesEqual​(int position, int offset, io.airlift.slice.Slice otherSlice, int otherOffset, int length)
      Is the byte sequences at offset in the value at position equal to the byte sequence at otherOffset in otherSlice.
      int compareTo​(int position, int offset, int length, Block otherBlock, int otherPosition, int otherOffset, int otherLength)
      Compares the byte sequences at offset in the value at position to the byte sequence at otherOffset in the value at otherPosition in otherBlock.
      Block copyPositions​(int[] positions, int offset, int length)
      Returns a block containing the specified positions.
      Block copyRegion​(int position, int length)
      Returns a block starting at the specified position and extends for the specified length.
      boolean equals​(int position, int offset, Block otherBlock, int otherPosition, int otherOffset, int length)
      Is the byte sequences at offset in the value at position equal to the byte sequence at otherOffset in the value at otherPosition in otherBlock.
      byte getByte​(int position, int offset)
      Gets a byte at offset in the value at position.
      List<Block> getChildren()
      Gets the direct child blocks of this block.
      long getEstimatedDataSizeForStats​(int position)
      Returns the estimated in memory data size for stats of position.
      int getInt​(int position, int offset)
      Gets a little endian int at offset in the value at position.
      long getLong​(int position, int offset)
      Gets a little endian long at offset in the value at position.
      <T> T getObject​(int position, Class<T> clazz)
      Gets an object in the value at position.
      long getPositionsSizeInBytes​(boolean[] positions)
      Returns the size of of all positions marked true in the positions array.
      Block getRegion​(int positionOffset, int length)
      Returns a block starting at the specified position and extends for the specified length.
      long getRegionSizeInBytes​(int position, int length)
      Returns the size of block.getRegion(position, length).
      short getShort​(int position, int offset)
      Gets a little endian short at offset in the value at position.
      Block getSingleValueBlock​(int position)
      Gets the value at the specified position as a single element block.
      io.airlift.slice.Slice getSlice​(int position, int offset, int length)
      Gets a slice at offset in the value at position.
      int getSliceLength​(int position)
      Gets the length of the value at the position.
      long hash​(int position, int offset, int length)
      Calculates the hash code the byte sequences at offset in the value at position.
      boolean isNull​(int position)
      Is the specified position null?
      void writeBytesTo​(int position, int offset, int length, BlockBuilder blockBuilder)
      Appends the byte sequences at offset in the value at position to blockBuilder.
      void writePositionTo​(int position, BlockBuilder blockBuilder)
      Appends the value at position to blockBuilder and close the entry.
    • Constructor Detail

      • AbstractSingleMapBlock

        public AbstractSingleMapBlock()
    • Method Detail

      • getChildren

        public final List<Block> getChildren()
        Description copied from interface: Block
        Gets the direct child blocks of this block.
        Specified by:
        getChildren in interface Block
      • isNull

        public boolean isNull​(int position)
        Description copied from interface: Block
        Is the specified position null?
        Specified by:
        isNull in interface Block
      • getByte

        public byte getByte​(int position,
                            int offset)
        Description copied from interface: Block
        Gets a byte at offset in the value at position.
        Specified by:
        getByte in interface Block
      • getShort

        public short getShort​(int position,
                              int offset)
        Description copied from interface: Block
        Gets a little endian short at offset in the value at position.
        Specified by:
        getShort in interface Block
      • getInt

        public int getInt​(int position,
                          int offset)
        Description copied from interface: Block
        Gets a little endian int at offset in the value at position.
        Specified by:
        getInt in interface Block
      • getLong

        public long getLong​(int position,
                            int offset)
        Description copied from interface: Block
        Gets a little endian long at offset in the value at position.
        Specified by:
        getLong in interface Block
      • getSlice

        public io.airlift.slice.Slice getSlice​(int position,
                                               int offset,
                                               int length)
        Description copied from interface: Block
        Gets a slice at offset in the value at position.
        Specified by:
        getSlice in interface Block
      • getSliceLength

        public int getSliceLength​(int position)
        Description copied from interface: Block
        Gets the length of the value at the position. This method must be implemented if @{code getSlice} is implemented.
        Specified by:
        getSliceLength in interface Block
      • compareTo

        public int compareTo​(int position,
                             int offset,
                             int length,
                             Block otherBlock,
                             int otherPosition,
                             int otherOffset,
                             int otherLength)
        Description copied from interface: Block
        Compares the byte sequences at offset in the value at position to the byte sequence at otherOffset in the value at otherPosition in otherBlock. This method must be implemented if @{code getSlice} is implemented.
        Specified by:
        compareTo in interface Block
      • bytesEqual

        public boolean bytesEqual​(int position,
                                  int offset,
                                  io.airlift.slice.Slice otherSlice,
                                  int otherOffset,
                                  int length)
        Description copied from interface: Block
        Is the byte sequences at offset in the value at position equal to the byte sequence at otherOffset in otherSlice. This method must be implemented if @{code getSlice} is implemented.
        Specified by:
        bytesEqual in interface Block
      • bytesCompare

        public int bytesCompare​(int position,
                                int offset,
                                int length,
                                io.airlift.slice.Slice otherSlice,
                                int otherOffset,
                                int otherLength)
        Description copied from interface: Block
        Compares the byte sequences at offset in the value at position to the byte sequence at otherOffset in otherSlice. This method must be implemented if @{code getSlice} is implemented.
        Specified by:
        bytesCompare in interface Block
      • writeBytesTo

        public void writeBytesTo​(int position,
                                 int offset,
                                 int length,
                                 BlockBuilder blockBuilder)
        Description copied from interface: Block
        Appends the byte sequences at offset in the value at position to blockBuilder. This method must be implemented if @{code getSlice} is implemented.
        Specified by:
        writeBytesTo in interface Block
      • equals

        public boolean equals​(int position,
                              int offset,
                              Block otherBlock,
                              int otherPosition,
                              int otherOffset,
                              int length)
        Description copied from interface: Block
        Is the byte sequences at offset in the value at position equal to the byte sequence at otherOffset in the value at otherPosition in otherBlock. This method must be implemented if @{code getSlice} is implemented.
        Specified by:
        equals in interface Block
      • hash

        public long hash​(int position,
                         int offset,
                         int length)
        Description copied from interface: Block
        Calculates the hash code the byte sequences at offset in the value at position. This method must be implemented if @{code getSlice} is implemented.
        Specified by:
        hash in interface Block
      • getObject

        public <T> T getObject​(int position,
                               Class<T> clazz)
        Description copied from interface: Block
        Gets an object in the value at position.
        Specified by:
        getObject in interface Block
      • writePositionTo

        public void writePositionTo​(int position,
                                    BlockBuilder blockBuilder)
        Description copied from interface: Block
        Appends the value at position to blockBuilder and close the entry.
        Specified by:
        writePositionTo in interface Block
      • getSingleValueBlock

        public Block getSingleValueBlock​(int position)
        Description copied from interface: Block
        Gets the value at the specified position as a single element block. The method must copy the data into a new block.

        This method is useful for operators that hold on to a single value without holding on to the entire block.

        Specified by:
        getSingleValueBlock in interface Block
      • getEstimatedDataSizeForStats

        public long getEstimatedDataSizeForStats​(int position)
        Description copied from interface: Block
        Returns the estimated in memory data size for stats of position. Do not use it for other purpose.
        Specified by:
        getEstimatedDataSizeForStats in interface Block
      • getRegionSizeInBytes

        public long getRegionSizeInBytes​(int position,
                                         int length)
        Description copied from interface: Block
        Returns the size of block.getRegion(position, length). The method can be expensive. Do not use it outside an implementation of Block.
        Specified by:
        getRegionSizeInBytes in interface Block
      • getPositionsSizeInBytes

        public long getPositionsSizeInBytes​(boolean[] positions)
        Description copied from interface: Block
        Returns the size of of all positions marked true in the positions array. This is equivalent to multiple calls of block.getRegionSizeInBytes(position, length) where you mark all positions for the regions first.
        Specified by:
        getPositionsSizeInBytes in interface Block
      • copyPositions

        public Block copyPositions​(int[] positions,
                                   int offset,
                                   int length)
        Description copied from interface: Block
        Returns a block containing the specified positions. Positions to copy are stored in a subarray within positions array that starts at offset and has length of length. All specified positions must be valid for this block.

        The returned block must be a compact representation of the original block.

        Specified by:
        copyPositions in interface Block
      • getRegion

        public Block getRegion​(int positionOffset,
                               int length)
        Description copied from interface: Block
        Returns a block starting at the specified position and extends for the specified length. The specified region must be entirely contained within this block.

        The region can be a view over this block. If this block is released the region block may also be released. If the region block is released this block may also be released.

        Specified by:
        getRegion in interface Block
      • copyRegion

        public Block copyRegion​(int position,
                                int length)
        Description copied from interface: Block
        Returns a block starting at the specified position and extends for the specified length. The specified region must be entirely contained within this block.

        The region returned must be a compact representation of the original block, unless their internal representation will be exactly the same. This method is useful for operators that hold on to a range of values without holding on to the entire block.

        Specified by:
        copyRegion in interface Block