public abstract class Join extends BiRel
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 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,
RelNode left,
RelNode right,
RexNode condition,
JoinRelType joinType,
java.util.Set<java.lang.String> variablesStopped)
Deprecated.
|
protected |
Join(RelOptCluster cluster,
RelTraitSet traitSet,
RelNode left,
RelNode right,
RexNode condition,
java.util.Set<CorrelationId> variablesSet,
JoinRelType joinType)
Creates a Join.
|
Modifier and Type | Method and Description |
---|---|
RelNode |
accept(RexShuttle shuttle)
Accepts a visit from a shuttle.
|
JoinInfo |
analyzeCondition()
Analyzes the join condition.
|
RelOptCost |
computeSelfCost(RelOptPlanner planner,
RelMetadataQuery mq)
Returns the cost of this plan (not including children).
|
Join |
copy(RelTraitSet traitSet,
java.util.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,
java.util.List<java.lang.String> fieldNameList,
java.util.List<RelDataTypeField> systemFieldList)
Deprecated.
|
static RelDataType |
deriveJoinRowType(RelDataType leftType,
RelDataType rightType,
JoinRelType joinType,
RelDataTypeFactory typeFactory,
java.util.List<java.lang.String> fieldNameList,
java.util.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.
|
java.util.List<RexNode> |
getChildExps()
Returns a list of this relational expression's child expressions.
|
RexNode |
getCondition() |
JoinRelType |
getJoinType() |
java.util.List<RelDataTypeField> |
getSystemFieldList()
Returns a list of system fields that will be prefixed to
output row type.
|
java.util.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,
RelNode.Context context)
Returns whether this relational expression is valid.
|
childrenAccept, getInputs, getLeft, getRight, replaceInput
accept, collectVariablesSet, collectVariablesUsed, computeDigest, computeSelfCost, explain, getCluster, getCollationList, getConvention, getCorrelVariable, getDescription, getDigest, getExpectedInputRowType, getId, getInput, getQuery, getRelTypeName, getRows, getRowType, getTable, getTraitSet, getVariablesStopped, isDistinct, isKey, isValid, metadata, onRegister, recomputeDigest, register, sole, toString
protected final RexNode condition
protected final com.google.common.collect.ImmutableSet<CorrelationId> variablesSet
protected final JoinRelType joinType
JoinRelType
, except that
JoinRelType.RIGHT
is disallowed.protected final JoinInfo joinInfo
protected Join(RelOptCluster cluster, RelTraitSet traitSet, RelNode left, RelNode right, RexNode condition, java.util.Set<CorrelationId> variablesSet, JoinRelType joinType)
Note: We plan to change the variablesStopped
parameter to
Set<CorrelationId> variablesSet
before version 2.0
,
because getVariablesSet()
is preferred over AbstractRelNode.getVariablesStopped()
.
This constructor is not deprecated, for now, because maintaining overloaded
constructors in multiple sub-classes would be onerous.
cluster
- ClustertraitSet
- Trait setleft
- Left inputright
- Right inputcondition
- Join conditionjoinType
- Join typevariablesSet
- Set 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, JoinRelType joinType, java.util.Set<java.lang.String> variablesStopped)
public java.util.List<RexNode> getChildExps()
RelNode
RelNode.getInputs()
.
The caller should treat the list as unmodifiable; typical
implementations will return an immutable list. If there are no
child expressions, returns an empty list, not null
.
getChildExps
in interface RelNode
getChildExps
in class AbstractRelNode
RelNode.accept(org.apache.calcite.rex.RexShuttle)
public RelNode accept(RexShuttle shuttle)
RelNode
accept
in interface RelNode
accept
in class AbstractRelNode
shuttle
- Shuttlepublic RexNode getCondition()
public JoinRelType getJoinType()
public boolean isValid(Litmus litmus, RelNode.Context context)
RelNode
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.
isValid
in interface RelNode
isValid
in class AbstractRelNode
litmus
- What to do if invalidcontext
- Context for validity checkingpublic RelOptCost computeSelfCost(RelOptPlanner planner, RelMetadataQuery mq)
RelNode
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.
computeSelfCost
in interface RelNode
computeSelfCost
in class AbstractRelNode
planner
- 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)
RelNode
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.
estimateRowCount
in interface RelNode
estimateRowCount
in class AbstractRelNode
mq
- Metadata querypublic java.util.Set<CorrelationId> getVariablesSet()
RelNode
Note: only Correlate
should set
variables.
getVariablesSet
in interface RelNode
getVariablesSet
in class AbstractRelNode
public RelWriter explainTerms(RelWriter pw)
AbstractRelNode
super.explainTerms
, then call the
RelWriter.input(String, RelNode)
and
RelWriterImpl.item(String, Object)
methods for each input and attribute.explainTerms
in class BiRel
pw
- Plan writerprotected RelDataType deriveRowType()
deriveRowType
in class AbstractRelNode
public boolean isSemiJoinDone()
SemiJoin
via
JoinAddRedundantSemiJoinRule
.
The base implementation returns false.
public boolean isSemiJoin()
public java.util.List<RelDataTypeField> getSystemFieldList()
@Deprecated public static RelDataType deriveJoinRowType(RelDataType leftType, RelDataType rightType, JoinRelType joinType, RelDataTypeFactory typeFactory, java.util.List<java.lang.String> fieldNameList, java.util.List<RelDataTypeField> systemFieldList)
@Deprecated public static RelDataType createJoinType(RelDataTypeFactory typeFactory, RelDataType leftType, RelDataType rightType, java.util.List<java.lang.String> fieldNameList, java.util.List<RelDataTypeField> systemFieldList)
public final Join copy(RelTraitSet traitSet, java.util.List<RelNode> inputs)
RelNode
Sub-classes with other important attributes are encouraged to create variants of this method with more parameters.
copy
in interface RelNode
copy
in class AbstractRelNode
traitSet
- 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–2019 The Apache Software Foundation. All rights reserved.