Skip to content

Commit 2ad8c67

Browse files
Merge pull request #903 from erikdarlingdata/sync/parallelism-columnstore-icons-from-ps
Sync columnstore + Parallelism subtype icons from PerformanceStudio
2 parents 96b708f + 0c9303e commit 2ad8c67

10 files changed

Lines changed: 92 additions & 6 deletions
8.08 KB
Loading
8.12 KB
Loading
10.4 KB
Loading

Dashboard/Services/PlanIconMapper.cs

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,8 +175,44 @@ public static class PlanIconMapper
175175
["Language Construct Catch All"] = "language_construct_catch_all",
176176
};
177177

178-
public static string GetIconName(string physicalOp)
178+
public static string GetIconName(string physicalOp, string? storageType = null, string? logicalOp = null)
179179
{
180+
// Parallelism subtypes: PhysicalOp="Parallelism" + LogicalOp identifies which.
181+
if (string.Equals(physicalOp, "Parallelism", StringComparison.Ordinal) && logicalOp != null)
182+
{
183+
switch (logicalOp)
184+
{
185+
case "Repartition Streams": return "parallelism_repartition_streams";
186+
case "Distribute Streams": return "parallelism_distribute_streams";
187+
case "Gather Streams": return "parallelism_gather_streams";
188+
}
189+
}
190+
191+
// Columnstore scans surface as PhysicalOp="Clustered Index Scan" / "Index Scan"
192+
// with Storage="ColumnStore" on the Object element. Route to the columnstore icon.
193+
if (string.Equals(storageType, "ColumnStore", StringComparison.OrdinalIgnoreCase))
194+
{
195+
switch (physicalOp)
196+
{
197+
case "Clustered Index Scan":
198+
case "Index Scan":
199+
case "Columnstore Index Scan":
200+
return "columnstore_index_scan";
201+
case "Clustered Index Delete":
202+
case "Index Delete":
203+
return "columnstore_index_delete";
204+
case "Clustered Index Insert":
205+
case "Index Insert":
206+
return "columnstore_index_insert";
207+
case "Clustered Index Update":
208+
case "Index Update":
209+
return "columnstore_index_update";
210+
case "Clustered Index Merge":
211+
case "Index Merge":
212+
return "columnstore_index_merge";
213+
}
214+
}
215+
180216
if (IconMap.TryGetValue(physicalOp, out var iconName))
181217
return iconName;
182218

Dashboard/Services/ShowPlanParser.cs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -665,8 +665,10 @@ private static PlanNode ParseRelOp(XElement relOpEl)
665665
node.PhysicalOp = "Lazy " + node.PhysicalOp;
666666
}
667667

668-
// Map to icon
669-
node.IconName = PlanIconMapper.GetIconName(node.PhysicalOp);
668+
// Icon mapping is deferred until after StorageType and LogicalOp are
669+
// parsed below, so columnstore scans (Clustered/Index Scan with
670+
// Storage="ColumnStore") and Parallelism subtypes route to their
671+
// specific icons.
670672

671673
// Handle operator-specific element
672674
var physicalOpEl = GetOperatorElement(relOpEl);
@@ -1365,6 +1367,11 @@ private static PlanNode ParseRelOp(XElement relOpEl)
13651367
}
13661368
}
13671369

1370+
// Map to icon — done here so columnstore scans (Clustered/Index Scan
1371+
// with Storage="ColumnStore") and Parallelism subtypes (which depend on
1372+
// LogicalOp) can be routed to their specific icons.
1373+
node.IconName = PlanIconMapper.GetIconName(node.PhysicalOp, node.StorageType, node.LogicalOp);
1374+
13681375
// Recurse into child RelOps
13691376
foreach (var childRelOp in FindChildRelOps(relOpEl))
13701377
{
8.08 KB
Loading
8.12 KB
Loading
10.4 KB
Loading

Lite/Services/PlanIconMapper.cs

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,8 +175,44 @@ public static class PlanIconMapper
175175
["Language Construct Catch All"] = "language_construct_catch_all",
176176
};
177177

178-
public static string GetIconName(string physicalOp)
178+
public static string GetIconName(string physicalOp, string? storageType = null, string? logicalOp = null)
179179
{
180+
// Parallelism subtypes: PhysicalOp="Parallelism" + LogicalOp identifies which.
181+
if (string.Equals(physicalOp, "Parallelism", StringComparison.Ordinal) && logicalOp != null)
182+
{
183+
switch (logicalOp)
184+
{
185+
case "Repartition Streams": return "parallelism_repartition_streams";
186+
case "Distribute Streams": return "parallelism_distribute_streams";
187+
case "Gather Streams": return "parallelism_gather_streams";
188+
}
189+
}
190+
191+
// Columnstore scans surface as PhysicalOp="Clustered Index Scan" / "Index Scan"
192+
// with Storage="ColumnStore" on the Object element. Route to the columnstore icon.
193+
if (string.Equals(storageType, "ColumnStore", StringComparison.OrdinalIgnoreCase))
194+
{
195+
switch (physicalOp)
196+
{
197+
case "Clustered Index Scan":
198+
case "Index Scan":
199+
case "Columnstore Index Scan":
200+
return "columnstore_index_scan";
201+
case "Clustered Index Delete":
202+
case "Index Delete":
203+
return "columnstore_index_delete";
204+
case "Clustered Index Insert":
205+
case "Index Insert":
206+
return "columnstore_index_insert";
207+
case "Clustered Index Update":
208+
case "Index Update":
209+
return "columnstore_index_update";
210+
case "Clustered Index Merge":
211+
case "Index Merge":
212+
return "columnstore_index_merge";
213+
}
214+
}
215+
180216
if (IconMap.TryGetValue(physicalOp, out var iconName))
181217
return iconName;
182218

Lite/Services/ShowPlanParser.cs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -665,8 +665,10 @@ private static PlanNode ParseRelOp(XElement relOpEl)
665665
node.PhysicalOp = "Lazy " + node.PhysicalOp;
666666
}
667667

668-
// Map to icon
669-
node.IconName = PlanIconMapper.GetIconName(node.PhysicalOp);
668+
// Icon mapping is deferred until after StorageType and LogicalOp are
669+
// parsed below, so columnstore scans (Clustered/Index Scan with
670+
// Storage="ColumnStore") and Parallelism subtypes route to their
671+
// specific icons.
670672

671673
// Handle operator-specific element
672674
var physicalOpEl = GetOperatorElement(relOpEl);
@@ -1365,6 +1367,11 @@ private static PlanNode ParseRelOp(XElement relOpEl)
13651367
}
13661368
}
13671369

1370+
// Map to icon — done here so columnstore scans (Clustered/Index Scan
1371+
// with Storage="ColumnStore") and Parallelism subtypes (which depend on
1372+
// LogicalOp) can be routed to their specific icons.
1373+
node.IconName = PlanIconMapper.GetIconName(node.PhysicalOp, node.StorageType, node.LogicalOp);
1374+
13681375
// Recurse into child RelOps
13691376
foreach (var childRelOp in FindChildRelOps(relOpEl))
13701377
{

0 commit comments

Comments
 (0)