JG 0.6 vs JG 1.0 different behaviour for same Gremlin query
Hi All,
I have noticed some difference between JG 0.6 and JG 1.0.
I have a person node created as follows: g.addV('person').property('firstName', 'John').property('lastName', 'Doe')
Then I run the following query:
g.V().
has("firstName", "John").
has("lastName", "Doe").
project("firstName", "lastName", "fullName").
by("firstName").
by("lastName").
by("fullName")
On JG 0.6, the result was:
==>{firstName=John, lastName=Doe, fullName=null}
On JG 1.0, the result is:
==>{firstName=John, lastName=Doe}
So, for some reason, JG 1.0 does not seem to return the 'null' fullName any more. Could you please help me if this behaviour is expected? Thank you.
Solution:Jump to solution
I did some more digging. It seems that this is not related to JanusGraph but to TinkerPop.
Once I used Gremlin Console 3.5.5 and loaded "Modern" graph, executing "g.V().project('name', 'age').by('name').by('age')" returns:
==>[name:marko,age:29]
==>[name:vadas,age:27]...
1 Reply
Solution
I did some more digging. It seems that this is not related to JanusGraph but to TinkerPop.
Once I used Gremlin Console 3.5.5 and loaded "Modern" graph, executing "g.V().project('name', 'age').by('name').by('age')" returns:
==>[name:marko,age:29]
==>[name:vadas,age:27]
==>[name:lop,age:null]
==>[name:josh,age:32]
==>[name:ripple,age:null]
==>[name:peter,age:35]
Doing the same with Gremlin Console 3.7.0, results:
==>[name:marko,age:29]
==>[name:vadas,age:27]
==>[name:lop]
==>[name:josh,age:32]
==>[name:ripple]
==>[name:peter,age:35]
So, it seems that TinkerPop 3.7.0, omits null values from the project result.
After some more digging, it turned out that this was already introduced by TinkerPop 3.6.0.
So, more details here: https://tinkerpop.apache.org/docs/current/upgrade/#_consistent_by_behavior