[
https://issues.apache.org/jira/browse/TINKERPOP-3178?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Stephen Mallette updated TINKERPOP-3178:
----------------------------------------
Description:
h3. Match only a single case in {{choose()}}
{code}
gremlin> g.V().hasLabel('person').choose(values('age')).option(27,
constant('x')).option(27, constant('y')).option(none, constant('z'))
==>z
==>x
==>y
==>z
==>z
{code}
There should be only 4 results above, one for each person, but {{choose}} is
matching twice on 27. {{choose}} should match the first item it finds only and
no fall through.
h3. Consistent behavior for unmatched inputs
{code}
// This passes through unmatched inputs
g.V().choose(values('age'), values('age'))
==>29
==>27
==>v[3]
==>32
==>v[5]
==>35
// This throws exception for unmatched inputs
g.V().choose(values('age')).option(27, out()).option(none, in()).path()
The provided traverser does not map to a value:
v[3][TinkerVertex]->[PropertiesStep([age],value)][DefaultGraphTraversal]
parent[[TinkerGraphStep(vertex,[]),
ChooseStep([PropertiesStep([age],value)],[[none, [[VertexStep(IN,vertex),
EndStep]]], [(eq(27)), [VertexStep(OUT,vertex), EndStep]]]), PathStep]]
{code}
Change the switch form to behave like the if-then form.
was:
{code}
gremlin> g.V().hasLabel('person').choose(values('age')).option(27,
constant('x')).option(27, constant('y')).option(none, constant('z'))
==>z
==>x
==>y
==>z
==>z
{code}
There should be only 4 results above, one for each person, but {{choose}} is
matching twice on 27. {{choose}} should match the first item it finds only and
no fall through.
Summary: Clarify choose() with consistent semantics (was: Match only a
single case in choose())
> Clarify choose() with consistent semantics
> ------------------------------------------
>
> Key: TINKERPOP-3178
> URL: https://issues.apache.org/jira/browse/TINKERPOP-3178
> Project: TinkerPop
> Issue Type: Improvement
> Components: process
> Affects Versions: 3.7.3
> Reporter: Stephen Mallette
> Priority: Major
> Labels: breaking
>
> h3. Match only a single case in {{choose()}}
> {code}
> gremlin> g.V().hasLabel('person').choose(values('age')).option(27,
> constant('x')).option(27, constant('y')).option(none, constant('z'))
> ==>z
> ==>x
> ==>y
> ==>z
> ==>z
> {code}
> There should be only 4 results above, one for each person, but {{choose}} is
> matching twice on 27. {{choose}} should match the first item it finds only
> and no fall through.
> h3. Consistent behavior for unmatched inputs
> {code}
> // This passes through unmatched inputs
> g.V().choose(values('age'), values('age'))
> ==>29
> ==>27
> ==>v[3]
> ==>32
> ==>v[5]
> ==>35
> // This throws exception for unmatched inputs
> g.V().choose(values('age')).option(27, out()).option(none, in()).path()
> The provided traverser does not map to a value:
> v[3][TinkerVertex]->[PropertiesStep([age],value)][DefaultGraphTraversal]
> parent[[TinkerGraphStep(vertex,[]),
> ChooseStep([PropertiesStep([age],value)],[[none, [[VertexStep(IN,vertex),
> EndStep]]], [(eq(27)), [VertexStep(OUT,vertex), EndStep]]]), PathStep]]
> {code}
> Change the switch form to behave like the if-then form.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)