-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
fix(query): Do not execute filters if there are no source uids (#7962… #8452
Conversation
|
@@ -230,25 +230,27 @@ type Function struct { | |||
// SubGraph is the way to represent data. It contains both the request parameters and the response. | |||
// Once generated, this can then be encoded to other client convenient formats, like GraphQL / JSON. | |||
// SubGraphs are recursively nested. Each SubGraph contain the following: | |||
// * SrcUIDS: A list of UIDs that were sent to this query. If this subgraph is a child graph, then the |
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.
Are we changing anything significant in the comments?
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.
No, we are not. But these are go fmt changes which can be safely accepted.
@@ -2210,6 +2212,10 @@ func ProcessGraph(ctx context.Context, sg, parent *SubGraph, rch chan error) { | |||
} | |||
|
|||
filter.SrcUIDs = sg.DestUIDs | |||
if len(filter.SrcUIDs.Uids) == 0 { |
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.
Is there an existing test for this scenario?
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.
I added a test TestFilterWithNoSrcUid
here.
91db90e
to
cce6ab7
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.
LGTM. Thanks for bringing in the change and adding the test.
No need to execute filter subgraph if there are no source UIDs.
(cherry picked from commit 849b587)
Description
The original PR adds a fail fast methodology, where it doesn't expand on a filter subgraph if the srcUid is nil. The current cherry-pick PR brings that change in and adds a test case that scenario.
Test
TestFilterWithNoSrcUid