Skip to content
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

Defer: split queries into primary and deferred queries for format_response #1178

Closed
Tracked by #80
bnjjj opened this issue Jun 2, 2022 · 2 comments
Closed
Tracked by #80
Assignees

Comments

@bnjjj
Copy link
Contributor

bnjjj commented Jun 2, 2022

Related to #80

The query is split regarding the @defer directive. If we could statically detect that the selection will be deferred then we just skip it from the primary selection. If not we will clone the selection into deferred_queries and also keep it in the primary query to be able to detect at the execution stage if it's a deferred selection or not. For now we split all deferred queries either if it's an entity or just a field of an entity. It might change.

For example with that schema:

type Query {
    foo: String
    stuff: Bar
    array: [Bar]
    baz: String
    other: String
}
type Bar {
    bar: String
    baz: String
    iz: Iz
}
type Iz {
    field: String
    another: String
}

with this query:

query Test {
    baz
    array {
        bar
    }
    ... @defer {
        foo
        other
        stuff {
            baz
            ... @defer {
                bar
                iz {
                    field
                    another
                }
            }
        }
    }
}

We should have 1 primary query:

query Test {
    baz
    array {
        bar
    }
}

and 2 deferred queries:

{
    foo
    other
    stuff {
        baz
    }
}
{
    bar
    iz {
        field
        another
    }
}
@bnjjj bnjjj self-assigned this Jun 2, 2022
@bnjjj
Copy link
Contributor Author

bnjjj commented Jun 2, 2022

@pcmanus could you correct me if I'm wrong.please ?

@bnjjj
Copy link
Contributor Author

bnjjj commented Jun 2, 2022

Not useful anymore since we can fetch it from the query planner in subselection field

@bnjjj bnjjj closed this as completed Jun 2, 2022
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 a pull request may close this issue.

1 participant