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

Marko A. Rodriguez commented on TINKERPOP-1626:
-----------------------------------------------

If I separate out the {{as('p2')}} via an {{identity()}}, then the results are 
correct. I've seen this behavior before in another step that was buggy in a 
similar way. I forget the solution, but will dig deeper.

{code}
gremlin> g.withComputer().V().hasLabel("person").as("p1").choose(outE("knows"), 
out("knows")).identity().as("p2").select("p1","p2")
==>[p1:v[2],p2:v[2]]
==>[p1:v[4],p2:v[4]]
==>[p1:v[6],p2:v[6]]
==>[p1:v[1],p2:v[2]]
==>[p1:v[1],p2:v[4]]
{code} 

> choose() is buggy in OLAP
> -------------------------
>
>                 Key: TINKERPOP-1626
>                 URL: https://issues.apache.org/jira/browse/TINKERPOP-1626
>             Project: TinkerPop
>          Issue Type: Bug
>          Components: process
>    Affects Versions: 3.3.0
>            Reporter: Daniel Kuppitz
>
> Not yet tested in older versions.
> What follows are two queries that only differ in where 
> {{as("p2").select("p1","p2")}} is done. {{p1}} is a person and {{p2}} is 
> (supposed to be) either a person known by {{p1}} or - if {{p1}} doesn't know 
> anybody - the same as {{p1}}.
> *OLTP (all good):*
> {noformat}
> gremlin> g = TinkerFactory.createModern().traversal()
> ==>graphtraversalsource[tinkergraph[vertices:6 edges:6], standard]
> gremlin> g.V().hasLabel("person").as("p1").choose(outE("knows"), 
> out("knows"), identity()).as("p2").select("p1","p2")
> ==>[p1:v[1],p2:v[2]]
> ==>[p1:v[1],p2:v[4]]
> ==>[p1:v[2],p2:v[2]]
> ==>[p1:v[4],p2:v[4]]
> ==>[p1:v[6],p2:v[6]]
> gremlin> g.V().hasLabel("person").as("p1").choose(outE("knows"), 
> out("knows").as("p2").select("p1","p2"), __.as("p2").select("p1","p2"))
> ==>[p1:v[1],p2:v[2]]
> ==>[p1:v[1],p2:v[4]]
> ==>[p1:v[2],p2:v[2]]
> ==>[p1:v[4],p2:v[4]]
> ==>[p1:v[6],p2:v[6]]
> {noformat}
> *OLAP (only works when {{select()}} is done twice - once for each branch):*
> {noformat}
> gremlin> g = g.withComputer()
> ==>graphtraversalsource[tinkergraph[vertices:6 edges:6], graphcomputer]
> gremlin> g.V().hasLabel("person").as("p1").choose(outE("knows"), 
> out("knows"), identity()).as("p2").select("p1","p2")
> ==>[p1:v[1],p2:v[1]]
> ==>[p1:v[1],p2:v[1]]
> gremlin> g.V().hasLabel("person").as("p1").choose(outE("knows"), 
> out("knows").as("p2").select("p1","p2"), __.as("p2").select("p1","p2"))
> ==>[p1:v[2],p2:v[2]]
> ==>[p1:v[4],p2:v[4]]
> ==>[p1:v[6],p2:v[6]]
> ==>[p1:v[1],p2:v[2]]
> ==>[p1:v[1],p2:v[4]]
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to