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
Modifier and TypeFieldDescriptionprotected final RexNode
protected final com.google.common.collect.ImmutableList<RelHint>
protected final JoinInfo
protected final JoinRelType
Values must be of enumerationJoinRelType
, except thatJoinRelType.RIGHT
is disallowed.protected final com.google.common.collect.ImmutableSet<CorrelationId>
Fields inherited from class org.apache.calcite.rel.AbstractRelNode
digest, id, rowType, traitSet
-
Constructor Summary
ModifierConstructorDescriptionprotected
Join
(RelOptCluster cluster, RelTraitSet traitSet, List<RelHint> hints, RelNode left, RelNode right, RexNode condition, Set<CorrelationId> variablesSet, JoinRelType joinType) Creates a Join.protected
Join
(RelOptCluster cluster, RelTraitSet traitSet, RelNode left, RelNode right, RexNode condition, Set<CorrelationId> variablesSet, JoinRelType joinType) Deprecated.protected
Join
(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 RelOptCost
computeSelfCost
(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 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.static RelDataType
createJoinType
(RelDataTypeFactory typeFactory, RelDataType leftType, RelDataType rightType, List<String> fieldNameList, List<RelDataTypeField> systemFieldList) Deprecated.protected boolean
deepEquals0
(@Nullable Object obj) protected int
static RelDataType
deriveJoinRowType
(RelDataType leftType, RelDataType rightType, JoinRelType joinType, RelDataTypeFactory typeFactory, @Nullable List<String> fieldNameList, List<RelDataTypeField> systemFieldList) Deprecated.protected RelDataType
static double
estimateJoinedRows
(Join joinRel, RexNode condition) Deprecated.double
Returns 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.boolean
Returns whether this Join is a semijoin.boolean
Returns whether this LogicalJoin has already spawned aSemiJoin
viaJoinAddRedundantSemiJoinRule
.boolean
isValid
(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, replaceInput
Methods 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, toString
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.apache.calcite.rel.hint.Hintable
attachHints, withHints
Methods inherited from interface org.apache.calcite.rel.RelNode
explain, fieldIsNullable, stripped
-
Field Details
-
condition
-
variablesSet
-
hints
-
joinType
Values must be of enumerationJoinRelType
, except thatJoinRelType.RIGHT
is 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:RelNode
Accepts 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:
accept
in interfaceRelNode
- Overrides:
accept
in 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:RelNode
Returns 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
AssertionError
if it is not valid.- Specified by:
isValid
in interfaceRelNode
- Overrides:
isValid
in classAbstractRelNode
- Parameters:
litmus
- What to do if invalidcontext
- Context for validity checking- Returns:
- Whether relational expression is valid
-
computeSelfCost
Description copied from interface:RelNode
Returns 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:
computeSelfCost
in interfaceRelNode
- Overrides:
computeSelfCost
in classAbstractRelNode
- Parameters:
planner
- Planner for cost calculationmq
- Metadata query- Returns:
- Cost of this plan (not including children)
-
estimateJoinedRows
Deprecated. -
estimateRowCount
Description copied from interface:RelNode
Returns 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:
estimateRowCount
in interfaceRelNode
- Overrides:
estimateRowCount
in classAbstractRelNode
- Parameters:
mq
- Metadata query- Returns:
- Estimate of the number of rows this relational expression will return
-
getVariablesSet
Description copied from interface:RelNode
Returns the variables that are set in this relational expression but also used and therefore not available to parents of this relational expression.- Specified by:
getVariablesSet
in interfaceRelNode
- Overrides:
getVariablesSet
in classAbstractRelNode
- Returns:
- Names of variables which are set in this relational expression
-
explainTerms
Description copied from class:AbstractRelNode
Describes 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:
explainTerms
in 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:
deriveRowType
in classAbstractRelNode
-
isSemiJoinDone
public boolean isSemiJoinDone()Returns whether this LogicalJoin has already spawned aSemiJoin
viaJoinAddRedundantSemiJoinRule
.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:RelNode
Creates 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:
copy
in interfaceRelNode
- Overrides:
copy
in 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:Hintable
Returns the hints of this relational expressions as an immutable list.
-
RelMdUtil.getJoinRowCount(RelMetadataQuery, Join, RexNode)
.