Skip to content

transformable IncrementalExecutionResult #3693

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

jbellenger
Copy link
Contributor

@jbellenger jbellenger commented Aug 23, 2024

Calling IncrementalExecutionResult.transform will return an ExecutionResultImpl (rather than another IncrementalExecutionResult), which can cause incremental parts of the execution result to get lost.

This makes it difficult to add @defer support to a system with existing instrumentations, which might modify an ExecutionResult without knowing that it needs to be handled differently if it is incremental.

This PR overrides the implementation of IncrementalExecutionResult.transform to ensure that the transformed result retains its incremental nature.

@jbellenger jbellenger marked this pull request as ready for review August 23, 2024 17:32
@@ -52,6 +53,13 @@ public static Builder fromExecutionResult(ExecutionResult executionResult) {
return new Builder().from(executionResult);
}

@Override
public IncrementalExecutionResult transform(Consumer<ExecutionResult.Builder<?>> builderConsumer) {
Copy link
Contributor Author

@jbellenger jbellenger Aug 23, 2024

Choose a reason for hiding this comment

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

It would be nice if this Consumer was actually for type IncrementalExecutionResult.Builder, but changing it would either break the override or require adding more generics to ExecutionResult.

As written, the builder given to the consumer is castable to IncrementalExecutionResult.Builder, which is better than nothing. I'm open to feedback/ideas on how to get better typing.

Copy link
Member

Choose a reason for hiding this comment

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

Good point.
That's a tricky problem though, and I can't think of a nice solution right now.
I'm happy to merge the PR as is if it unblocks you.

@andimarek andimarek added this pull request to the merge queue Aug 26, 2024
Merged via the queue into graphql-java:master with commit 435de80 Aug 26, 2024
1 check passed
@andimarek andimarek added this to the 23.x: breaking changes milestone Aug 27, 2024
@dondonz
Copy link
Member

dondonz commented Sep 5, 2024

Hi @jbellenger thanks for the fix! Later today I will release v22.3 which will include your PR, in case you need a point version release for work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants