Class HashPrelUtil
java.lang.Object
org.apache.drill.exec.planner.physical.HashPrelUtil
Contains utility methods for creating hash expression for either distribution (in PartitionSender) or for HashTable.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceInterface for creating different forms of hash expression types.static class -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final StringImplementation ofHashPrelUtil.HashExpressionCreatorHelperforLogicalExpressiontype. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> TcreateHash64Expression(List<T> inputExprs, T seed, HashPrelUtil.HashExpressionCreatorHelper<T> helper, boolean hashAsDouble) Create hash expression based on the given input fields.static <T> TcreateHashBasedPartitionExpression(List<T> distFields, T seed, HashPrelUtil.HashExpressionCreatorHelper<T> helper) Create hash based partition expression based on the given distribution fields.static <T> TcreateHashExpression(List<T> inputExprs, T seed, HashPrelUtil.HashExpressionCreatorHelper<T> helper, boolean hashAsDouble) Create hash expression based on the given input fields.static LogicalExpressiongetHash64Expression(LogicalExpression field, LogicalExpression seed, boolean hashAsDouble) Creates hash expression for input field and seed.static LogicalExpressiongetHashExpression(List<DrillDistributionTrait.DistributionField> fields, org.apache.calcite.rel.type.RelDataType rowType) Create a distribution hash expression.static LogicalExpressiongetHashExpression(LogicalExpression field, LogicalExpression seed, boolean hashAsDouble) Creates hash expression for input field and seed.
-
Field Details
-
HASH_EXPR_NAME
- See Also:
-
DIST_SEED
public static final int DIST_SEED- See Also:
-
HASH_HELPER_LOGICAL_EXPRESSION
public static HashPrelUtil.HashExpressionCreatorHelper<LogicalExpression> HASH_HELPER_LOGICAL_EXPRESSIONImplementation ofHashPrelUtil.HashExpressionCreatorHelperforLogicalExpressiontype.
-
-
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 eitherRexNodeorLogicalExpression- Parameters:
distFields- Field list based on which the distribution partition expression is constructed.helper- Implementation ofHashPrelUtil.HashExpressionCreatorHelperwhich 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 eitherRexNodeorLogicalExpression- Parameters:
inputExprs- Expression list based on which the hash expression is constructed.helper- Implementation ofHashPrelUtil.HashExpressionCreatorHelperwhich 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 eitherRexNodeorLogicalExpression- Parameters:
inputExprs- Expression list based on which the hash expression is constructed.helper- Implementation ofHashPrelUtil.HashExpressionCreatorHelperwhich 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 expressionseed- seed expressionhashAsDouble- 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 expressionseed- seed expressionhashAsDouble- 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 fieldsrowType- Row type- Returns:
- distribution hash expression
-