public class QueryPlan extends Object implements Serializable
flip operation to
change the direction of an edge in the tree. During query plan
determination, many query plans are evaluated, and an efficient one
is selected, so this implementation of QueryPlan is optimized for
quickly evaluating flip operations, and quickly
creating a clone of the query plan.
The internal representation is a connection matrix between the
nodes. These are the internal fields:
- nodes: Query plan nodes in an array. Each node contains a
nodeIndex such that nodes[i].nodeIndex=i
- connMx: Connection matrix. If connMx[from][to]=true, then there
is an edge from nodes[from] to nodes[to]
- fromN: fromN[i]=number of edges emanating from nodes[i]
- toN: toN[i]=number of edges entering into nodes[i]
| Constructor and Description |
|---|
QueryPlan(CompositeMetadata root,
QueryPlanScorer qdf)
Constructs a query plan from the composite metadata by
recursively descending through the associated entities, and
creating a node for every entity.
|
QueryPlan(CompositeMetadata root,
QueryPlanScorer qdf,
Set<CompositeMetadata> filter)
Constructs a query plan from the composite metadata by
recursively descending through the associated entities as
deterimed by the filter, and creating a node for every entity.
|
| Modifier and Type | Method and Description |
|---|---|
void |
connect(QueryPlanNode from,
QueryPlanNode to)
Connects two nodes
|
QueryPlan |
deepCopy()
Returns a deep copy of the query plan.
|
void |
flip(QueryPlanNode x,
QueryPlanNode y)
Flips the direction of a node.
|
QueryPlanNode[] |
getAllNodes()
Returns all nodes
|
QueryPlanNode[] |
getBreadthFirstNodeOrdering() |
QueryPlanData |
getEdgeData(QueryPlanNode x,
QueryPlanNode y)
Returns the list of conjuncts associated with the undirected edge between the two nodes
|
QueryPlanNode |
getNode(CompositeMetadata md)
Returns the query plan node corresponding to the given
composite metadata instance.
|
int |
getSize()
Returns the size (number of nodes) of the query plan
|
QueryPlanNode[] |
getSources()
Returns an array of source nodes, nodes with no incoming
edges.
|
List<Conjunct> |
getUnassignedClauses()
Returns the list containing clauses that cannot be associated
with a node or an edge (i.e.
|
boolean |
isDirectedConnected(QueryPlanNode from,
QueryPlanNode to)
Returns if there exists a directed edge between the nodes,
directed from
from to to |
boolean |
isUndirectedConnected(QueryPlanNode from,
QueryPlanNode to)
Returns if there exists an edge between the two nodes, pointing either way
|
String |
mxToString() |
QueryPlanData |
newData()
Creates a new instance of QueryPlanData
|
void |
setEdgeData(QueryPlanNode x,
QueryPlanNode y,
QueryPlanData d)
Sets the list of conjuncts associated with the undirected edge between the two nodes
|
String |
toString() |
String |
treeToString() |
StringBuilder |
treeToString(StringBuilder bld) |
public QueryPlan(CompositeMetadata root, QueryPlanScorer qdf)
public QueryPlan(CompositeMetadata root, QueryPlanScorer qdf, Set<CompositeMetadata> filter)
root - The root composite metadataqdf - The scorerfilter - A set of composite metadata objects containing
only those entities that should be included in the plan. If
null, all entities will be included.public int getSize()
public QueryPlanData newData()
public QueryPlanNode[] getSources()
public List<Conjunct> getUnassignedClauses()
public QueryPlanData getEdgeData(QueryPlanNode x, QueryPlanNode y)
public void setEdgeData(QueryPlanNode x, QueryPlanNode y, QueryPlanData d)
public QueryPlan deepCopy()
public void flip(QueryPlanNode x, QueryPlanNode y)
public void connect(QueryPlanNode from, QueryPlanNode to)
public QueryPlanNode[] getAllNodes()
public boolean isDirectedConnected(QueryPlanNode from, QueryPlanNode to)
from to topublic boolean isUndirectedConnected(QueryPlanNode from, QueryPlanNode to)
public QueryPlanNode[] getBreadthFirstNodeOrdering()
public String mxToString()
public QueryPlanNode getNode(CompositeMetadata md)
public String treeToString()
public StringBuilder treeToString(StringBuilder bld)
Copyright © 2015. All rights reserved.