[
https://issues.apache.org/jira/browse/TINKERPOP3-670?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14533786#comment-14533786
]
ASF GitHub Bot commented on TINKERPOP3-670:
-------------------------------------------
GitHub user mhfrantz opened a pull request:
https://github.com/apache/incubator-tinkerpop/pull/60
TINKERPOP3-670 tail step (v1)
https://issues.apache.org/jira/browse/TINKERPOP3-670
This is implemented as specified in JIRA, with a couple more tests for good
measure.
As specified, the behavior for `tail(local, 1)` is special if the input is
a `List`, in that it emits the element and not a one-element `List`. That
makes it different from `limit(local, 1)`, but more like `select("x")` (for a
single step label.
In the spirit of "containers only when necessary", should `limit(local, 1)`
be changed to emit the element rather then a one-element `List`? I filed
https://issues.apache.org/jira/browse/TINKERPOP3-673 to think about that.
I had some OOM problems running the full integration test suite, but all of
the new tests are disabled for COMPUTER for various reasons.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/RedSeal-co/incubator-tinkerpop
TINKERPOP3-670-tail-step.v1
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/incubator-tinkerpop/pull/60.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #60
----
commit b1a53fc7ca10a67ec0b18f16d917fd2571687b76
Author: mhfrantz <[email protected]>
Date: 2015-05-08T02:04:00Z
Implement RangeLocalStep.toString
commit fe9ac0edc07f753ab93e06b7d330b6f263977ba5
Author: mhfrantz <[email protected]>
Date: 2015-05-08T01:29:22Z
TINKERPOP3-670: Add 'tail' step
----
> 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)