Class MultiJoin

  • All Implemented Interfaces:
    java.lang.Cloneable, RelOptNode, RelNode

    public final class MultiJoin
    extends AbstractRelNode
    A MultiJoin represents a join of N inputs, whereas regular Joins represent strictly binary joins.
    • Field Detail

      • inputs

        private final java.util.List<RelNode> inputs
      • joinFilter

        private final RexNode joinFilter
      • isFullOuterJoin

        private final boolean isFullOuterJoin
      • outerJoinConditions

        private final java.util.List<RexNode> outerJoinConditions
      • joinTypes

        private final com.google.common.collect.ImmutableList<JoinRelType> joinTypes
      • joinFieldRefCountsMap

        public final com.google.common.collect.ImmutableMap<java.lang.Integer,​ImmutableIntList> joinFieldRefCountsMap
      • postJoinFilter

        private final RexNode postJoinFilter
    • Constructor Detail

      • MultiJoin

        public MultiJoin​(RelOptCluster cluster,
                         java.util.List<RelNode> inputs,
                         RexNode joinFilter,
                         RelDataType rowType,
                         boolean isFullOuterJoin,
                         java.util.List<RexNode> outerJoinConditions,
                         java.util.List<JoinRelType> joinTypes,
                         java.util.List<ImmutableBitSet> projFields,
                         com.google.common.collect.ImmutableMap<java.lang.Integer,​ImmutableIntList> joinFieldRefCountsMap,
                         RexNode postJoinFilter)
        Constructs a MultiJoin.
        Parameters:
        cluster - cluster that join belongs to
        inputs - inputs into this multi-join
        joinFilter - join filter applicable to this join node
        rowType - row type of the join result of this node
        isFullOuterJoin - true if the join is a full outer join
        outerJoinConditions - outer join condition associated with each join input, if the input is null-generating in a left or right outer join; null otherwise
        joinTypes - the join type corresponding to each input; if an input is null-generating in a left or right outer join, the entry indicates the type of outer join; otherwise, the entry is set to INNER
        projFields - fields that will be projected from each input; if null, projection information is not available yet so it's assumed that all fields from the input are projected
        joinFieldRefCountsMap - counters of the number of times each field is referenced in join conditions, indexed by the input #
        postJoinFilter - filter to be applied after the joins are
    • Method Detail

      • replaceInput

        public void replaceInput​(int ordinalInParent,
                                 RelNode p)
        Description copied from interface: RelNode
        Replaces the ordinalInParentth input. You must override this method if you override RelNode.getInputs().
        Specified by:
        replaceInput in interface RelNode
        Overrides:
        replaceInput in class AbstractRelNode
        Parameters:
        ordinalInParent - Position of the child input, 0 is the first
        p - New node that should be put at position ordinalInParent
      • copy

        public RelNode copy​(RelTraitSet traitSet,
                            java.util.List<RelNode> inputs)
        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 interface RelNode
        Overrides:
        copy in class AbstractRelNode
        Parameters:
        traitSet - Trait set
        inputs - Inputs
        Returns:
        Copy of this relational expression, substituting traits and inputs
      • cloneJoinFieldRefCountsMap

        private java.util.Map<java.lang.Integer,​int[]> cloneJoinFieldRefCountsMap()
        Returns a deep copy of joinFieldRefCountsMap.
      • getInputs

        public java.util.List<RelNode> getInputs()
        Description copied from interface: RelNode
        Returns an array of this relational expression's inputs. If there are no inputs, returns an empty list, not null.
        Specified by:
        getInputs in interface RelNode
        Specified by:
        getInputs in interface RelOptNode
        Overrides:
        getInputs in class AbstractRelNode
        Returns:
        Array of this relational expression's inputs
      • getChildExps

        public java.util.List<RexNode> getChildExps()
        Description copied from interface: RelNode
        Returns a list of this relational expression's child expressions. (These are scalar expressions, and so do not include the relational inputs that are returned by 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.

        Specified by:
        getChildExps in interface RelNode
        Overrides:
        getChildExps in class AbstractRelNode
        Returns:
        List of this relational expression's child expressions
        See Also:
        RelNode.accept(org.apache.calcite.rex.RexShuttle)
      • accept

        public RelNode accept​(RexShuttle shuttle)
        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 interface RelNode
        Overrides:
        accept in class AbstractRelNode
        Parameters:
        shuttle - Shuttle
        Returns:
        A copy of this node incorporating changes made by the shuttle to this node's children
      • getJoinFilter

        public RexNode getJoinFilter()
        Returns:
        join filters associated with this MultiJoin
      • isFullOuterJoin

        public boolean isFullOuterJoin()
        Returns:
        true if the MultiJoin corresponds to a full outer join.
      • getOuterJoinConditions

        public java.util.List<RexNode> getOuterJoinConditions()
        Returns:
        outer join conditions for null-generating inputs
      • getJoinTypes

        public java.util.List<JoinRelType> getJoinTypes()
        Returns:
        join types of each input
      • getProjFields

        public java.util.List<ImmutableBitSet> getProjFields()
        Returns:
        bitmaps representing the fields projected from each input; if an entry is null, all fields are projected
      • getJoinFieldRefCountsMap

        public com.google.common.collect.ImmutableMap<java.lang.Integer,​ImmutableIntList> getJoinFieldRefCountsMap()
        Returns:
        the map of reference counts for each input, representing the fields accessed in join conditions
      • getCopyJoinFieldRefCountsMap

        public java.util.Map<java.lang.Integer,​int[]> getCopyJoinFieldRefCountsMap()
        Returns:
        a copy of the map of reference counts for each input, representing the fields accessed in join conditions
      • getPostJoinFilter

        public RexNode getPostJoinFilter()
        Returns:
        post-join filter associated with this MultiJoin
      • containsOuter

        boolean containsOuter()