org.jboss.dna.graph.query.plan
Class CanonicalPlanner

java.lang.Object
  extended by org.jboss.dna.graph.query.plan.CanonicalPlanner
All Implemented Interfaces:
Planner

public class CanonicalPlanner
extends Object
implements Planner

The planner that produces a canonical query plan given a query command.

A canonical plan always has the same structure:

       LIMIT       if row limit or offset are used
         |
      SORTING      if 'ORDER BY' is used
         |
     DUP_REMOVE    if 'SELECT DISTINCT' is used
         |
      PROJECT      with the list of columns being SELECTed
         |
       GROUP       if 'GROUP BY' is used
         |
      SELECT1
         |         One or more SELECT plan nodes that each have
      SELECT2      a single non-join constraint that are then all AND-ed
         |         together (see separateAndConstraints(Constraint, List))
      SELECTn
         |
    SOURCE or JOIN     A single SOURCE or JOIN node, depending upon the query
              /  \
             /    \
           SOJ    SOJ    A SOURCE or JOIN node for the left and right side of the JOIN
 

There leaves of the tree are always SOURCE nodes, so conceptually data always flows through this plan from the bottom SOURCE nodes, is adjusted/filtered as it trickles up through the plan, and is then ready to be used by the caller as it emerges from the top node of the plan.

This canonical plan, however, is later optimized and rearranged so that it performs faster.


Constructor Summary
CanonicalPlanner()
           
 
Method Summary
 PlanNode createPlan(QueryContext context, QueryCommand query)
          Create a canonical query plan for the given command.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CanonicalPlanner

public CanonicalPlanner()
Method Detail

createPlan

public PlanNode createPlan(QueryContext context,
                           QueryCommand query)
Create a canonical query plan for the given command.

Specified by:
createPlan in interface Planner
Parameters:
context - the context in which the query is being planned
query - the query command to be planned
Returns:
the root node of the plan tree representing the canonical plan
See Also:
Planner.createPlan(org.jboss.dna.graph.query.QueryContext, org.jboss.dna.graph.query.model.QueryCommand)


Copyright © 2008-2010 JBoss, a division of Red Hat. All Rights Reserved.