Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions Dashboard/Services/PlanAnalyzer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -399,15 +399,15 @@
}
}

// Rule 15: Join OR clause (Concatenation + Constant Scan pattern)
// Pattern: Concatenation → Compute ScalarConstant Scan (one per OR branch)
// Rule 15: Join OR clause (Concatenation + Constant Scan under Merge Interval)
// Pattern: Merge Interval → TopN SortConcatenation → Constant Scans
if (node.PhysicalOp == "Concatenation")
{
var constantScanBranches = node.Children
.Count(c => c.PhysicalOp == "Constant Scan" ||
c.Children.Any(gc => gc.PhysicalOp == "Constant Scan"));

if (constantScanBranches >= 2 && HasJoinAncestor(node))
if (constantScanBranches >= 2 && HasMergeIntervalAncestor(node))
{
node.Warnings.Add(new PlanWarning
{
Expand Down Expand Up @@ -463,7 +463,7 @@

// Rule 22: Table variables (Object name starts with @)
if (!string.IsNullOrEmpty(node.ObjectName) &&
node.ObjectName.Contains("@"))

Check warning on line 466 in Dashboard/Services/PlanAnalyzer.cs

View workflow job for this annotation

GitHub Actions / build

Use 'string.Contains(char)' instead of 'string.Contains(string)' when searching for a single character (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1847)

Check warning on line 466 in Dashboard/Services/PlanAnalyzer.cs

View workflow job for this annotation

GitHub Actions / build

Use 'string.Contains(char)' instead of 'string.Contains(string)' when searching for a single character (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1847)

Check warning on line 466 in Dashboard/Services/PlanAnalyzer.cs

View workflow job for this annotation

GitHub Actions / build

Use 'string.Contains(char)' instead of 'string.Contains(string)' when searching for a single character (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1847)

Check warning on line 466 in Dashboard/Services/PlanAnalyzer.cs

View workflow job for this annotation

GitHub Actions / build

Use 'string.Contains(char)' instead of 'string.Contains(string)' when searching for a single character (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1847)

Check warning on line 466 in Dashboard/Services/PlanAnalyzer.cs

View workflow job for this annotation

GitHub Actions / build

Use 'string.Contains(char)' instead of 'string.Contains(string)' when searching for a single character (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1847)

Check warning on line 466 in Dashboard/Services/PlanAnalyzer.cs

View workflow job for this annotation

GitHub Actions / build

Use 'string.Contains(char)' instead of 'string.Contains(string)' when searching for a single character (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1847)
{
node.Warnings.Add(new PlanWarning
{
Expand Down Expand Up @@ -612,14 +612,14 @@
}

/// <summary>
/// Checks whether a node has a join operator as an ancestor.
/// Checks whether a node has a Merge Interval ancestor (OR expansion pattern).
/// </summary>
private static bool HasJoinAncestor(PlanNode node)
private static bool HasMergeIntervalAncestor(PlanNode node)
{
var ancestor = node.Parent;
while (ancestor != null)
{
if (ancestor.LogicalOp.Contains("Join", StringComparison.OrdinalIgnoreCase))
if (ancestor.PhysicalOp == "Merge Interval")
return true;
ancestor = ancestor.Parent;
}
Expand Down
12 changes: 6 additions & 6 deletions Lite/Services/PlanAnalyzer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -399,15 +399,15 @@
}
}

// Rule 15: Join OR clause (Concatenation + Constant Scan pattern)
// Pattern: Concatenation → Compute ScalarConstant Scan (one per OR branch)
// Rule 15: Join OR clause (Concatenation + Constant Scan under Merge Interval)
// Pattern: Merge Interval → TopN SortConcatenation → Constant Scans
if (node.PhysicalOp == "Concatenation")
{
var constantScanBranches = node.Children
.Count(c => c.PhysicalOp == "Constant Scan" ||
c.Children.Any(gc => gc.PhysicalOp == "Constant Scan"));

if (constantScanBranches >= 2 && HasJoinAncestor(node))
if (constantScanBranches >= 2 && HasMergeIntervalAncestor(node))
{
node.Warnings.Add(new PlanWarning
{
Expand Down Expand Up @@ -463,7 +463,7 @@

// Rule 22: Table variables (Object name starts with @)
if (!string.IsNullOrEmpty(node.ObjectName) &&
node.ObjectName.Contains("@"))

Check warning on line 466 in Lite/Services/PlanAnalyzer.cs

View workflow job for this annotation

GitHub Actions / build

Use 'string.Contains(char)' instead of 'string.Contains(string)' when searching for a single character (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1847)

Check warning on line 466 in Lite/Services/PlanAnalyzer.cs

View workflow job for this annotation

GitHub Actions / build

Use 'string.Contains(char)' instead of 'string.Contains(string)' when searching for a single character (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1847)

Check warning on line 466 in Lite/Services/PlanAnalyzer.cs

View workflow job for this annotation

GitHub Actions / build

Use 'string.Contains(char)' instead of 'string.Contains(string)' when searching for a single character (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1847)

Check warning on line 466 in Lite/Services/PlanAnalyzer.cs

View workflow job for this annotation

GitHub Actions / build

Use 'string.Contains(char)' instead of 'string.Contains(string)' when searching for a single character (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1847)
{
node.Warnings.Add(new PlanWarning
{
Expand Down Expand Up @@ -612,14 +612,14 @@
}

/// <summary>
/// Checks whether a node has a join operator as an ancestor.
/// Checks whether a node has a Merge Interval ancestor (OR expansion pattern).
/// </summary>
private static bool HasJoinAncestor(PlanNode node)
private static bool HasMergeIntervalAncestor(PlanNode node)
{
var ancestor = node.Parent;
while (ancestor != null)
{
if (ancestor.LogicalOp.Contains("Join", StringComparison.OrdinalIgnoreCase))
if (ancestor.PhysicalOp == "Merge Interval")
return true;
ancestor = ancestor.Parent;
}
Expand Down
Loading