[
https://issues.apache.org/jira/browse/TINKERPOP-2823?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Kelvin Lawrence updated TINKERPOP-2823:
---------------------------------------
Description:
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]
was:
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.143 48.36
UnionStep([[IdentityStep, EndStep], [VertexStep... 5 5 0.153 51.64
IdentityStep 1 1 0.009
EndStep 1 1 0.008
VertexStep(OUT,vertex) 4 4 0.017
EndStep 4 4 0.013
>TOTAL - - 0.296 -gremlin> g.V(44).union(identity(),out()).drop().profile()
==>Traversal Metrics
Step Count Traversers Time (ms) % Dur
=============================================================================================================
TinkerGraphStep(vertex,[44]) 1 1 0.097 1.64
UnionStep([[IdentityStep, EndStep], [VertexStep... 1 1 0.194 3.25
IdentityStep 1 1 0.020
EndStep 1 1 0.008
VertexStep(OUT,vertex) 0.051
EndStep 0.018
DropStep 5.695 95.11
>TOTAL - - 5.987 -{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]
> 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: Major
>
> 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)