Class PlannerGraphProperty
- java.lang.Object
-
- com.apple.foundationdb.record.query.plan.temp.explain.PlannerGraphProperty
-
- All Implemented Interfaces:
PlannerProperty<PlannerGraph>
public class PlannerGraphProperty extends Object implements PlannerProperty<PlannerGraph>
Class to hold a graph for explain, optimization, and rewrite purposes.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static URI
createHtmlLauncher(AbstractPlannerGraph<PlannerGraph.Node,PlannerGraph.Edge> plannerGraph)
For debugging only! This method locates a template html launcher file from the resources folder and writes a specific launcher html file into a temp directory.PlannerGraph
evaluateAtExpression(RelationalExpression expression, List<PlannerGraph> childGraphs)
Evaluate the property at the given expression, using the results of evaluating the property at its children.PlannerGraph
evaluateAtRef(ExpressionRef<? extends RelationalExpression> ref, List<PlannerGraph> memberResults)
Evaluate the property at the given reference, using the results of evaluating the property at its members.static String
explain(RelationalExpression relationalExpression)
Generate the explain of the planner expression that is passed in.static String
explain(RelationalExpression relationalExpression, Map<String,Attribute> additionalDescriptionMap)
Generate the explain of the planner expression that is passed in.static String
exportToDot(AbstractPlannerGraph<PlannerGraph.Node,PlannerGraph.Edge> plannerGraph)
Creates a serialized format of this graph as a dot-compatible definition.static String
exportToGml(PlannerGraph plannerGraph, Map<String,Attribute> additionalInfoMap)
Creates a serialized format of this graph as a gml-compatible definition.static PlannerGraphProperty
forExplain()
static PlannerGraphProperty
forInternalShow(boolean renderSingleGroups)
static String
show(boolean renderSingleGroups, RelationalExpression relationalExpression)
Show the planner expression that is passed in as a graph rendered in your default browser.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.apple.foundationdb.record.query.plan.temp.PlannerProperty
evaluateAtQuantifier, shouldVisit, shouldVisit, shouldVisit
-
-
-
-
Method Detail
-
show
@Nonnull public static String show(boolean renderSingleGroups, @Nonnull RelationalExpression relationalExpression)
Show the planner expression that is passed in as a graph rendered in your default browser.- Parameters:
renderSingleGroups
- iff true group references with just one member are not renderedrelationalExpression
- the planner expression to be rendered.- Returns:
- the word "done" (IntelliJ really likes a return of String).
-
createHtmlLauncher
@Nonnull public static URI createHtmlLauncher(@Nonnull AbstractPlannerGraph<PlannerGraph.Node,PlannerGraph.Edge> plannerGraph) throws Exception
For debugging only! This method locates a template html launcher file from the resources folder and writes a specific launcher html file into a temp directory. If wanted the caller can open the html in a browser of choice.- Parameters:
plannerGraph
- -- the planner graph we should create the launcher for- Returns:
- a URI pointing to an html file in a temp location which renders the graph
- Throws:
Exception
- -- thrown from methods called in here.
-
exportToDot
@Nonnull public static String exportToDot(@Nonnull AbstractPlannerGraph<PlannerGraph.Node,PlannerGraph.Edge> plannerGraph)
Creates a serialized format of this graph as a dot-compatible definition.- Parameters:
plannerGraph
- the planner graph we should export to dot- Returns:
- the graph as string in dot format.
-
explain
@Nonnull public static String explain(@Nonnull RelationalExpression relationalExpression)
Generate the explain of the planner expression that is passed in.- Parameters:
relationalExpression
- the planner expression to be explained.- Returns:
- the explain of the planner expression handing in as a string in GML format.
-
explain
@Nonnull public static String explain(@Nonnull RelationalExpression relationalExpression, @Nonnull Map<String,Attribute> additionalDescriptionMap)
Generate the explain of the planner expression that is passed in.- Parameters:
relationalExpression
- the planner expression to be explained.additionalDescriptionMap
- a map used to generate names and descriptions for operators.- Returns:
- the explain of the planner expression handing in as a string in GML format.
-
exportToGml
@Nonnull public static String exportToGml(@Nonnull PlannerGraph plannerGraph, @Nonnull Map<String,Attribute> additionalInfoMap)
Creates a serialized format of this graph as a gml-compatible definition.- Parameters:
plannerGraph
- the planner graph to be exportedadditionalInfoMap
- a map used to generate names and descriptions for operators.- Returns:
- the graph as string in gml format.
-
forExplain
public static PlannerGraphProperty forExplain()
-
forInternalShow
public static PlannerGraphProperty forInternalShow(boolean renderSingleGroups)
-
evaluateAtExpression
@Nonnull public PlannerGraph evaluateAtExpression(@Nonnull RelationalExpression expression, @Nonnull List<PlannerGraph> childGraphs)
Description copied from interface:PlannerProperty
Evaluate the property at the given expression, using the results of evaluating the property at its children. Called on nodes in the graph in visit post-order of the depth-first traversal of the graph. That is, as each expression is visited (after all of its children have been visited, if applicable),evaluateAtExpression()
is called on that expression.- Specified by:
evaluateAtExpression
in interfacePlannerProperty<PlannerGraph>
- Parameters:
expression
- the cursor to visitchildGraphs
- the results of the property evaluated at the children ofexpression
- Returns:
- the value of property at the given expression
-
evaluateAtRef
@Nonnull public PlannerGraph evaluateAtRef(@Nonnull ExpressionRef<? extends RelationalExpression> ref, @Nonnull List<PlannerGraph> memberResults)
Description copied from interface:PlannerProperty
Evaluate the property at the given reference, using the results of evaluating the property at its members. Called on nodes in the graph in visit post-order of the depth-first traversal of the graph. That is, as each reference is visited (after all of its members have been visited, if applicable),evaluateAtRef()
is called on that reference.- Specified by:
evaluateAtRef
in interfacePlannerProperty<PlannerGraph>
- Parameters:
ref
- the expression reference to visitmemberResults
- the results of the property evaluated at the members ofref
- Returns:
- the value of property at the given reference
-
-