Class RelOptRuleCall

    • Field Detail

      • LOGGER

        protected static final org.slf4j.Logger LOGGER
      • nextId

        private static int nextId
        Generator for id values.
      • id

        public final int id
      • nodeInputs

        protected java.util.Map<RelNode,​java.util.List<RelNode>> nodeInputs
      • rels

        public final RelNode[] rels
      • parents

        private final java.util.List<RelNode> parents
    • Constructor Detail

      • RelOptRuleCall

        protected RelOptRuleCall​(RelOptPlanner planner,
                                 RelOptRuleOperand operand,
                                 RelNode[] rels,
                                 java.util.Map<RelNode,​java.util.List<RelNode>> nodeInputs,
                                 java.util.List<RelNode> parents)
        Creates a RelOptRuleCall.
        Parameters:
        planner - Planner
        operand - Root operand
        rels - Array of relational expressions which matched each operand
        nodeInputs - For each node which matched with matchAnyChildren=true, a list of the node's inputs
        parents - list of parent RelNodes corresponding to the first relational expression in the array argument, if known; otherwise, null
    • Method Detail

      • getOperand0

        public RelOptRuleOperand getOperand0()
        Returns the root operand matched by this rule.
        Returns:
        root operand
      • getRule

        public RelOptRule getRule()
        Returns the invoked planner rule.
        Returns:
        planner rule
      • getRels

        @Deprecated
        public RelNode[] getRels()
        Deprecated.
        Returns a list of matched relational expressions.
        Returns:
        matched relational expressions
      • getRelList

        public java.util.List<RelNode> getRelList()
        Returns a list of matched relational expressions.
        Returns:
        matched relational expressions
        See Also:
        rel(int)
      • rel

        public <T extends RelNode> T rel​(int ordinal)
        Retrieves the ordinalth matched relational expression. This corresponds to the ordinalth operand of the rule.
        Type Parameters:
        T - Type
        Parameters:
        ordinal - Ordinal
        Returns:
        Relational expression
      • getChildRels

        public java.util.List<RelNode> getChildRels​(RelNode rel)
        Returns the children of a given relational expression node matched in a rule.

        If the policy of the operand which caused the match is not RelOptRuleOperandChildPolicy.ANY, the children will have their own operands and therefore be easily available in the array returned by the getRelList() method, so this method returns null.

        This method is for RelOptRuleOperandChildPolicy.ANY, which is generally used when a node can have a variable number of children, and hence where the matched children are not retrievable by any other means.

        Warning: it produces wrong result for unordered(...) case.

        Parameters:
        rel - Relational expression
        Returns:
        Children of relational expression
      • setChildRels

        protected void setChildRels​(RelNode rel,
                                    java.util.List<RelNode> inputs)
        Assigns the input relational expressions of a given relational expression, as seen by this particular call. Is only called when the operand is RelOptRule.any().
      • getPlanner

        public RelOptPlanner getPlanner()
        Returns the planner.
        Returns:
        planner
      • getParents

        public java.util.List<RelNode> getParents()
        Returns:
        list of parents of the first relational expression
      • transformTo

        public abstract void transformTo​(RelNode rel,
                                         java.util.Map<RelNode,​RelNode> equiv)
        Registers that a rule has produced an equivalent relational expression.

        Called by the rule whenever it finds a match. The implementation of this method guarantees that the original relational expression (that is, this.rels[0]) has its traits propagated to the new relational expression (rel) and its unregistered children. Any trait not specifically set in the RelTraitSet returned by rel.getTraits() will be copied from this.rels[0].getTraitSet().

        Parameters:
        rel - Relational expression equivalent to the root relational expression of the rule call, call.rels(0)
        equiv - Map of other equivalences
      • transformTo

        public final void transformTo​(RelNode rel)
        Registers that a rule has produced an equivalent relational expression, but no other equivalences.
        Parameters:
        rel - Relational expression equivalent to the root relational expression of the rule call, call.rels(0)