Skip to content

Optimize selection inlining in Fusion query planner#10112

Open
michaelstaib wants to merge 1 commit into
mainfrom
mst/planner-optimization
Open

Optimize selection inlining in Fusion query planner#10112
michaelstaib wants to merge 1 commit into
mainfrom
mst/planner-optimization

Conversation

@michaelstaib

Copy link
Copy Markdown
Member

No description provided.

Copilot AI review requested due to automatic review settings July 13, 2026 23:21

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR optimizes Fusion’s query planning requirement-selection inlining by avoiding a full syntax-tree rewrite and instead walking only selection-set-bearing nodes (fields and inline fragments), reducing work on hot planning paths.

Changes:

  • Refactors OperationPlanner.InlineSelections to rewrite selection sets directly (and exposes it as internal for test coverage).
  • Adds focused tests validating inlining behavior when multiple selection sets share the same target id (including inlineInternal semantics).
  • Aligns benchmark CorpusPaths namespace with the rest of the Fusion execution benchmarks.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
src/HotChocolate/Fusion/test/Fusion.Execution.Tests/Planning/OperationPlannerSelectionInliningTests.cs Adds regression tests for selection-set id merging and inlining semantics.
src/HotChocolate/Fusion/src/Fusion.Execution/Planning/OperationPlanner.cs Refactors selection inlining to a targeted selection-set traversal for performance.
src/HotChocolate/Fusion/benchmarks/Fusion.Execution.Benchmarks/CorpusPaths.cs Updates namespace to match the benchmark project’s established namespace.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +3517 to 3520
var size = selectionSet.Selections.Count + selectionsToInline.Selections.Count;
var selections = new List<ISelectionNode>(size);
selections.AddRange(originalSelectionSet.Selections);

@github-actions

Copy link
Copy Markdown
Contributor

Patch coverage

91.1% of changed lines covered (72/79)

File Covered Changed Patch %
…/Fusion/src/Fusion.Execution/Planning/OperationPlanner.cs 72 79 91.1% 🟡
Uncovered changed lines (JSON)
{
  "sha": "68d0c5e0f8568a96a02d90a19427a29b35967bcd",
  "files": [
    { "path": "src/HotChocolate/Fusion/src/Fusion.Execution/Planning/OperationPlanner.cs", "ranges": [[3459, 3462], [3481, 3481], [3534, 3535]] }
  ]
}

Project coverage: 53.7% (230662/429496 lines)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants