Removing circular references from Plan Comparison (#1498)

This commit is contained in:
Aasim Khan
2022-05-18 00:13:26 -07:00
committed by GitHub
parent 91db096b09
commit e7c7489b21
3 changed files with 6 additions and 12 deletions

View File

@@ -34,7 +34,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ExecutionPlan.Contracts
/// <summary>
/// List of matching nodes for the ExecutionGraphComparisonResult.
/// </summary>
public List<ExecutionGraphComparisonResult> MatchingNodes { get; set; } = new List<ExecutionGraphComparisonResult>();
public List<int> MatchingNodesId { get; set; } = new List<int>();
/// <summary>
/// The parent of the ExecutionGraphComparisonResult.
/// </summary>

View File

@@ -197,12 +197,10 @@ GO
{
var curNode = queue.Dequeue();
for (int index = 0; index < curNode.MatchingNodes.Count; ++index)
for (int index = 0; index < curNode.MatchingNodesId.Count; ++index)
{
var matchingId = curNode.MatchingNodes[index].BaseNode.ID;
var matchingNode = srcGraphLookupTable[matchingId];
curNode.MatchingNodes[index] = matchingNode;
var matchingId = curNode.MatchingNodesId[index];
curNode.MatchingNodesId[index] = matchingId;
}
foreach (var child in curNode.Children)

View File

@@ -99,12 +99,9 @@ namespace Microsoft.SqlTools.ServiceLayer.ExecutionPlan.ShowPlan.Comparison
curNodeDTO.BaseNode = ExecutionPlanGraphUtils.ConvertShowPlanTreeToExecutionPlanTree(curNode.BaseNode);
curNodeDTO.GroupIndex = curNode.GroupIndex;
curNodeDTO.HasMatch = curNode.HasMatch;
curNodeDTO.MatchingNodes = curNode.MatchingNodes.Select(matchingNode =>
curNodeDTO.MatchingNodesId = curNode.MatchingNodes.Select(matchingNode =>
{
var skeletonNodeDTO = new Contracts.ExecutionGraphComparisonResult();
skeletonNodeDTO.BaseNode = ExecutionPlanGraphUtils.ConvertShowPlanTreeToExecutionPlanTree(matchingNode.BaseNode);
return skeletonNodeDTO;
return matchingNode.BaseNode.ID;
}).ToList();
foreach (var child in curNode.Children)
@@ -112,7 +109,6 @@ namespace Microsoft.SqlTools.ServiceLayer.ExecutionPlan.ShowPlan.Comparison
queue.Enqueue(child);
var childDTO = new Contracts.ExecutionGraphComparisonResult();
childDTO.ParentNode = curNodeDTO;
curNodeDTO.Children.Add(childDTO);
dtoQueue.Enqueue(childDTO);
}