mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-02-16 18:47:57 -05:00
Adding decimal values to costs (#1449)
This commit is contained in:
@@ -41,7 +41,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ExecutionPlan
|
|||||||
Cost = currentNode.Cost,
|
Cost = currentNode.Cost,
|
||||||
SubTreeCost = currentNode.SubtreeCost,
|
SubTreeCost = currentNode.SubtreeCost,
|
||||||
Description = currentNode.Description,
|
Description = currentNode.Description,
|
||||||
Subtext = currentNode.GetDisplayLinesOfText(),
|
Subtext = currentNode.GetDisplayLinesOfText(true),
|
||||||
RelativeCost = currentNode.RelativeCost,
|
RelativeCost = currentNode.RelativeCost,
|
||||||
Properties = GetProperties(currentNode.Properties),
|
Properties = GetProperties(currentNode.Properties),
|
||||||
Children = currentNode.Children.Select(x => ConvertShowPlanTreeToExecutionPlanTree(x)).ToList(),
|
Children = currentNode.Children.Select(x => ConvertShowPlanTreeToExecutionPlanTree(x)).ToList(),
|
||||||
|
|||||||
@@ -363,7 +363,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ExecutionPlan.ShowPlan
|
|||||||
get { return this.root; }
|
get { return this.root; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public Graph Graph
|
public ShowPlanGraph Graph
|
||||||
{
|
{
|
||||||
get => this.graph;
|
get => this.graph;
|
||||||
set
|
set
|
||||||
@@ -580,7 +580,13 @@ namespace Microsoft.SqlTools.ServiceLayer.ExecutionPlan.ShowPlan
|
|||||||
/// Gets lines of text displayed under the icon.
|
/// Gets lines of text displayed under the icon.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>Array of strings.</returns>
|
/// <returns>Array of strings.</returns>
|
||||||
public string[] GetDisplayLinesOfText()
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets lines of text displayed under the icon.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="roundCostForSmallGraph">Converts decimal costs in case of graph with less than 20 nodes.</param>
|
||||||
|
/// <returns>Array of strings.</returns>
|
||||||
|
public string[] GetDisplayLinesOfText(bool roundCostForSmallGraph = false)
|
||||||
{
|
{
|
||||||
string newDisplayNameLines = this.DisplayName;
|
string newDisplayNameLines = this.DisplayName;
|
||||||
|
|
||||||
@@ -589,7 +595,10 @@ namespace Microsoft.SqlTools.ServiceLayer.ExecutionPlan.ShowPlan
|
|||||||
|
|
||||||
if (!this.HasPDWCost || cost > 0)
|
if (!this.HasPDWCost || cost > 0)
|
||||||
{
|
{
|
||||||
string costText = SR.CostFormat((int)Math.Round(cost));
|
if(roundCostForSmallGraph && this.graph != null && this.graph.NodeStmtMap.Count < 20){
|
||||||
|
cost = Math.Round(cost);
|
||||||
|
}
|
||||||
|
string costText = SR.CostFormat(cost.ToString("0.##"));
|
||||||
newDisplayNameLines += '\n' + costText;
|
newDisplayNameLines += '\n' + costText;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -713,7 +722,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ExecutionPlan.ShowPlan
|
|||||||
private readonly string objectProperty = NodeBuilderConstants.Object;
|
private readonly string objectProperty = NodeBuilderConstants.Object;
|
||||||
private readonly string predicateProperty = NodeBuilderConstants.LogicalOp;
|
private readonly string predicateProperty = NodeBuilderConstants.LogicalOp;
|
||||||
private Node parent;
|
private Node parent;
|
||||||
private Graph graph;
|
private ShowPlanGraph graph;
|
||||||
private Edge parentEdge;
|
private Edge parentEdge;
|
||||||
private List<Edge> childrenEdges;
|
private List<Edge> childrenEdges;
|
||||||
private string nodeType;
|
private string nodeType;
|
||||||
|
|||||||
@@ -9306,7 +9306,7 @@ namespace Microsoft.SqlTools.ServiceLayer
|
|||||||
return Keys.GetString(Keys.MoreThanOneAzureFunctionWithName, functionName, fileName);
|
return Keys.GetString(Keys.MoreThanOneAzureFunctionWithName, functionName, fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string CostFormat(int x)
|
public static string CostFormat(string x)
|
||||||
{
|
{
|
||||||
return Keys.GetString(Keys.CostFormat, x);
|
return Keys.GetString(Keys.CostFormat, x);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3453,7 +3453,7 @@
|
|||||||
<data name="CostFormat" xml:space="preserve">
|
<data name="CostFormat" xml:space="preserve">
|
||||||
<value>Cost: {0} %</value>
|
<value>Cost: {0} %</value>
|
||||||
<comment>"Cost: {0} percent" String to format.
|
<comment>"Cost: {0} percent" String to format.
|
||||||
Parameters: 0 - x (int) </comment>
|
Parameters: 0 - x (string) </comment>
|
||||||
</data>
|
</data>
|
||||||
<data name="RemoteDataAccess" xml:space="preserve">
|
<data name="RemoteDataAccess" xml:space="preserve">
|
||||||
<value>Remote Data Access</value>
|
<value>Remote Data Access</value>
|
||||||
|
|||||||
@@ -1646,7 +1646,7 @@ ActualExecModeDesc = Actual Execution Mode
|
|||||||
EstimatedExecMode = Estimated Execution Mode
|
EstimatedExecMode = Estimated Execution Mode
|
||||||
EstimatedExecModeDesc = Estimated Execution Mode
|
EstimatedExecModeDesc = Estimated Execution Mode
|
||||||
;"Cost: {0} percent" String to format
|
;"Cost: {0} percent" String to format
|
||||||
CostFormat(int x) = Cost: {0} %
|
CostFormat(string x) = Cost: {0} %
|
||||||
; Remote Data Access
|
; Remote Data Access
|
||||||
RemoteDataAccess = Remote Data Access
|
RemoteDataAccess = Remote Data Access
|
||||||
RemoteDataAccessDescription = Whether the operator uses remote procedure call (RPC) to access remote data.
|
RemoteDataAccessDescription = Whether the operator uses remote procedure call (RPC) to access remote data.
|
||||||
|
|||||||
Reference in New Issue
Block a user