diff --git a/src/Microsoft.SqlTools.ServiceLayer/ExecutionPlan/ExecutionPlanGraphUtils.cs b/src/Microsoft.SqlTools.ServiceLayer/ExecutionPlan/ExecutionPlanGraphUtils.cs
index 1d71d3ee..56271d77 100644
--- a/src/Microsoft.SqlTools.ServiceLayer/ExecutionPlan/ExecutionPlanGraphUtils.cs
+++ b/src/Microsoft.SqlTools.ServiceLayer/ExecutionPlan/ExecutionPlanGraphUtils.cs
@@ -33,7 +33,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ExecutionPlan
}
public static ExecutionPlanNode ConvertShowPlanTreeToExecutionPlanTree(Node currentNode)
- {
+ {
return new ExecutionPlanNode
{
ID = currentNode.ID,
@@ -41,7 +41,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ExecutionPlan
Cost = currentNode.Cost,
SubTreeCost = currentNode.SubtreeCost,
Description = currentNode.Description,
- Subtext = currentNode.GetDisplayLinesOfText(),
+ Subtext = currentNode.GetDisplayLinesOfText(true),
RelativeCost = currentNode.RelativeCost,
Properties = GetProperties(currentNode.Properties),
Children = currentNode.Children.Select(x => ConvertShowPlanTreeToExecutionPlanTree(x)).ToList(),
diff --git a/src/Microsoft.SqlTools.ServiceLayer/ExecutionPlan/ShowPlan/Node.cs b/src/Microsoft.SqlTools.ServiceLayer/ExecutionPlan/ShowPlan/Node.cs
index 57b0f5d9..7247a882 100644
--- a/src/Microsoft.SqlTools.ServiceLayer/ExecutionPlan/ShowPlan/Node.cs
+++ b/src/Microsoft.SqlTools.ServiceLayer/ExecutionPlan/ShowPlan/Node.cs
@@ -363,7 +363,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ExecutionPlan.ShowPlan
get { return this.root; }
}
- public Graph Graph
+ public ShowPlanGraph Graph
{
get => this.graph;
set
@@ -580,7 +580,13 @@ namespace Microsoft.SqlTools.ServiceLayer.ExecutionPlan.ShowPlan
/// Gets lines of text displayed under the icon.
///
/// Array of strings.
- public string[] GetDisplayLinesOfText()
+
+ ///
+ /// Gets lines of text displayed under the icon.
+ ///
+ /// Converts decimal costs in case of graph with less than 20 nodes.
+ /// Array of strings.
+ public string[] GetDisplayLinesOfText(bool roundCostForSmallGraph = false)
{
string newDisplayNameLines = this.DisplayName;
@@ -589,7 +595,10 @@ namespace Microsoft.SqlTools.ServiceLayer.ExecutionPlan.ShowPlan
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;
}
@@ -713,7 +722,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ExecutionPlan.ShowPlan
private readonly string objectProperty = NodeBuilderConstants.Object;
private readonly string predicateProperty = NodeBuilderConstants.LogicalOp;
private Node parent;
- private Graph graph;
+ private ShowPlanGraph graph;
private Edge parentEdge;
private List childrenEdges;
private string nodeType;
diff --git a/src/Microsoft.SqlTools.ServiceLayer/Localization/sr.cs b/src/Microsoft.SqlTools.ServiceLayer/Localization/sr.cs
index d78853bb..60609322 100644
--- a/src/Microsoft.SqlTools.ServiceLayer/Localization/sr.cs
+++ b/src/Microsoft.SqlTools.ServiceLayer/Localization/sr.cs
@@ -9306,7 +9306,7 @@ namespace Microsoft.SqlTools.ServiceLayer
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);
}
diff --git a/src/Microsoft.SqlTools.ServiceLayer/Localization/sr.resx b/src/Microsoft.SqlTools.ServiceLayer/Localization/sr.resx
index 073366a7..65fa910c 100644
--- a/src/Microsoft.SqlTools.ServiceLayer/Localization/sr.resx
+++ b/src/Microsoft.SqlTools.ServiceLayer/Localization/sr.resx
@@ -3453,7 +3453,7 @@
Cost: {0} %
"Cost: {0} percent" String to format.
- Parameters: 0 - x (int)
+ Parameters: 0 - x (string)
Remote Data Access
diff --git a/src/Microsoft.SqlTools.ServiceLayer/Localization/sr.strings b/src/Microsoft.SqlTools.ServiceLayer/Localization/sr.strings
index 817a7f7c..898e8cd9 100644
--- a/src/Microsoft.SqlTools.ServiceLayer/Localization/sr.strings
+++ b/src/Microsoft.SqlTools.ServiceLayer/Localization/sr.strings
@@ -1646,7 +1646,7 @@ ActualExecModeDesc = Actual Execution Mode
EstimatedExecMode = Estimated Execution Mode
EstimatedExecModeDesc = Estimated Execution Mode
;"Cost: {0} percent" String to format
-CostFormat(int x) = Cost: {0} %
+CostFormat(string x) = Cost: {0} %
; Remote Data Access
RemoteDataAccess = Remote Data Access
RemoteDataAccessDescription = Whether the operator uses remote procedure call (RPC) to access remote data.