C# Class GraphView.TranslateMatchClauseVisitor

Translate match clause and add it to the from clause. Check validity -> Divide the graph into connected sub-graph -> Retrive the estimation -> Use DP-like algorithem to get the component -> add the component(s) into from clause
Inheritance: WSqlFragmentVisitor
Mostrar archivo Open project: Microsoft/GraphView Class Usage Examples

Public Methods

Method Description
Invoke ( WSqlFragment node ) : void
TranslateMatchClauseVisitor ( SqlTransaction tx ) : System
Visit ( GraphView.WDeclareVariableStatement node ) : void
Visit ( GraphView.WProcedureStatement node ) : void

Records the declared parameter in the Store Procedure Statement

Visit ( GraphView.WSelectQueryBlock node ) : void

The entry point of the optimizer, activated when visting each SELECT query block.

Private Methods

Method Description
AttachPredicates ( WWhereClause whereClause, MatchGraph graph ) : void
ChangeSelectStarExpression ( GraphView.WSelectQueryBlock node, MatchGraph graph ) : void

Replaces the SELECT * expression with all visible columns

CheckValidity ( GraphView.WSelectQueryBlock node ) : void

Checks the validity of the MATCH clause, including (1) an edge is bound to a node table or node view, (2) the source and the sink of an edeg in a path expression are bound to corresponding node tables, as specified when node tables are created, and (3) The length constraint for a path construct is valid

ConstructComponent ( ConnectedComponent subGraph, MatchEdge>.Dictionary revEdgeDict, bool>.Dictionary srcNodeStatisticsDict ) : MatchComponent

Get the optimal join component for the given connected graph 1. Generate the initial states 2. DP, Iterate on each states: Get smallest join units -> Enumerate on all possible combination of the join units -> Join to the current component to get the next states -> Those components with the largest average size per edge will be eliminate if exceeding the upper bound 3. If all the components has reached its end states, return the component with the smallest join cost

ConstructGraph ( GraphView.WSelectQueryBlock query ) : MatchGraph

Constructs the graph pattern specified by the MATCH clause. The graph pattern may consist of multiple fully-connected sub-graphs.

EstimateRows ( MatchGraph graph ) : void

Estimates the number of rows of each node table in the graph pattern.

GetMostExpensiveMatchComponent ( List components ) : double>.Tuple

Gets the index and the average size per edege of the component with maximum average size

GetNodeUnits ( ConnectedComponent graph, MatchComponent component ) : IEnumerable

Get a full one height tree with joint edges and unmaterlized edges, returns a tuple whose first item is the one height tree and the second item indicates whether the one height tree only joins with the component's materialized node on its root.

Init ( ) : void

Retrieve the metadata

IsNodeTable ( GraphView.WTableReferenceWithAlias table ) : bool

Checks whether a table reference in the FROM clause is a node table. In GraphView's SELECT statement, a table reference in the FROM clause could also be a regular table.

OptimizeTail ( GraphView.WSelectQueryBlock query, MatchGraph graph ) : void

Marks the node table alias, if it has no outgoing edges in the graph pattern and its node properties are never referenced or projected in the query. Such node table aliases will not appear in the FROM clause in the translated query, but only be materialized in adjacency lists, i.e., table-valued functions.

RematerilizeExtrenalNodeTableReference ( GraphView.WSelectQueryBlock query, MatchNode>.Dictionary nodes ) : void

If a table alias in the MATCH clause is defined in an upper-level context, to be able to translate this MATCH clause, this table alias must be re-materialized in the FROM clause of the current context and joined with the corresponding table in the upper-level context.

RetrieveStatistics ( MatchGraph graph ) : void

Estimates the average degree of the edges and retrieve density value. Send sa query to retrieve the varbinary of the sink in the edge sampling table with edge predicates, then generates the statistics histogram for each edge

TransformPathInfoDisplaySelectElement ( GraphView.WSelectQueryBlock query, MatchPath>.Dictionary pathDictionary ) : void

If paths is referenced in the MATCH clause, checks the SELECT elements to decide whether the paths informaion is needed to be displayed. If PathAlias.* occurs in the SELECT elements, sets the corresponding bool value in MatchPath, and replaces this element with an scalar function to display readable path information

UpdateQuery ( GraphView.WSelectQueryBlock node, List components ) : void

Update FROM clause, adds DOWNSIZE predicates in the corresponding join conditions, and add corresponding predicates on the spilt nodes in the WHERE clause using optimal component of each connected sub-graph.

Method Details

Invoke() public method

public Invoke ( WSqlFragment node ) : void
node WSqlFragment
return void

TranslateMatchClauseVisitor() public method

public TranslateMatchClauseVisitor ( SqlTransaction tx ) : System
tx System.Data.SqlClient.SqlTransaction
return System

Visit() public method

public Visit ( GraphView.WDeclareVariableStatement node ) : void
node GraphView.WDeclareVariableStatement
return void

Visit() public method

Records the declared parameter in the Store Procedure Statement
public Visit ( GraphView.WProcedureStatement node ) : void
node GraphView.WProcedureStatement
return void

Visit() public method

The entry point of the optimizer, activated when visting each SELECT query block.
public Visit ( GraphView.WSelectQueryBlock node ) : void
node GraphView.WSelectQueryBlock The SELECT query block
return void