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

ASF GitHub Bot commented on TINKERPOP3-670:
-------------------------------------------

Github user mhfrantz commented on the pull request:

    https://github.com/apache/incubator-tinkerpop/pull/60#issuecomment-102105037
  
    I'm looking in more detail at how `RangeGlobalStep` works.  It seems there 
are a few places where this exact step is a special case (via `instanceof` 
checks, e.g. in `TraverserMapReduce` as well as in several strategies).
    
    The way that `Bypassing` is used also has to be considered.
    
    I also see that `ComputerVerificationStrategy` looks for specific types of 
steps, and `TailGlobalStep` might belong there.
    
    It feels like some refactoring is warranted.  `RangeGlobalStep` and 
`CollectingBarrierStep` each represent some class of steps to which 
`TailGlobalStep` may or may not belong.  Perhaps `Bypassing` is one such 
aspect, but are there others?
    
    Maybe `TailGlobalStep` is really a new animal, but it feels like it ought 
to be composed from pieces that mean "it is like a barrier, but not exactly 
CollectingBarrierStep" and "it is like a range, but not exactly 
RangeGlobalStep".
    
    I'm still coming up to speed on the design, and I'm not yet totally lost, 
but any pointers would be appreciated.  I can appreciate the tension between a 
fully a generalized "step aspects" API and one that assumes that the number of 
fundamental steps is small and so will scale with special case logic.


> tail step
> ---------
>
>                 Key: TINKERPOP3-670
>                 URL: https://issues.apache.org/jira/browse/TINKERPOP3-670
>             Project: TinkerPop 3
>          Issue Type: Improvement
>          Components: process
>            Reporter: Matt Frantz
>
> The tail step has two scopes:
> * global: emits the last N traversers that pass through it.
> * local: emits a {{List}} containing the last N elements of the inbound 
> {{List}}
> Additionally, for {{tail(local, 1)}}, it emits a single element rather than a 
> {{List}} containing a single element.
> TINKERPOP3-639 provides motivation.
> Scenario: Global scope
> {noformat}
> gremlin> g.V().order().by(T.id, incr).tail(global, 2)
> ==>v[5]
> ==>v[6]
> {noformat}
> Scenario: Default scope is global
> {noformat}
> gremlin> g.V().order().by(T.id, incr).tail(2)
> ==>v[5]
> ==>v[6]
> {noformat}
> Scenario: Local scope, {{List}} input, N>1
> {noformat}
> gremlin> g.V().as('a').out().as('a').out().as('a').select('a').tail(local, 2)
> ==>[v[4], v[5]]
> ==>[v[4], v[3]]
> {noformat}
> Scenario: Local scope, {{List}} input, N=1
> {noformat}
> gremlin> g.V().as('a').out().as('a').out().as('a').select('a').tail(local, 1)
> ==>v[5]
> ==>v[3]
> {noformat}
> Scenario: Local scope, {{Map}} input, N>1
> {noformat}
> gremlin> g.V().as('a').out().as('b').out().as('c').select().tail(local, 2)
> ==>[b:v[4], c:v[5]]
> ==>[b:v[4], c:v[3]]
> {noformat}
> Scenario: Local scope, {{Map}} input, N=1
> {noformat}
> gremlin> g.V().as('a').out().as('b').out().as('c').select().tail(local, 1)
> ==>[c:v[5]]
> ==>[c:v[3]]
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to