Skip to content

Commit

Permalink
fixes an issue where unwind doesn't work on null map of outNull
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewpeterkort committed Jan 17, 2025
1 parent 337df00 commit 0fc1119
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 10 deletions.
12 changes: 11 additions & 1 deletion conformance/tests/ot_null.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,19 @@ def test_returnNil(man):
#print(i)
count_1 += 1

return errors
return errors

def test_returnNilUnwind(man):
errors = []

G = man.setGraph("swapi")

# outNull generates null maps that must be skipped in the unwind step. Was causing segfault before.
for i in G.query().V().outNull("species").unwind('eye_colors'):
if i['data']['eye_colors'] is not None and not isinstance(i['data']['eye_colors'], str):
errors.append("expecting i['eye_colors'] to be string after unwind but got %s instead" % i['eye_colors'])

return errors
def test_hasLabelOut(man):
errors = []

Expand Down
21 changes: 12 additions & 9 deletions engine/core/processors.go
Original file line number Diff line number Diff line change
Expand Up @@ -564,16 +564,19 @@ func (r *Unwind) Process(ctx context.Context, man gdbi.Manager, in gdbi.InPipe,
}
} else {
cur := t.GetCurrent()
o := gdbi.DataElement{
ID: cur.Get().ID,
Label: cur.Get().Label,
From: cur.Get().From,
To: cur.Get().To,
Data: copy.DeepCopy(cur.Get().Data).(map[string]interface{}), Loaded: true,
// if outnull returns null cur can be empty
if cur.Get() != nil {
o := gdbi.DataElement{
ID: cur.Get().ID,
Label: cur.Get().Label,
From: cur.Get().From,
To: cur.Get().To,
Data: copy.DeepCopy(cur.Get().Data).(map[string]interface{}), Loaded: true,
}
n := t.AddCurrent(&o)
gdbi.TravelerSetValue(n, r.Field, nil)
out <- n
}
n := t.AddCurrent(&o)
gdbi.TravelerSetValue(n, r.Field, nil)
out <- n
}
}
}()
Expand Down

0 comments on commit 0fc1119

Please sign in to comment.