public interface PlannerGraphRewritable
RelationalExpression
s to rewrite their own
graph representation.
This interface allows a RelationalExpression
to create/modify
low level planner graph structures while a planner graph is created through an expression walk in
PlannerGraphProperty
. Such a rewrite can be useful if the standard representation is confusing, misleading,
or just too complicated. For instance, RecordQueryPlanWithIndex
additionally creates a separate node underneath the actual plan operator to show the index as a record producer.
The nature of the rewrite is highly operator-specific, therefore, the rewrite is not part of the visitor or some
other common logic. Expressions that decide to implement this interface must then implement
rewritePlannerGraph(java.util.List<? extends com.apple.foundationdb.record.query.plan.temp.explain.PlannerGraph>)
to do the actual rewrite.
Implementors of this interface should rewrite the planner graph for both internal show as well as
explain purposes. There are two other flavors of this interface: see InternalPlannerGraphRewritable
and
ExplainPlannerGraphRewritable
. Those interfaces allow an expression to rewrite only for one of the use
cases or differently for either of them.
Note that these three interfaces do not form a hierarchy themselves. Also, in order to keep the code from bleeding
into general expression structures, we didn't want to have another set of methods on
RelationalExpression
.
The approach taken here works more like a tag interface that can be chosen by a specific operator to do something
very specific without cluttering the general code path.Modifier and Type | Method and Description |
---|---|
PlannerGraph |
rewritePlannerGraph(List<? extends PlannerGraph> childGraphs)
Method to rewrite the planner graph.
|
@Nonnull PlannerGraph rewritePlannerGraph(@Nonnull List<? extends PlannerGraph> childGraphs)
childGraphs
- planner graphs of children expression that already have been computedchildGraph
s in a meaningful way. Note that there
is no obligation to use the childGraph
s at all, this method can create a new independent
planner graph completely from scratch.