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.
| 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<String> |
variablesStopped |
digest, id, rowType, traitSet| Modifier | Constructor and Description |
|---|---|
protected |
Join(RelOptCluster cluster,
RelTraitSet traits,
RelNode left,
RelNode right,
RexNode condition,
JoinRelType joinType,
Set<String> variablesStopped)
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)
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)
Returns the type the row which results when two relations are joined.
|
static RelDataType |
deriveJoinRowType(RelDataType leftType,
RelDataType rightType,
JoinRelType joinType,
RelDataTypeFactory typeFactory,
List<String> fieldNameList,
List<RelDataTypeField> systemFieldList)
Derives the type of a join relational expression.
|
protected RelDataType |
deriveRowType() |
static double |
estimateJoinedRows(Join joinRel,
RexNode condition) |
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() |
double |
getRows()
Returns an estimate of the number of rows this relational expression will
return.
|
List<RelDataTypeField> |
getSystemFieldList()
Returns a list of system fields that will be prefixed to
output row type.
|
Set<String> |
getVariablesStopped()
Returns the names of variables which 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_(boolean fail) |
childrenAccept, getInputs, getLeft, getRight, replaceInputaccept, collectVariablesSet, collectVariablesUsed, computeDigest, explain, getCluster, getCollationList, getConvention, getCorrelVariable, getDescription, getDigest, getExpectedInputRowType, getId, getInput, getQuery, getRelTypeName, getRowType, getTable, getTraitSet, isDistinct, isKey, isValid, metadata, onRegister, recomputeDigest, register, sole, toStringprotected final RexNode condition
protected final com.google.common.collect.ImmutableSet<String> variablesStopped
protected JoinRelType joinType
JoinRelType, except that
JoinRelType.RIGHT is disallowed.protected Join(RelOptCluster cluster, RelTraitSet traits, RelNode left, RelNode right, RexNode condition, JoinRelType joinType, Set<String> variablesStopped)
cluster - Clustertraits - Traitsleft - Left inputright - Right inputcondition - Join conditionjoinType - Join typevariablesStopped - Set of names of variables which are set by the
LHS and used by the RHS and are not available to
nodes above this LogicalJoin in the treepublic 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_(boolean fail)
public RelOptCost computeSelfCost(RelOptPlanner planner)
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 calculationpublic double getRows()
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.
getRows in interface RelNodegetRows in class AbstractRelNodepublic Set<String> getVariablesStopped()
RelNodeNote: only Correlate should set
variables
getVariablesStopped in interface RelNodegetVariablesStopped 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()
public static RelDataType deriveJoinRowType(RelDataType leftType, RelDataType rightType, JoinRelType joinType, RelDataTypeFactory typeFactory, List<String> fieldNameList, List<RelDataTypeField> systemFieldList)
leftType - Row type of left input to joinrightType - Row type of right input to joinjoinType - Type of jointypeFactory - Type factoryfieldNameList - List of names of fields; if null, field names are
inherited and made uniquesystemFieldList - List of system fields that will be prefixed to
output row type; typically empty but must not be
nullpublic static RelDataType createJoinType(RelDataTypeFactory typeFactory, RelDataType leftType, RelDataType rightType, List<String> fieldNameList, List<RelDataTypeField> systemFieldList)
The resulting row type consists of the system fields (if any), followed by the fields of the left type, followed by the fields of the right type. The field name list, if present, overrides the original names of the fields.
typeFactory - Type factoryleftType - Type of left input to joinrightType - Type of right input to joinfieldNameList - If not null, overrides the original names of the
fieldssystemFieldList - List of system fields that will be prefixed to
output row type; typically empty but must not be
nullpublic 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–2015 The Apache Software Foundation. All rights reserved.