-
-
Notifications
You must be signed in to change notification settings - Fork 799
[Fusion] Add conditions to plan nodes #8789
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
f8a11f9
to
c270543
Compare
c270543
to
c7bddb8
Compare
c7bddb8
to
f7068c9
Compare
There was a problem hiding this comment.
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 adds support for conditions to execution plan nodes in the Fusion GraphQL system. The changes enable the execution planner to extract conditional directives (@Skip and @include) from GraphQL operations and represent them as execution node conditions, allowing for optimized conditional execution.
Key changes:
- Added ExecutionNodeCondition class to represent conditional directives
- Extended execution nodes with condition support and evaluation logic
- Updated execution planner to extract and process conditional selections
- Modified serialization/deserialization to handle node conditions
Reviewed Changes
Copilot reviewed 77 out of 77 changed files in this pull request and generated 3 comments.
Show a summary per file
File | Description |
---|---|
Test snapshot files | Updated to reflect new condition and forwardedVariables fields in execution plans |
ConditionalTests.cs | Added comprehensive test cases for conditional directive handling across different scenarios |
WorkItem.cs | Changed visibility from public to internal for planning components |
OperationPlanStep.cs | Added Conditions property and Lookup field to plan steps |
NodeFieldPlanStep.cs | Added Conditions property and renamed from NodePlanStep |
Various planning files | Updated to support condition extraction and node field work items |
ExecutionNode classes | Added condition support with evaluation logic in base ExecutionNode |
Serialization classes | Updated formatters and parsers to handle conditions in JSON/YAML output |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
If either all selections on the root level or below a lookup are conditional, we can pull out those conditions directly onto the execution node and skip execution entirely, if the conditions are not met.
For example for this operation
we can generate this execution node
This PR does not yet account for all edge cases that come with this.
For a fully functional solution we'll also have to rewrite the
SelectionSetPartitioner
as it's currently not preserving conditional inline fragments around selections.