Skip to content

Commit

Permalink
fix(query): Do not execute filters if there are no source uids (#7962) (
Browse files Browse the repository at this point in the history
#7969)

No need to execute filter subgraph if there are no source UIDs.

(cherry picked from commit 849b587)
  • Loading branch information
ahsanbarkati authored Aug 2, 2021
1 parent 9714cc4 commit f181a70
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions query/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -2246,6 +2246,10 @@ func ProcessGraph(ctx context.Context, sg, parent *SubGraph, rch chan error) {
}

filter.SrcUIDs = codec.ToList(sg.DestMap)
if codec.ListCardinality(filter.SrcUIDs) == 0 {
filterChan <- nil
continue
}
// Passing the pointer is okay since the filter only reads.
filter.Params.ParentVars = sg.Params.ParentVars // Pass to the child.
go ProcessGraph(ctx, filter, sg, filterChan)
Expand Down

0 comments on commit f181a70

Please sign in to comment.