cypher-for-gremlin icon indicating copy to clipboard operation
cypher-for-gremlin copied to clipboard

Extra gremlin step

Open mad opened this issue 5 years ago • 1 comments

Consider next query

MATCH (n:V) 
WHERE n.p = '123'
RETURN count(n)"

And translated gremlin

g.V().hasLabel('V')
        .has('p', eq('123'))
        .is(neq('  cypher.null'))
        .count()
        .project('count').by(__.identity())

It seems is step is redundant here

That extra step introduce some issue for JG optimizer and index can't be used. I think JG optimizer may be improvement too

mad avatar Sep 25 '19 12:09 mad

Translation adds null guards in a lot of places, to avoid Gremlin steps failing on null or cypher.null (null placeholder), sometimes redundantly.

Removing useless null guards could be improved, although it is not a straight-forward task.

dwitry avatar Sep 25 '19 14:09 dwitry