Class VolcanoRuleMatch


  • class VolcanoRuleMatch
    extends VolcanoRuleCall
    A match of a rule to a particular set of target relational expressions, frozen in time.
    • Field Detail

      • targetSet

        private final RelSet targetSet
      • targetSubset

        private RelSubset targetSubset
      • digest

        private java.lang.String digest
      • cachedImportance

        private double cachedImportance
    • Constructor Detail

      • VolcanoRuleMatch

        VolcanoRuleMatch​(VolcanoPlanner volcanoPlanner,
                         RelOptRuleOperand operand0,
                         RelNode[] rels,
                         java.util.Map<RelNode,​java.util.List<RelNode>> nodeInputs)
        Creates a VolcanoRuleMatch.
        Parameters:
        operand0 - Primary operand
        rels - List of targets; copied by the constructor, so the client can modify it later
        nodeInputs - Map from relational expressions to their inputs
    • Method Detail

      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • clearCachedImportance

        void clearCachedImportance()
        Clears the cached importance value of this rule match. The importance will be re-calculated next time getImportance() is called.
      • getImportance

        double getImportance()
        Returns the importance of this rule.

        Calls computeImportance() the first time, thereafter uses a cached value until clearCachedImportance() is called.

        Returns:
        importance of this rule; a value between 0 and 1
      • computeImportance

        double computeImportance()
        Computes the importance of this rule match.
        Returns:
        importance of this rule match
      • computeDigest

        private java.lang.String computeDigest()
        Computes a string describing this rule match. Two rule matches are equivalent if and only if their digests are the same.
        Returns:
        description of this rule match
      • recomputeDigest

        public void recomputeDigest()
        Recomputes the digest of this VolcanoRuleMatch. It is necessary when sets have merged since the match was created.
      • guessSubset

        private RelSubset guessSubset()
        Returns a guess as to which subset (that is equivalence class of relational expressions combined with a set of physical traits) the result of this rule will belong to.
        Returns:
        expected subset, or null if we cannot guess
      • allNotNull

        private static <E> boolean allNotNull​(E[] es,
                                              Litmus litmus)
        Returns whether all elements of a given array are not-null; fails if any are null.