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 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,
Set<String> variablesStopped)
Deprecated.
|
protected |
Join(RelOptCluster cluster,
RelTraitSet traitSet,
RelNode left,
RelNode right,
RexNode condition,
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,
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.
|
static RelDataType |
deriveJoinRowType(RelDataType leftType,
RelDataType rightType,
JoinRelType joinType,
RelDataTypeFactory typeFactory,
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.
|
List<RexNode> |
getChildExps()
Returns a list of this relational expression's child expressions.
|
RexNode |
getCondition() |
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 |
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, replaceInputaccept, 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, toStringprotected final RexNode condition
protected final com.google.common.collect.ImmutableSet<CorrelationId> variablesSet
protected final JoinRelType joinType
JoinRelType, except that
JoinRelType.RIGHT is disallowed.protected Join(RelOptCluster cluster, RelTraitSet traitSet, RelNode left, RelNode right, RexNode condition, 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, Set<String> variablesStopped)
public List<RexNode> getChildExps()
RelNodeRelNode.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 RelNodegetChildExps in class AbstractRelNodeRelNode.accept(org.apache.calcite.rex.RexShuttle)public RelNode accept(RexShuttle shuttle)
RelNodeaccept in interface RelNodeaccept in class AbstractRelNodeshuttle - Shuttlepublic RexNode getCondition()
public JoinRelType getJoinType()
public boolean isValid(Litmus litmus, 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 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
RelWriterImpl.input(String, RelNode)
and
RelWriterImpl.item(String, Object)
methods for each input and attribute.explainTerms in class BiRelpw - Plan writerprotected RelDataType deriveRowType()
deriveRowType in class AbstractRelNodepublic boolean isSemiJoinDone()
SemiJoin via
JoinAddRedundantSemiJoinRule.
The base implementation returns false.
public List<RelDataTypeField> getSystemFieldList()
@Deprecated public static RelDataType deriveJoinRowType(RelDataType leftType, RelDataType rightType, JoinRelType joinType, RelDataTypeFactory typeFactory, 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–2018 The Apache Software Foundation. All rights reserved.