public abstract class Join extends BiRel implements Hintable
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.
RelNode.Context| Modifier and Type | Field and Description |
|---|---|
protected RexNode |
condition |
protected com.google.common.collect.ImmutableList<RelHint> |
hints |
protected JoinInfo |
joinInfo |
protected JoinRelType |
joinType
Values must be of enumeration
JoinRelType, except that
JoinRelType.RIGHT is disallowed. |
protected com.google.common.collect.ImmutableSet<CorrelationId> |
variablesSet |
digest, id, rowType, traitSet| Modifier | Constructor and Description |
|---|---|
protected |
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,
JoinRelType joinType,
Set<String> variablesStopped)
Deprecated.
|
protected |
Join(RelOptCluster cluster,
RelTraitSet traitSet,
RelNode left,
RelNode right,
RexNode condition,
Set<CorrelationId> variablesSet,
JoinRelType joinType)
Deprecated.
|
| Modifier and Type | Method and Description |
|---|---|
RelNode |
accept(RexShuttle shuttle)
Accepts a visit from a shuttle.
|
JoinInfo |
analyzeCondition()
Analyzes the join condition.
|
@Nullable RelOptCost |
computeSelfCost(RelOptPlanner planner,
RelMetadataQuery mq)
Returns the cost of this plan (not including children).
|
Join |
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 |
deepHashCode0() |
static RelDataType |
deriveJoinRowType(RelDataType leftType,
RelDataType rightType,
JoinRelType joinType,
RelDataTypeFactory typeFactory,
@Nullable List<String> fieldNameList,
List<RelDataTypeField> systemFieldList)
Deprecated.
|
protected RelDataType |
deriveRowType() |
static double |
estimateJoinedRows(Join joinRel,
RexNode condition)
Deprecated.
|
double |
estimateRowCount(RelMetadataQuery mq)
Returns an estimate of the number of rows this relational expression will
return.
|
RelWriter |
explainTerms(RelWriter pw)
Describes the inputs and attributes of this relational expression.
|
RexNode |
getCondition() |
com.google.common.collect.ImmutableList<RelHint> |
getHints()
Returns the hints of this relational expressions as an immutable list.
|
JoinRelType |
getJoinType() |
List<RelDataTypeField> |
getSystemFieldList()
Returns a list of system fields that will be prefixed to
output row type.
|
Set<CorrelationId> |
getVariablesSet()
Returns the variables that are set in this relational
expression but also used and therefore not available to parents of this
relational expression.
|
boolean |
isSemiJoin()
Returns whether this Join is a semijoin.
|
boolean |
isSemiJoinDone()
Returns whether this LogicalJoin has already spawned a
SemiJoin via
JoinAddRedundantSemiJoinRule. |
boolean |
isValid(Litmus litmus,
@Nullable RelNode.Context context)
Returns whether this relational expression is valid.
|
childrenAccept, getInputs, getLeft, getRight, replaceInputaccept, 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, toStringclone, finalize, getClass, notify, notifyAll, wait, wait, waitattachHints, withHintsexplain, fieldIsNullableprotected final RexNode condition
protected final com.google.common.collect.ImmutableSet<CorrelationId> variablesSet
protected final com.google.common.collect.ImmutableList<RelHint> hints
protected final JoinRelType joinType
JoinRelType, except that
JoinRelType.RIGHT is disallowed.protected final JoinInfo joinInfo
protected Join(RelOptCluster cluster, RelTraitSet traitSet, List<RelHint> hints, RelNode left, RelNode right, RexNode condition, Set<CorrelationId> variablesSet, JoinRelType joinType)
cluster - ClustertraitSet - Trait sethints - Hintsleft - Left inputright - Right inputcondition - Join conditionjoinType - Join typevariablesSet - variables that are set by the
LHS and used by the RHS and are not available to
nodes above this Join in the tree@Deprecated 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)
public RelNode accept(RexShuttle shuttle)
RelNodeaccept in interface RelNodeaccept in class AbstractRelNodeshuttle - Shuttlepublic RexNode getCondition()
public JoinRelType getJoinType()
public boolean isValid(Litmus litmus, @Nullable RelNode.Context context)
RelNodeIf 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.
isValid in interface RelNodeisValid in class AbstractRelNodelitmus - What to do if invalidcontext - Context for validity checkingpublic @Nullable RelOptCost computeSelfCost(RelOptPlanner planner, RelMetadataQuery mq)
RelNodeNOTE 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.
computeSelfCost in interface RelNodecomputeSelfCost in class AbstractRelNodeplanner - Planner for cost calculationmq - Metadata query@Deprecated public static double estimateJoinedRows(Join joinRel, RexNode condition)
RelMdUtil.getJoinRowCount(RelMetadataQuery, Join, RexNode).public double estimateRowCount(RelMetadataQuery mq)
RelNodeNOTE 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.
estimateRowCount in interface RelNodeestimateRowCount in class AbstractRelNodemq - Metadata querypublic Set<CorrelationId> getVariablesSet()
RelNodeNote: only Correlate should set
variables.
getVariablesSet in interface RelNodegetVariablesSet in class AbstractRelNodepublic RelWriter explainTerms(RelWriter pw)
AbstractRelNodesuper.explainTerms, then call the
RelWriter.input(String, RelNode)
and
RelWriter.item(String, Object)
methods for each input and attribute.explainTerms in class BiRelpw - Plan writer@API(since="1.24",
status=INTERNAL)
@EnsuresNonNullIf(expression="#1",
result=true)
protected boolean deepEquals0(@Nullable Object obj)
@API(since="1.24",
status=INTERNAL)
protected int deepHashCode0()
protected RelDataType deriveRowType()
deriveRowType in class AbstractRelNodepublic boolean isSemiJoinDone()
SemiJoin via
JoinAddRedundantSemiJoinRule.
The base implementation returns false.
public boolean isSemiJoin()
public List<RelDataTypeField> getSystemFieldList()
@Deprecated public static RelDataType deriveJoinRowType(RelDataType leftType, RelDataType rightType, JoinRelType joinType, RelDataTypeFactory typeFactory, @Nullable List<String> fieldNameList, List<RelDataTypeField> systemFieldList)
@Deprecated public static RelDataType createJoinType(RelDataTypeFactory typeFactory, RelDataType leftType, RelDataType rightType, List<String> fieldNameList, List<RelDataTypeField> systemFieldList)
public final Join copy(RelTraitSet traitSet, List<RelNode> inputs)
RelNodeSub-classes with other important attributes are encouraged to create variants of this method with more parameters.
copy in interface RelNodecopy in class AbstractRelNodetraitSet - Trait setinputs - Inputspublic abstract Join copy(RelTraitSet traitSet, RexNode conditionExpr, RelNode left, RelNode right, JoinRelType joinType, boolean semiJoinDone)
General contract as RelNode.copy(org.apache.calcite.plan.RelTraitSet, java.util.List<org.apache.calcite.rel.RelNode>).
traitSet - TraitsconditionExpr - Conditionleft - Left inputright - Right inputjoinType - Join typesemiJoinDone - Whether this join has been translated to a
semi-joinpublic JoinInfo analyzeCondition()
Copyright © 2012-2022 Apache Software Foundation. All Rights Reserved.