Skip to content
Snippets Groups Projects
Unverified Commit 77cc3a66 authored by Jay Chiu's avatar Jay Chiu
Browse files

Update

parent 883e51c6
No related branches found
No related tags found
No related merge requests found
......@@ -46,7 +46,12 @@ func (u *UIDList) Get(i int) uint64 {
// Size returns size of UIDList.
func (u *UIDList) Size() int {
x.Assert(u != nil)
if u == nil {
// In a subgraph node, in processGraph, sometimes we might fan out to zero
// nodes, i.e., sg.destUIDs is empty. In this case, child subgraph might not
// have its srcUIDs initialized.
return 0
}
if u.list != nil {
return u.list.UidsLength()
}
......
......@@ -164,6 +164,7 @@ func mergeInterfaces(i1 interface{}, i2 interface{}) interface{} {
// postTraverse traverses the subgraph recursively and returns final result for the query.
func postTraverse(sg *SubGraph) (map[uint64]interface{}, error) {
// No need to check for nil as Size() will return 0 in that case.
if sg.srcUIDs.Size() == 0 {
return nil, nil
}
......@@ -819,7 +820,7 @@ func ProcessGraph(ctx context.Context, sg *SubGraph, taskQuery []byte, rch chan
}
if sg.destUIDs.Size() == 0 {
// Looks like we're done here.
// Looks like we're done here. Be careful with nil srcUIDs!
x.Trace(ctx, "Zero uids. Num attr children: %v", len(sg.Children))
rch <- nil
return
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment