[
https://issues.apache.org/jira/browse/TINKERPOP-1963?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16469483#comment-16469483
]
stephen mallette commented on TINKERPOP-1963:
---------------------------------------------
The issue seems related to a step like {{fold()}} always returning an object
even when the stream is technically empty as in:
{code}
gremlin> g.inject().fold()
==>[]
{code}
The choice to return something or not from the option traversals is determined
by {{hasNext()}} so that's why more than one of those options is returned.
Considering fixing this by introducing a different method of flow control
> Use of reducing step in choose()
> --------------------------------
>
> Key: TINKERPOP-1963
> URL: https://issues.apache.org/jira/browse/TINKERPOP-1963
> Project: TinkerPop
> Issue Type: Bug
> Components: process
> Affects Versions: 3.2.9
> Reporter: stephen mallette
> Assignee: stephen mallette
> Priority: Major
> Fix For: 3.2.10
>
>
> {code}
> gremlin> g.inject(1).choose(is(1), constant(true), constant(false))
> ==>true
> gremlin> g.inject(1).choose(is(1), fold(), constant(false))
> ==>[1]
> {code}
> But if I put some reducing step in the branch that's not supposed to be
> emitted:
> {code}
> gremlin> g.inject(1).choose(is(1), constant(true), fold())
> ==>[]
> ==>true
> gremlin> g.inject(1).choose(is(1), constant(true), max())
> ==>NaN
> ==>true
> {code}
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)