[ 
https://issues.apache.org/jira/browse/TINKERPOP-2854?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17679134#comment-17679134
 ] 

Andrea Santurbano commented on TINKERPOP-2854:
----------------------------------------------

[~spmallette] thank you so much! 

I'm very sorry, maybe is my lack of knowledge so, please I beg your pardon if 
I'm saying something stupid.

Why do you think the problem is in the transpiler? The instance of Class 
{*}org.apache.tinkerpop.gremlin.server.op.traversal.{*}*TraversalOpProcessor* 
gets this as a query (I saw it in the debugger):

 
{code:java}
[[], [inject(  cypher.start), map([[], [project(  GENERATED1,   GENERATED2,   
GENERATED3), by([[], [constant(1)]]), by([[], [constant(2)]]), by([[], 
[constant(3)]]), select(values)]]), project(r), by([[], [project(  GENERATED5,  
 GENERATED6,   GENERATED7), by([[], [identity()]]), by([[], [choose([[], 
[constant(binding[from=3])]], [[], [constant(binding[from=3])]], [[], 
[constant(  cypher.null)]])]]), by([[], [choose([[], 
[constant(binding[to=1])]], [[], [constant(binding[to=1])]], [[], [constant(  
cypher.null)]])]]), select(values), 
map(lambda[cypherListSlice().apply(it)])]])]]{code}
Which is the correct query, and the TraversalOpProcessor itself produces the 
wrong Traversal with the IN and OUT constants.

The problem could be the transpiler if it would produce a wrong bytecode query 
but this is not the case. The query is compliant with what we are asking to 
traverse.

Is there any test case in Gremlin that has a bytecode query in input and the 
Traversal as Output so maybe I can provide a use-case that definitely excludes 
the transpiler from our discussion.

Thank you so much

Andrea

 

> Generated Traversal differs from v3.4.13 to v3.6.1
> --------------------------------------------------
>
>                 Key: TINKERPOP-2854
>                 URL: https://issues.apache.org/jira/browse/TINKERPOP-2854
>             Project: TinkerPop
>          Issue Type: Bug
>    Affects Versions: 3.6.1
>            Reporter: Andrea Santurbano
>            Priority: Major
>
> Hi everybody,
> I'm playing with Gremlin and OpenCypher query transpiler by using the 
> following bytecode query:
> {code:java}
> [[], [inject(  cypher.start), map([[], [project(  GENERATED1,   GENERATED2,   
> GENERATED3), by([[], [constant(1)]]), by([[], [constant(2)]]), by([[], 
> [constant(3)]]), select(values)]]), project(r), by([[], [project(  
> GENERATED5,   GENERATED6,   GENERATED7), by([[], [identity()]]), by([[], 
> [choose([[], [constant(binding[from=3])]], [[], [constant(binding[from=3])]], 
> [[], [constant(  cypher.null)]])]]), by([[], [choose([[], 
> [constant(binding[to=1])]], [[], [constant(binding[to=1])]], [[], [constant(  
> cypher.null)]])]]), select(values), 
> map(lambda[cypherListSlice().apply(it)])]])]]{code}
> Using Gremlin 3.4.13 produces the following traversal:
>  
>  
> {code:java}
> [InjectStep([  cypher.start]), TraversalMapStep([ProjectStep([  GENERATED1,   
> GENERATED2,   GENERATED3],[[ConstantStep(1)], [ConstantStep(2)], 
> [ConstantStep(3)]]), TraversalMapStep(values)]), 
> ProjectStep([r],[[ProjectStep([  GENERATED5,   GENERATED6,   
> GENERATED7],[[IdentityStep], [ChooseStep([ConstantStep(3), 
> HasNextStep],[[(eq(true)), [ConstantStep(3), EndStep]], [(eq(false)), 
> [ConstantStep(  cypher.null), EndStep]]])], [ChooseStep([ConstantStep(1), 
> HasNextStep],[[(eq(true)), [ConstantStep(1), EndStep]], [(eq(false)), 
> [ConstantStep(  cypher.null), EndStep]]])]]), TraversalMapStep(values), 
> LambdaMapStep(lambda)]])]{code}
> while 3.6.1 creates this one (we only upgraded the library and changed some 
> package name references):
>  
>  
> {code:java}
> [InjectStep([  cypher.start]), TraversalMapStep([ProjectStep([  GENERATED1,   
> GENERATED2,   GENERATED3],[[ConstantStep(1)], [ConstantStep(2)], 
> [ConstantStep(3)]]), TraversalMapStep(values)]), 
> ProjectStep([r],[[ProjectStep([  GENERATED5,   GENERATED6,   
> GENERATED7],[[IdentityStep], [ChooseStep([ConstantStep(OUT), 
> HasNextStep],[[(eq(true)), [ConstantStep(OUT), EndStep]], [(eq(false)), 
> [ConstantStep(  cypher.null), EndStep]]])], [ChooseStep([ConstantStep(IN), 
> HasNextStep],[[(eq(true)), [ConstantStep(IN), EndStep]], [(eq(false)), 
> [ConstantStep(  cypher.null), EndStep]]])]]), TraversalMapStep(values), 
> LambdaMapStep(lambda)]])]{code}
> Indeed the one in 3.6.1 is the wrong one because it adds some extra steps 
> like {*}ConstantStep(IN){*}.
>  
>  
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to