Class EliminateCrossJoins

java.lang.Object
io.trino.sql.planner.iterative.rule.EliminateCrossJoins
All Implemented Interfaces:
Rule<JoinNode>

public class EliminateCrossJoins extends Object implements Rule<JoinNode>
  • Constructor Details

    • EliminateCrossJoins

      public EliminateCrossJoins()
  • Method Details

    • getPattern

      public Pattern<JoinNode> getPattern()
      Description copied from interface: Rule
      Returns a pattern to which plan nodes this rule applies.
      Specified by:
      getPattern in interface Rule<JoinNode>
    • isEnabled

      public boolean isEnabled(Session session)
      Specified by:
      isEnabled in interface Rule<JoinNode>
    • apply

      public Rule.Result apply(JoinNode node, Captures captures, Rule.Context context)
      Specified by:
      apply in interface Rule<JoinNode>
    • isOriginalOrder

      public static boolean isOriginalOrder(List<Integer> joinOrder)
    • getJoinOrder

      public static List<Integer> getJoinOrder(JoinGraph graph)
      Given JoinGraph determine the order of joins between graph nodes by traversing JoinGraph. Any graph traversal algorithm could be used here (like BFS or DFS), but we use PriorityQueue to preserve original JoinOrder as mush as it is possible. PriorityQueue returns next nodes to join in order of their occurrence in original Plan.
    • buildJoinTree

      public static PlanNode buildJoinTree(List<Symbol> expectedOutputSymbols, JoinGraph graph, List<Integer> joinOrder, PlanNodeIdAllocator idAllocator)