Class Join
- All Implemented Interfaces:
Cloneable,RelOptNode,Hintable,RelNode
- Direct Known Subclasses:
AsofJoin,Bindables.BindableJoin,EnumerableBatchNestedLoopJoin,EnumerableHashJoin,EnumerableMergeJoin,EnumerableNestedLoopJoin,EquiJoin,JdbcRules.JdbcJoin,LogicalJoin,PigJoin
Each output row has columns from the left and right inputs. The set of output rows is a subset of the cartesian product of the two inputs; precisely which subset depends on the join condition.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.calcite.rel.RelNode
RelNode.Context -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final RexNodeprotected final com.google.common.collect.ImmutableList<RelHint>protected final JoinInfoprotected final JoinRelTypeValues must be of enumerationJoinRelType, except thatJoinRelType.RIGHTis disallowed.protected final com.google.common.collect.ImmutableSet<CorrelationId>Fields inherited from class org.apache.calcite.rel.AbstractRelNode
digest, id, rowType, traitSet -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedJoin(RelOptCluster cluster, RelTraitSet traitSet, List<RelHint> hints, RelNode left, RelNode right, RexNode condition, Set<CorrelationId> variablesSet, JoinRelType joinType) Creates a Join.protectedJoin(RelOptCluster cluster, RelTraitSet traitSet, RelNode left, RelNode right, RexNode condition, Set<CorrelationId> variablesSet, JoinRelType joinType) Deprecated.protectedJoin(RelOptCluster cluster, RelTraitSet traitSet, RelNode left, RelNode right, RexNode condition, JoinRelType joinType, Set<String> variablesStopped) Deprecated. -
Method Summary
Modifier and TypeMethodDescriptionaccept(RexShuttle shuttle) Accepts a visit from a shuttle.Analyzes the join condition.@Nullable RelOptCostcomputeSelfCost(RelOptPlanner planner, RelMetadataQuery mq) Returns the cost of this plan (not including children).copy(RelTraitSet traitSet, List<RelNode> inputs) Creates a copy of this relational expression, perhaps changing traits and inputs.abstract Joincopy(RelTraitSet traitSet, RexNode conditionExpr, RelNode left, RelNode right, JoinRelType joinType, boolean semiJoinDone) Creates a copy of this join, overriding condition, system fields and inputs.static RelDataTypecreateJoinType(RelDataTypeFactory typeFactory, RelDataType leftType, RelDataType rightType, List<String> fieldNameList, List<RelDataTypeField> systemFieldList) Deprecated.protected booleandeepEquals0(@Nullable Object obj) protected intstatic RelDataTypederiveJoinRowType(RelDataType leftType, RelDataType rightType, JoinRelType joinType, RelDataTypeFactory typeFactory, @Nullable List<String> fieldNameList, List<RelDataTypeField> systemFieldList) Deprecated.protected RelDataTypestatic doubleestimateJoinedRows(Join joinRel, RexNode condition) Deprecated.doubleReturns an estimate of the number of rows this relational expression will return.Describes the inputs and attributes of this relational expression.com.google.common.collect.ImmutableList<RelHint>getHints()Returns the hints of this relational expressions as an immutable list.Returns a list of system fields that will be prefixed to output row type.Returns the variables that are set in this relational expression but also used and therefore not available to parents of this relational expression.booleanReturns whether this Join is a semijoin.booleanReturns whether this LogicalJoin has already spawned aSemiJoinviaJoinAddRedundantSemiJoinRule.booleanisValid(Litmus litmus, @Nullable RelNode.Context context) Returns whether this relational expression is valid.Methods inherited from class org.apache.calcite.rel.BiRel
childrenAccept, getInputs, getLeft, getRight, replaceInputMethods inherited from class org.apache.calcite.rel.AbstractRelNode
accept, collectVariablesSet, collectVariablesUsed, deepEquals, deepHashCode, equals, explain, getCluster, getConvention, getCorrelVariable, getDescription, getDigest, getExpectedInputRowType, getId, getInput, getRelDigest, getRelTypeName, getRowType, getTable, getTraitSet, hashCode, isEnforcer, metadata, onRegister, recomputeDigest, register, sole, toStringMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.calcite.rel.hint.Hintable
attachHints, withHintsMethods inherited from interface org.apache.calcite.rel.RelNode
explain, fieldIsNullable, stripped
-
Field Details
-
condition
-
variablesSet
-
hints
-
joinType
Values must be of enumerationJoinRelType, except thatJoinRelType.RIGHTis disallowed. -
joinInfo
-
-
Constructor Details
-
Join
protected Join(RelOptCluster cluster, RelTraitSet traitSet, List<RelHint> hints, RelNode left, RelNode right, RexNode condition, Set<CorrelationId> variablesSet, JoinRelType joinType) Creates a Join.- Parameters:
cluster- ClustertraitSet- Trait sethints- Hintsleft- Left inputright- Right inputcondition- Join conditionvariablesSet- variables that are set by the LHS and used by the RHS and are not available to nodes above this Join in the treejoinType- Join type
-
Join
@Deprecated protected Join(RelOptCluster cluster, RelTraitSet traitSet, RelNode left, RelNode right, RexNode condition, Set<CorrelationId> variablesSet, JoinRelType joinType) Deprecated. -
Join
@Deprecated protected Join(RelOptCluster cluster, RelTraitSet traitSet, RelNode left, RelNode right, RexNode condition, JoinRelType joinType, Set<String> variablesStopped) Deprecated.
-
-
Method Details
-
accept
Description copied from interface:RelNodeAccepts a visit from a shuttle. If the shuttle updates expression, then a copy of the relation should be created. This new relation might have a different row-type.- Specified by:
acceptin interfaceRelNode- Overrides:
acceptin classAbstractRelNode- Parameters:
shuttle- Shuttle- Returns:
- A copy of this node incorporating changes made by the shuttle to this node's children
-
getCondition
-
getJoinType
-
isValid
Description copied from interface:RelNodeReturns whether this relational expression is valid.If assertions are enabled, this method is typically called with
litmus=THROW, as follows:assert rel.isValid(Litmus.THROW)
This signals that the method can throw an
AssertionErrorif it is not valid.- Specified by:
isValidin interfaceRelNode- Overrides:
isValidin classAbstractRelNode- Parameters:
litmus- What to do if invalidcontext- Context for validity checking- Returns:
- Whether relational expression is valid
-
computeSelfCost
Description copied from interface:RelNodeReturns the cost of this plan (not including children). The base implementation throws an error; derived classes should override.NOTE jvs 29-Mar-2006: Don't call this method directly. Instead, use
RelMetadataQuery.getNonCumulativeCost(org.apache.calcite.rel.RelNode), which gives plugins a chance to override the rel's default ideas about cost.- Specified by:
computeSelfCostin interfaceRelNode- Overrides:
computeSelfCostin classAbstractRelNode- Parameters:
planner- Planner for cost calculationmq- Metadata query- Returns:
- Cost of this plan (not including children)
-
estimateJoinedRows
Deprecated. -
estimateRowCount
Description copied from interface:RelNodeReturns an estimate of the number of rows this relational expression will return.NOTE jvs 29-Mar-2006: Don't call this method directly. Instead, use
RelMetadataQuery.getRowCount(org.apache.calcite.rel.RelNode), which gives plugins a chance to override the rel's default ideas about row count.- Specified by:
estimateRowCountin interfaceRelNode- Overrides:
estimateRowCountin classAbstractRelNode- Parameters:
mq- Metadata query- Returns:
- Estimate of the number of rows this relational expression will return
-
getVariablesSet
Description copied from interface:RelNodeReturns the variables that are set in this relational expression but also used and therefore not available to parents of this relational expression.- Specified by:
getVariablesSetin interfaceRelNode- Overrides:
getVariablesSetin classAbstractRelNode- Returns:
- Names of variables which are set in this relational expression
-
explainTerms
Description copied from class:AbstractRelNodeDescribes the inputs and attributes of this relational expression. Each node should callsuper.explainTerms, then call theRelWriter.input(String, RelNode)andRelWriter.item(String, Object)methods for each input and attribute.- Overrides:
explainTermsin classBiRel- Parameters:
pw- Plan writer- Returns:
- Plan writer for fluent-explain pattern
-
deepEquals0
@API(since="1.24", status=INTERNAL) @EnsuresNonNullIf(expression="#1", result=true) protected boolean deepEquals0(@Nullable Object obj) -
deepHashCode0
@API(since="1.24", status=INTERNAL) protected int deepHashCode0() -
deriveRowType
- Overrides:
deriveRowTypein classAbstractRelNode
-
isSemiJoinDone
public boolean isSemiJoinDone()Returns whether this LogicalJoin has already spawned aSemiJoinviaJoinAddRedundantSemiJoinRule.The base implementation returns false.
- Returns:
- whether this join has already spawned a semi join
-
isSemiJoin
public boolean isSemiJoin()Returns whether this Join is a semijoin.- Returns:
- true if this Join's join type is semi.
-
getSystemFieldList
Returns a list of system fields that will be prefixed to output row type.- Returns:
- list of system fields
-
deriveJoinRowType
@Deprecated public static RelDataType deriveJoinRowType(RelDataType leftType, RelDataType rightType, JoinRelType joinType, RelDataTypeFactory typeFactory, @Nullable List<String> fieldNameList, List<RelDataTypeField> systemFieldList) Deprecated. -
createJoinType
@Deprecated public static RelDataType createJoinType(RelDataTypeFactory typeFactory, RelDataType leftType, RelDataType rightType, List<String> fieldNameList, List<RelDataTypeField> systemFieldList) Deprecated. -
copy
Description copied from interface:RelNodeCreates a copy of this relational expression, perhaps changing traits and inputs.Sub-classes with other important attributes are encouraged to create variants of this method with more parameters.
- Specified by:
copyin interfaceRelNode- Overrides:
copyin classAbstractRelNode- Parameters:
traitSet- Trait setinputs- Inputs- Returns:
- Copy of this relational expression, substituting traits and inputs
-
copy
public abstract Join copy(RelTraitSet traitSet, RexNode conditionExpr, RelNode left, RelNode right, JoinRelType joinType, boolean semiJoinDone) Creates a copy of this join, overriding condition, system fields and inputs.General contract as
RelNode.copy(org.apache.calcite.plan.RelTraitSet, java.util.List<org.apache.calcite.rel.RelNode>).- Parameters:
traitSet- TraitsconditionExpr- Conditionleft- Left inputright- Right inputjoinType- Join typesemiJoinDone- Whether this join has been translated to a semi-join- Returns:
- Copy of this join
-
analyzeCondition
Analyzes the join condition.- Returns:
- Analyzed join condition
-
getHints
Description copied from interface:HintableReturns the hints of this relational expressions as an immutable list.
-
RelMdUtil.getJoinRowCount(RelMetadataQuery, Join, RexNode).