Class SimplePagesHashStrategy

java.lang.Object
io.trino.operator.SimplePagesHashStrategy
All Implemented Interfaces:
PagesHashStrategy

public class SimplePagesHashStrategy extends Object implements PagesHashStrategy
  • Constructor Summary

    Constructors
    Constructor
    Description
    SimplePagesHashStrategy(List<Type> types, List<Integer> outputChannels, List<it.unimi.dsi.fastutil.objects.ObjectArrayList<Block>> channels, List<Integer> hashChannels, OptionalInt precomputedHashChannel, Optional<Integer> sortChannel, BlockTypeOperators blockTypeOperators)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    appendTo(int blockIndex, int position, PageBuilder pageBuilder, int outputChannelOffset)
    Appends all values at the specified position to the page builder starting at outputChannelOffset.
    int
    compareSortChannelPositions(int leftBlockIndex, int leftBlockPosition, int rightBlockIndex, int rightBlockPosition)
    Compares sort channel (if applicable) values at the specified positions.
    int
    Gets the number of columns appended by this PagesHashStrategy.
    long
    Get the total of allocated size
    long
    hashPosition(int blockIndex, int position)
    Calculates the hash code the hashed columns in this PagesHashStrategy at the specified position.
    long
    hashRow(int position, Page page)
    Calculates the hash code at position in page.
    boolean
    isPositionNull(int blockIndex, int blockPosition)
    Checks if any of the hashed columns is null
    boolean
    isSortChannelPositionNull(int blockIndex, int blockPosition)
    Checks if sort channel is null at the specified position
    boolean
    positionEqualsPosition(int leftBlockIndex, int leftPosition, int rightBlockIndex, int rightPosition)
    Compares the hashed columns in this PagesHashStrategy at the specified positions.
    boolean
    positionEqualsPositionIgnoreNulls(int leftBlockIndex, int leftPosition, int rightBlockIndex, int rightPosition)
    Compares the hashed columns in this PagesHashStrategy at the specified positions.
    boolean
    positionEqualsRow(int leftBlockIndex, int leftPosition, int rightPosition, Page rightPage)
    Compares the hashed columns in this PagesHashStrategy to the values in the specified page.
    boolean
    positionEqualsRowIgnoreNulls(int leftBlockIndex, int leftPosition, int rightPosition, Page rightPage)
    Compares the hashed columns in this PagesHashStrategy to the values in the specified page.
    boolean
    positionNotDistinctFromPosition(int leftBlockIndex, int leftPosition, int rightBlockIndex, int rightPosition)
    Compares the hashed columns in this PagesHashStrategy at the specified positions.
    boolean
    positionNotDistinctFromRow(int leftBlockIndex, int leftPosition, int rightPosition, Page rightPage)
    Compares the hashed columns in this PagesHashStrategy to the values in the specified page.
    boolean
    positionNotDistinctFromRow(int leftBlockIndex, int leftPosition, int rightPosition, Page page, int[] rightChannels)
    Compares the hashed columns in this PagesHashStrategy to the hashed columns in the Page.
    boolean
    rowEqualsRow(int leftPosition, Page leftPage, int rightPosition, Page rightPage)
    Compares the values in the specified pages.
    boolean
    rowNotDistinctFromRow(int leftPosition, Page leftPage, int rightPosition, Page rightPage)
    Compares the values in the specified pages.

    Methods inherited from class java.lang.Object

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

  • Method Details

    • getChannelCount

      public int getChannelCount()
      Description copied from interface: PagesHashStrategy
      Gets the number of columns appended by this PagesHashStrategy.
      Specified by:
      getChannelCount in interface PagesHashStrategy
    • getSizeInBytes

      public long getSizeInBytes()
      Description copied from interface: PagesHashStrategy
      Get the total of allocated size
      Specified by:
      getSizeInBytes in interface PagesHashStrategy
    • appendTo

      public void appendTo(int blockIndex, int position, PageBuilder pageBuilder, int outputChannelOffset)
      Description copied from interface: PagesHashStrategy
      Appends all values at the specified position to the page builder starting at outputChannelOffset.
      Specified by:
      appendTo in interface PagesHashStrategy
    • hashPosition

      public long hashPosition(int blockIndex, int position)
      Description copied from interface: PagesHashStrategy
      Calculates the hash code the hashed columns in this PagesHashStrategy at the specified position.
      Specified by:
      hashPosition in interface PagesHashStrategy
    • hashRow

      public long hashRow(int position, Page page)
      Description copied from interface: PagesHashStrategy
      Calculates the hash code at position in page. Page must have the same number of Blocks as the hashed columns and each entry is expected to be the same type.
      Specified by:
      hashRow in interface PagesHashStrategy
    • rowEqualsRow

      public boolean rowEqualsRow(int leftPosition, Page leftPage, int rightPosition, Page rightPage)
      Description copied from interface: PagesHashStrategy
      Compares the values in the specified pages. The values are compared positionally, so leftPage and rightPage must have the same number of entries as the hashed columns and each entry is expected to be the same type.
      Specified by:
      rowEqualsRow in interface PagesHashStrategy
    • rowNotDistinctFromRow

      public boolean rowNotDistinctFromRow(int leftPosition, Page leftPage, int rightPosition, Page rightPage)
      Description copied from interface: PagesHashStrategy
      Compares the values in the specified pages. The values are compared positionally, so leftPage and rightPage must have the same number of entries as the hashed columns and each entry is expected to be the same type. The values are compared under "not distinct from" semantics.
      Specified by:
      rowNotDistinctFromRow in interface PagesHashStrategy
    • positionEqualsRow

      public boolean positionEqualsRow(int leftBlockIndex, int leftPosition, int rightPosition, Page rightPage)
      Description copied from interface: PagesHashStrategy
      Compares the hashed columns in this PagesHashStrategy to the values in the specified page. The values are compared positionally, so rightPage must have the same number of entries as the hashed columns and each entry is expected to be the same type. rightPage is used if join uses filter function and must contain all columns from probe side of join.
      Specified by:
      positionEqualsRow in interface PagesHashStrategy
    • positionNotDistinctFromRow

      public boolean positionNotDistinctFromRow(int leftBlockIndex, int leftPosition, int rightPosition, Page rightPage)
      Description copied from interface: PagesHashStrategy
      Compares the hashed columns in this PagesHashStrategy to the values in the specified page. The values are compared positionally, so rightPage must have the same number of entries as the hashed columns and each entry is expected to be the same type. rightPage is used if join uses filter function and must contain all columns from probe side of join. The values are compared under "not distinct from" semantics.
      Specified by:
      positionNotDistinctFromRow in interface PagesHashStrategy
    • positionEqualsRowIgnoreNulls

      public boolean positionEqualsRowIgnoreNulls(int leftBlockIndex, int leftPosition, int rightPosition, Page rightPage)
      Description copied from interface: PagesHashStrategy
      Compares the hashed columns in this PagesHashStrategy to the values in the specified page. The values are compared positionally, so rightPage must have the same number of entries as the hashed columns and each entry is expected to be the same type. rightPage is used if join uses filter function and must contain all columns from probe side of join.

      This method does not perform any null checks.

      Specified by:
      positionEqualsRowIgnoreNulls in interface PagesHashStrategy
    • positionNotDistinctFromRow

      public boolean positionNotDistinctFromRow(int leftBlockIndex, int leftPosition, int rightPosition, Page page, int[] rightChannels)
      Description copied from interface: PagesHashStrategy
      Compares the hashed columns in this PagesHashStrategy to the hashed columns in the Page. The values are compared positionally under "not distinct from" semantics. rightChannels must have the same number of entries as the hashed columns and each entry is expected to be the same type.
      Specified by:
      positionNotDistinctFromRow in interface PagesHashStrategy
    • positionEqualsPosition

      public boolean positionEqualsPosition(int leftBlockIndex, int leftPosition, int rightBlockIndex, int rightPosition)
      Description copied from interface: PagesHashStrategy
      Compares the hashed columns in this PagesHashStrategy at the specified positions.
      Specified by:
      positionEqualsPosition in interface PagesHashStrategy
    • positionNotDistinctFromPosition

      public boolean positionNotDistinctFromPosition(int leftBlockIndex, int leftPosition, int rightBlockIndex, int rightPosition)
      Description copied from interface: PagesHashStrategy
      Compares the hashed columns in this PagesHashStrategy at the specified positions. The values are compared under "not distinct from" semantics.
      Specified by:
      positionNotDistinctFromPosition in interface PagesHashStrategy
    • positionEqualsPositionIgnoreNulls

      public boolean positionEqualsPositionIgnoreNulls(int leftBlockIndex, int leftPosition, int rightBlockIndex, int rightPosition)
      Description copied from interface: PagesHashStrategy
      Compares the hashed columns in this PagesHashStrategy at the specified positions.

      This method does not perform any null checks.

      Specified by:
      positionEqualsPositionIgnoreNulls in interface PagesHashStrategy
    • isPositionNull

      public boolean isPositionNull(int blockIndex, int blockPosition)
      Description copied from interface: PagesHashStrategy
      Checks if any of the hashed columns is null
      Specified by:
      isPositionNull in interface PagesHashStrategy
    • compareSortChannelPositions

      public int compareSortChannelPositions(int leftBlockIndex, int leftBlockPosition, int rightBlockIndex, int rightBlockPosition)
      Description copied from interface: PagesHashStrategy
      Compares sort channel (if applicable) values at the specified positions.
      Specified by:
      compareSortChannelPositions in interface PagesHashStrategy
    • isSortChannelPositionNull

      public boolean isSortChannelPositionNull(int blockIndex, int blockPosition)
      Description copied from interface: PagesHashStrategy
      Checks if sort channel is null at the specified position
      Specified by:
      isSortChannelPositionNull in interface PagesHashStrategy