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

Ted Wilmes commented on TINKERPOP-1973:
---------------------------------------

Ok, that make sense in the context of the injector distinction. So for my 
contrived example, the key would be to include the same predicate after the 
emit. That'll work for most cases I think as long as you aren't relying on the 
loop counter as part of your emit logic since (I think) the loop count is no 
longer available after the traverser has exited the repeat. The reason this 
came up was I was writing a traversal that traversed up a tree from the leaves 
a set number of levels, storing the intermediate results in a subgraph. For a 
smaller subset of those levels, It needed to execute another repeat traversal 
so I was using an {{emit(loops().is(lt(3))).repeat(....)}}. The issue was that 
repeat was executed for levels less than 3 and then the last level exiting the 
repeat.

 

> Emit predicate ignored after final loop of a RepeatStep with times or until
> ---------------------------------------------------------------------------
>
>                 Key: TINKERPOP-1973
>                 URL: https://issues.apache.org/jira/browse/TINKERPOP-1973
>             Project: TinkerPop
>          Issue Type: Bug
>          Components: process
>    Affects Versions: 3.3.3, 3.2.9
>            Reporter: Ted Wilmes
>            Assignee: Ted Wilmes
>            Priority: Major
>
> When combined with a {{times}} or {{until}}, the {{emit}} predicate is not 
> applied to the output of the last loop of the {{RepeatStep}}.
> {code}
>  gremlin> g = TinkerFactory.createModern().traversal()
>  ==>graphtraversalsource[tinkergraph[vertices:6 edges:6], standard]
>  gremlin> g.V().repeat(out()).emit(has('name', 'lop')).values('name')
>  ==>lop
>  ==>lop
>  ==>lop
>  ==>lop
>  gremlin> g.V().repeat(out()).times(2).emit(has('name', 'lop')).values('name')
>  ==>lop
>  ==>ripple
>  ==>lop
>  ==>lop
>  ==>lop
>  gremlin>
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to