Class JoinUtils
java.lang.Object
org.apache.drill.exec.physical.impl.join.JoinUtils
- 
Nested Class SummaryNested Classes
- 
Field SummaryFields
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionstatic voidaddLeastRestrictiveCasts(LogicalExpression[] leftExpressions, VectorAccessible leftBatch, LogicalExpression[] rightExpressions, VectorAccessible rightBatch, FragmentContext context) Utility method used by joins to add implicit casts on one of the sides of the join condition in case the two expressions have different types.Creates new exception for queries that cannot be planned due to presence of cartesian or inequality join.static Comparatorstatic booleancheckCartesianJoin(org.apache.calcite.rel.RelNode relNode) Check if the given RelNode contains any Cartesian join.static booleancheckCartesianJoin(org.apache.calcite.rel.RelNode relNode, List<Integer> leftKeys, List<Integer> rightKeys, List<Boolean> filterNulls) Check if the given RelNode contains any Cartesian join.static JoinUtils.JoinCategorygetJoinCategory(org.apache.calcite.rel.RelNode left, org.apache.calcite.rel.RelNode right, org.apache.calcite.rex.RexNode condition, List<Integer> leftKeys, List<Integer> rightKeys, List<Boolean> filterNulls) static booleanhasScalarSubqueryInput(org.apache.calcite.rel.RelNode left, org.apache.calcite.rel.RelNode right) Utility method to check if a any of input RelNodes is provably scalar.static booleanisScalarSubquery(org.apache.calcite.rel.RelNode root) Utility method to check if a subquery (represented by its root RelNode) is provably scalar.
- 
Field Details- 
FAILED_TO_PLAN_CARTESIAN_JOIN
 
- 
- 
Constructor Details- 
JoinUtilspublic JoinUtils()
 
- 
- 
Method Details- 
checkAndReturnSupportedJoinComparator
- 
checkCartesianJoinpublic static boolean checkCartesianJoin(org.apache.calcite.rel.RelNode relNode, List<Integer> leftKeys, List<Integer> rightKeys, List<Boolean> filterNulls) Check if the given RelNode contains any Cartesian join. Return true if find one. Otherwise, return false.- Parameters:
- relNode- the RelNode to be inspected.
- leftKeys- a list used for the left input into the join which has equi-join keys. It can be empty or not (but not null), this method will clear this list before using it.
- rightKeys- a list used for the right input into the join which has equi-join keys. It can be empty or not (but not null), this method will clear this list before using it.
- filterNulls- The join key positions for which null values will not match.
- Returns:
- Return true if the given relNode contains Cartesian join. Otherwise, return false
 
- 
checkCartesianJoinpublic static boolean checkCartesianJoin(org.apache.calcite.rel.RelNode relNode) Check if the given RelNode contains any Cartesian join. Return true if find one. Otherwise, return false.- Parameters:
- relNode-- RelNodeinstance to be inspected
- Returns:
- Return true if the given relNode contains Cartesian join. Otherwise, return false
 
- 
addLeastRestrictiveCastspublic static void addLeastRestrictiveCasts(LogicalExpression[] leftExpressions, VectorAccessible leftBatch, LogicalExpression[] rightExpressions, VectorAccessible rightBatch, FragmentContext context) Utility method used by joins to add implicit casts on one of the sides of the join condition in case the two expressions have different types.- Parameters:
- leftExpressions- array of expressions from left input into the join
- leftBatch- left input record batch
- rightExpressions- array of expressions from right input into the join
- rightBatch- right input record batch
- context- fragment context
 
- 
isScalarSubquerypublic static boolean isScalarSubquery(org.apache.calcite.rel.RelNode root) Utility method to check if a subquery (represented by its root RelNode) is provably scalar. Currently only aggregates with no group-by are considered scalar. In the future, this method should be generalized to include more cases and reconciled with Calcite's notion of scalar.- Parameters:
- root- The root RelNode to be examined
- Returns:
- True if the root rel or its descendant is scalar, False otherwise
 
- 
getJoinCategory
- 
hasScalarSubqueryInputpublic static boolean hasScalarSubqueryInput(org.apache.calcite.rel.RelNode left, org.apache.calcite.rel.RelNode right) Utility method to check if a any of input RelNodes is provably scalar.- Parameters:
- left- the RelNode to be inspected.
- right- the RelNode to be inspected.
- Returns:
- Return true if any of the given RelNodes is provably scalar. Otherwise, return false
 
- 
cartesianJoinPlanningExceptionCreates new exception for queries that cannot be planned due to presence of cartesian or inequality join.- Returns:
- new UnsupportedRelOperatorExceptioninstance
 
 
-