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

Andrea Santurbano edited comment on TINKERPOP-2854 at 1/20/23 9:13 AM:
-----------------------------------------------------------------------

[~spmallette] (/cc [~xiazcy]) let's forget the cypher transpiler for a moment. 
I have this 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}

*Why does it add Constant(IN) and OUT in the CHOOSE step in 3.6.1?*

And why if I use the "same" gremlin query:
{code:java}
g.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(3), __.constant(3), 
__.constant('  cypher.null'))).by(.choose(_.constant(1), __.constant(1), 
__.constant('  cypher.null'))).select(values).map(cypherListSlice())){code}
It works correctly in 3.6.1?

I'm 99% sure that the bug is not in the transpiler but in Gremlin itself 
because we found several bugs introduced in 3.5.x that were then resolved in 
3.6.0 but then this one popped out.

If you don't want to dive into this, can you at least provide some guidance 
about constructing a test case into Gremlin to reproduce the situation in 
Gremlin and debug it by myself?

Thank you so much!


was (Author: conker84):
[~spmallette] (/cc [~xiazcy]) let's forget the cypher transpiler for a moment. 
I have this bytecode query:
[[], [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)])]])]]
*Why does it add Constant(IN) and OUT in the CHOOSE step in 3.6.1?*

And why if I use the "same" gremlin query:
g.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(3), __.constant(3), 
__.constant('  cypher.null'))).by(__.choose(__.constant(1), __.constant(1), 
__.constant('  cypher.null'))).select(values).map(cypherListSlice()))
It works correctly in 3.6.1?

I'm 99% sure that the bug is not in the transpiler but in Gremlin itself 
because we found several bugs introduced in 3.5.x that were then resolved in 
3.6.0 but then this one popped out.

If you don't want to dive into this, can you at least provide some guidance 
about constructing a test case into Gremlin to reproduce the situation in 
Gremlin and debug it by myself?

Thank you so much!

> 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