[
https://issues.apache.org/jira/browse/TINKERPOP3-670?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Matt Frantz updated TINKERPOP3-670:
-----------------------------------
Description:
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).last(global, 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').last(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').last(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().last(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().last(local, 1)
==>[c:v[5]]
==>[c:v[3]]
{noformat}
was:
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).last(global, 2)
==>v[5]
==>v[6]
{noformat}
Scenario: Local scope, N>1
{noformat}
gremlin> g.V().as('a').out().as('a').out().as('a').select('a').last(local, 2)
==>[v[4], v[5]]
==>[v[4], v[3]]
{noformat}
Scenario: Local scope, N=1
{noformat}
gremlin> g.V().as('a').out().as('a').out().as('a').select('a').last(local, 1)
==>v[5]
==>v[3]
{noformat}
> 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).last(global, 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').last(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').last(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().last(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().last(local, 1)
> ==>[c:v[5]]
> ==>[c:v[3]]
> {noformat}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)