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

Disable `.is(neq(' cypher.null'))` Gremlin token for Cyphter statements that contains `WITH` clause

Open sbespalov opened this issue 5 years ago • 7 comments
trafficstars

I have following Cyphter statement:

MATCH (n:`RepositoryArtifactIdGroup`)  
WHERE n.`uuid` = '364be4ec-6d2f-464a-bad0-1e0a65241cd5'  
WITH n 
MATCH (n)-[r_r1:`RepositoryArtifactIdGroupEntity_ArtifactGroupEntity`]->(a1:`ArtifactGroup`) 
WITH n, r_r1, a1 
RETURN n, r_r1, a1

This statement produce following Gremlin query:

g.V()
    .as('n')
    .hasLabel('RepositoryArtifactIdGroup')
    .has('uuid', eq('a707bad0-bb6a-4308-a7aa-f8d7b4f7cf2a'))
    .as('n')
    .is(neq('  cypher.null'))
    .outE('RepositoryArtifactIdGroupEntity_ArtifactGroupEntity')
    .as('r_r1')
    .inV()
    .as('a1')
    .hasLabel('ArtifactGroup')
    .select('n', 'r_r1', 'a1')
    .project('n', 'r_r1', 'a1')
    .by(__.select('n')).by(__.select('r_r1')).by(__.select('a1')).as('  GENERATED4')
    .select('n').as('n').select('  GENERATED4')
    .select('r_r1').as('r_r1')
    .select('  GENERATED4')
    .select('a1').as('a1')
    .select('n', 'r_r1', 'a1')
    .project('n', 'r_r1', 'a1')
    .by(__.select('n').valueMap().with('~tinkerpop.valueMap.tokens'))
    .by(__.select('r_r1')
    .project('  cypher.element', '  cypher.inv', '  cypher.outv')
    .by(__.valueMap()
    .with('~tinkerpop.valueMap.tokens'))
    .by(__.inV().id()
    ).by(__.outV().id()))
    .by(__.select('a1').valueMap().with('~tinkerpop.valueMap.tokens'))

There is also index on uuid property for RepositoryArtifactIdGroup vertex in JanusGraph, so I expect this query should trigger this index.

The problem is that for some reason index not triggered directly this way, but it works fine without .is(neq(' cypher.null')) token. I am not sure does it JanusGrapth issue or not but however it will be good to optionally disable this cypher.null to be generated.

Is it possible to have such option?

sbespalov avatar Dec 09 '19 05:12 sbespalov

such option will also make possible to avoid parameters in-lining which mentioned here

sbespalov avatar Dec 09 '19 06:12 sbespalov

@dwitry could you please share your thoughts on this?

sbespalov avatar Feb 19 '20 05:02 sbespalov

Any updates on this? Please, advise!

carlspring avatar Mar 18 '20 19:03 carlspring

Hey @dwitry, have you had a chance to have a look at this yet? :)

steve-todorov avatar Mar 20 '20 13:03 steve-todorov

@sbespalov @steve-todorov This change requires either implementing optimization strategy or introduce an inlining option. Both of these changes require significant efforts in development and testing. Currently, all my attention is focused on other areas, and I can not provide any terms when this could be implemented. The best I can do is review and merge PR if there are any volunteers.

dwitry avatar Mar 24 '20 11:03 dwitry

@dwitry ,

Thanks for your reply! Would it be possible to outline the list of tasks that you think would be required in order to implement/fix this?

carlspring avatar Mar 24 '20 21:03 carlspring

有人怎么解决的吗?求分享下了。

panxianglei avatar Apr 01 '20 13:04 panxianglei