Class JoinUtils
java.lang.Object
org.apache.drill.exec.physical.impl.join.JoinUtils
-
Nested Class Summary
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic 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.Creates new exception for queries that cannot be planned due to presence of cartesian or inequality join.static Comparator
static boolean
checkCartesianJoin
(org.apache.calcite.rel.RelNode relNode) Check if the given RelNode contains any Cartesian join.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.static JoinUtils.JoinCategory
getJoinCategory
(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 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.static boolean
isScalarSubquery
(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
-
JoinUtils
public JoinUtils()
-
-
Method Details
-
checkAndReturnSupportedJoinComparator
-
checkCartesianJoin
public 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
-
checkCartesianJoin
public 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
-RelNode
instance to be inspected- Returns:
- Return true if the given relNode contains Cartesian join. Otherwise, return false
-
addLeastRestrictiveCasts
public 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 joinleftBatch
- left input record batchrightExpressions
- array of expressions from right input into the joinrightBatch
- right input record batchcontext
- fragment context
-
isScalarSubquery
public 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
-
hasScalarSubqueryInput
public 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
-
cartesianJoinPlanningException
Creates new exception for queries that cannot be planned due to presence of cartesian or inequality join.- Returns:
- new
UnsupportedRelOperatorException
instance
-