Class HashPrelUtil

java.lang.Object
org.apache.drill.exec.planner.physical.HashPrelUtil

public class HashPrelUtil extends Object
Contains utility methods for creating hash expression for either distribution (in PartitionSender) or for HashTable.
  • Field Details

  • Constructor Details

    • HashPrelUtil

      public HashPrelUtil()
  • Method Details

    • createHashBasedPartitionExpression

      public static <T> T createHashBasedPartitionExpression(List<T> distFields, T seed, HashPrelUtil.HashExpressionCreatorHelper<T> helper)
      Create hash based partition expression based on the given distribution fields.
      Type Parameters:
      T - Input and output expression type. Currently it could be either RexNode or LogicalExpression
      Parameters:
      distFields - Field list based on which the distribution partition expression is constructed.
      helper - Implementation of HashPrelUtil.HashExpressionCreatorHelper which is used to create function expressions.
      Returns:
    • createHashExpression

      public static <T> T createHashExpression(List<T> inputExprs, T seed, HashPrelUtil.HashExpressionCreatorHelper<T> helper, boolean hashAsDouble)
      Create hash expression based on the given input fields.
      Type Parameters:
      T - Input and output expression type. Currently it could be either RexNode or LogicalExpression
      Parameters:
      inputExprs - Expression list based on which the hash expression is constructed.
      helper - Implementation of HashPrelUtil.HashExpressionCreatorHelper which is used to create function expressions.
      hashAsDouble - Whether to use the hash as double function or regular hash64 function.
      Returns:
    • createHash64Expression

      public static <T> T createHash64Expression(List<T> inputExprs, T seed, HashPrelUtil.HashExpressionCreatorHelper<T> helper, boolean hashAsDouble)
      Create hash expression based on the given input fields.
      Type Parameters:
      T - Input and output expression type. Currently it could be either RexNode or LogicalExpression
      Parameters:
      inputExprs - Expression list based on which the hash expression is constructed.
      helper - Implementation of HashPrelUtil.HashExpressionCreatorHelper which is used to create function expressions.
      hashAsDouble - Whether to use the hash as double function or regular hash64 function.
      Returns:
    • getHash64Expression

      public static LogicalExpression getHash64Expression(LogicalExpression field, LogicalExpression seed, boolean hashAsDouble)
      Creates hash expression for input field and seed.
      Parameters:
      field - field expression
      seed - seed expression
      hashAsDouble - whether to use the hash as double function or regular hash64 function
      Returns:
      hash expression
    • getHashExpression

      public static LogicalExpression getHashExpression(LogicalExpression field, LogicalExpression seed, boolean hashAsDouble)
      Creates hash expression for input field and seed.
      Parameters:
      field - field expression
      seed - seed expression
      hashAsDouble - whether to use the hash as double function or regular hash64 function
      Returns:
      hash expression
    • getHashExpression

      public static LogicalExpression getHashExpression(List<DrillDistributionTrait.DistributionField> fields, org.apache.calcite.rel.type.RelDataType rowType)
      Create a distribution hash expression.
      Parameters:
      fields - Distribution fields
      rowType - Row type
      Returns:
      distribution hash expression