Class PlanUtils


  • public class PlanUtils
    extends java.lang.Object
    A collection of helpful utilities that can be used for generating, analyzing and manipulating query execution plans.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private PlanUtils()
      This class should not be instantiated.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static PlanNode addPredicateToPlan​(PlanNode plan, Expression predicate)
      This helper function takes a query plan and a selection predicate, and adds the predicate to the plan in a reasonably intelligent way.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • PlanUtils

        private PlanUtils()
        This class should not be instantiated.
    • Method Detail

      • addPredicateToPlan

        public static PlanNode addPredicateToPlan​(PlanNode plan,
                                                  Expression predicate)
        This helper function takes a query plan and a selection predicate, and adds the predicate to the plan in a reasonably intelligent way.

        If the plan is a subclass of the SelectNode then the select node's predicate is updated to include the predicate. Specifically, if the select node already has a predicate then one of the following occurs:

        • If the select node currently has no predicate, the new predicate is assigned to the select node.
        • If the select node has a predicate whose top node is a BooleanOperator of type AND, this predicate is added as a new term on that node.
        • If the select node has some other kind of non-null predicate then this method creates a new top-level AND operation that will combine the two predicates into one.

        If the plan is not a subclass of the SelectNode then a new SimpleFilterNode is added above the current plan node, with the specified predicate.

        Parameters:
        plan - the plan to add the selection predicate to
        predicate - the selection predicate to add to the plan
        Returns:
        the (possibly new) top plan-node for the plan with the selection predicate applied