Details
-
Bug
-
Status: Open
-
Critical
-
Resolution: Unresolved
-
3.6.1
-
None
-
None
-
Gremlin Console, TinkerPop 3.6
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.
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
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.
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>
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