[
https://issues.apache.org/jira/browse/TINKERPOP-2823?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17878241#comment-17878241
]
Yang Xia commented on TINKERPOP-2823:
-------------------------------------
Quoting from TINKERPOP-3101, a related issue on interaction of drop() with
union() semantics:
When you use a `drop()` step as the first subtraversal it is impacting the
subsequent subtraversals. In the example below I would have expected this to
return the `valueMap()` of the incoming solutions since this is a branch step.
{code:java}
\,,,/
(o o)
-----oOOo-(3)-oOOo-----
plugin activated: tinkerpop.server
plugin activated: tinkerpop.utilities
plugin activated: tinkerpop.tinkergraph
gremlin> g = TinkerFactory.createModern().traversal()
==>graphtraversalsource[tinkergraph[vertices:6 edges:6], standard]
gremlin> g.V().union(drop(), valueMap())
==>[]
==>[]
==>[]
==>[]
==>[]
==>[] {code}
> A drop() after a union() does not drop everything found
> -------------------------------------------------------
>
> Key: TINKERPOP-2823
> URL: https://issues.apache.org/jira/browse/TINKERPOP-2823
> Project: TinkerPop
> Issue Type: Bug
> Components: process
> Affects Versions: 3.6.1
> Environment: Gremlin Console, TinkerPop 3.6
> Reporter: Kelvin Lawrence
> Priority: Critical
>
> This may be related to https://issues.apache.org/jira/browse/TINKERPOP-2627,
> but on the surface appears different.
> If a `drop()` step appears after a `union()` step, Gremlin does not drop all
> of the vertices that flow out of the `union()`. It only drops one vertex.
>
> For example, using the air routes data, we can see that V(44) has four
> outgoing routes, and the `union()` correctly yields five results. However, if
> a `drop()` is performed after the `union()` only V(44) gets dropped. As a
> workaround, doing `union().fold().unfold().drop()` does work and all five
> vertices get deleted.
>
> {code:java}
> gremlin> g.V().count()
> ==>3748
> gremlin> g.V(44).union(identity(),out()).count()
> ==>5
> gremlin> g.V(44).union(identity(),out()).drop()
> // Only one has been dropped
> gremlin> g.V().count()
> ==>3747 {code}
> We can see by profiling the two queries that the number of traversers stays
> at one, if a drop() step is present, whereas it is five otherwise.
> {code:java}
> gremlin> g.V(44).union(identity(),out()).profile()
> ==>Traversal Metrics
> Step Count
> Traversers Time (ms) % Dur
> =============================================================================================================
> TinkerGraphStep(vertex,[44]) 1
> 1 0.255 26.98
> UnionStep([[IdentityStep, EndStep], [VertexStep... 5
> 5 0.691 73.02
> IdentityStep 1
> 1 0.017
> EndStep 1
> 1 0.014
> VertexStep(OUT,vertex) 4
> 4 0.069
> EndStep 4
> 4 0.072
> >TOTAL -
> - 0.947 -
> gremlin> g.V(44).union(identity(),out()).drop().profile()
> ==>Traversal Metrics
> Step Count
> Traversers Time (ms) % Dur
> =============================================================================================================
> TinkerGraphStep(vertex,[44]) 1
> 1 0.073 19.44
> UnionStep([[IdentityStep, EndStep], [VertexStep... 1
> 1 0.159 42.40
> IdentityStep 1
> 1 0.006
> EndStep 1
> 1 0.009
> VertexStep(OUT,vertex)
> 0.025
> EndStep
> 0.016
> DropStep
> 0.143 38.16
> >TOTAL -
> - 0.376 -
> gremlin> {code}
>
> This issue was also reported via a StackOverflow post:
> [https://stackoverflow.com/questions/74238687/why-does-my-gremlin-query-not-drop-all-the-vertices-i-indicate]
--
This message was sent by Atlassian Jira
(v8.20.10#820010)