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
Modifier and TypeClassDescriptionstatic interface
Interface for creating different forms of hash expression types.static class
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
static final String
Implementation ofHashPrelUtil.HashExpressionCreatorHelper
forLogicalExpression
type. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T> T
createHash64Expression
(List<T> inputExprs, T seed, HashPrelUtil.HashExpressionCreatorHelper<T> helper, boolean hashAsDouble) Create hash expression based on the given input fields.static <T> T
createHashBasedPartitionExpression
(List<T> distFields, T seed, HashPrelUtil.HashExpressionCreatorHelper<T> helper) Create hash based partition expression based on the given distribution fields.static <T> T
createHashExpression
(List<T> inputExprs, T seed, HashPrelUtil.HashExpressionCreatorHelper<T> helper, boolean hashAsDouble) Create hash expression based on the given input fields.static LogicalExpression
getHash64Expression
(LogicalExpression field, LogicalExpression seed, boolean hashAsDouble) Creates hash expression for input field and seed.static LogicalExpression
getHashExpression
(List<DrillDistributionTrait.DistributionField> fields, org.apache.calcite.rel.type.RelDataType rowType) Create a distribution hash expression.static LogicalExpression
getHashExpression
(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.HashExpressionCreatorHelper
forLogicalExpression
type.
-
-
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 eitherRexNode
orLogicalExpression
- Parameters:
distFields
- Field list based on which the distribution partition expression is constructed.helper
- Implementation ofHashPrelUtil.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 eitherRexNode
orLogicalExpression
- Parameters:
inputExprs
- Expression list based on which the hash expression is constructed.helper
- Implementation ofHashPrelUtil.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 eitherRexNode
orLogicalExpression
- Parameters:
inputExprs
- Expression list based on which the hash expression is constructed.helper
- Implementation ofHashPrelUtil.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 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
-