Description
See also gremlin-users discussion
This produces no results:
gremlin> graph = TinkerFactory.createModern() ==>tinkergraph[vertices:6 edges:6] gremlin> g = graph.traversal() ==>graphtraversalsource[tinkergraph[vertices:6 edges:6], standard] gremlin> g.V().where( __.in('A').in('B').count().is(eq(0)) ) gremlin>
In 3.2.0-incubating, it correctly (or atleast expectedly) produces:
==>v[1] ==>v[2] ==>v[3] ==>v[4] ==>v[5] ==>v[6]
Outside of the where() clause, it produces the expected result:
gremlin> g.V().in('A').in('B').count() ==>0
Thus, one could expect it to work inside the where() clause. It appears that some optimization occurs that removes the count step and converts it into a NotStep.
3.2.0-incubating:
gremlin> g.V().where( __.in('A').in('B').count().is(eq(0)) ).explain() ==>Traversal Explanation ================================================================================================================================================================================================ Original Traversal [GraphStep(vertex,[]), TraversalFilterStep([VertexStep(IN,[A],vertex), VertexStep(IN,[B],vertex), CountGlobalStep, IsStep(eq(0))])] ConnectiveStrategy [D] [GraphStep(vertex,[]), TraversalFilterStep([VertexStep(IN,[A],vertex), VertexStep(IN,[B],vertex), CountGlobalStep, IsStep(eq(0))])] IdentityRemovalStrategy [O] [GraphStep(vertex,[]), TraversalFilterStep([VertexStep(IN,[A],vertex), VertexStep(IN,[B],vertex), CountGlobalStep, IsStep(eq(0))])] IncidentToAdjacentStrategy [O] [GraphStep(vertex,[]), TraversalFilterStep([VertexStep(IN,[A],vertex), VertexStep(IN,[B],vertex), CountGlobalStep, IsStep(eq(0))])] AdjacentToIncidentStrategy [O] [GraphStep(vertex,[]), TraversalFilterStep([VertexStep(IN,[A],vertex), VertexStep(IN,[B],edge), CountGlobalStep, IsStep(eq(0))])] FilterRankingStrategy [O] [GraphStep(vertex,[]), TraversalFilterStep([VertexStep(IN,[A],vertex), VertexStep(IN,[B],edge), CountGlobalStep, IsStep(eq(0))])] MatchPredicateStrategy [O] [GraphStep(vertex,[]), TraversalFilterStep([VertexStep(IN,[A],vertex), VertexStep(IN,[B],edge), CountGlobalStep, IsStep(eq(0))])] RangeByIsCountStrategy [O] [GraphStep(vertex,[]), TraversalFilterStep([VertexStep(IN,[A],vertex), VertexStep(IN,[B],edge), RangeGlobalStep(0,1), CountGlobalStep, IsStep(eq(0))])] TinkerGraphStepStrategy [P] [TinkerGraphStep(vertex,[]), TraversalFilterStep([VertexStep(IN,[A],vertex), VertexStep(IN,[B],edge), RangeGlobalStep(0,1), CountGlobalStep, IsStep(eq(0))])] ProfileStrategy [F] [TinkerGraphStep(vertex,[]), TraversalFilterStep([VertexStep(IN,[A],vertex), VertexStep(IN,[B],edge), RangeGlobalStep(0,1), CountGlobalStep, IsStep(eq(0))])] StandardVerificationStrategy [V] [TinkerGraphStep(vertex,[]), TraversalFilterStep([VertexStep(IN,[A],vertex), VertexStep(IN,[B],edge), RangeGlobalStep(0,1), CountGlobalStep, IsStep(eq(0))])] Final Traversal [TinkerGraphStep(vertex,[]), TraversalFilterStep([VertexStep(IN,[A],vertex), VertexStep(IN,[B],edge), RangeGlobalStep(0,1), CountGlobalStep, IsStep(eq(0))])]
3.2.4:
gremlin> g.V().where( __.in('A').in('B').count().is(eq(0)) ).explain() ==>Traversal Explanation ====================================================================================================================================================================== Original Traversal [GraphStep(vertex,[]), TraversalFilterStep([VertexStep(IN,[A],vertex), VertexStep(IN,[B],vertex), CountGlobalStep, IsStep(eq(0))])] ConnectiveStrategy [D] [GraphStep(vertex,[]), TraversalFilterStep([VertexStep(IN,[A],vertex), VertexStep(IN,[B],vertex), CountGlobalStep, IsStep(eq(0))])] MatchPredicateStrategy [O] [GraphStep(vertex,[]), TraversalFilterStep([VertexStep(IN,[A],vertex), VertexStep(IN,[B],vertex), CountGlobalStep, IsStep(eq(0))])] FilterRankingStrategy [O] [GraphStep(vertex,[]), TraversalFilterStep([VertexStep(IN,[A],vertex), VertexStep(IN,[B],vertex), CountGlobalStep, IsStep(eq(0))])] InlineFilterStrategy [O] [GraphStep(vertex,[]), TraversalFilterStep([VertexStep(IN,[A],vertex), VertexStep(IN,[B],vertex), CountGlobalStep, IsStep(eq(0))])] RepeatUnrollStrategy [O] [GraphStep(vertex,[]), TraversalFilterStep([VertexStep(IN,[A],vertex), VertexStep(IN,[B],vertex), CountGlobalStep, IsStep(eq(0))])] PathRetractionStrategy [O] [GraphStep(vertex,[]), TraversalFilterStep([VertexStep(IN,[A],vertex), VertexStep(IN,[B],vertex), CountGlobalStep, IsStep(eq(0))])] RangeByIsCountStrategy [O] [GraphStep(vertex,[]), TraversalFilterStep([VertexStep(IN,[A],vertex), NotStep([VertexStep(IN,[B],vertex)])])] IncidentToAdjacentStrategy [O] [GraphStep(vertex,[]), TraversalFilterStep([VertexStep(IN,[A],vertex), NotStep([VertexStep(IN,[B],vertex)])])] AdjacentToIncidentStrategy [O] [GraphStep(vertex,[]), TraversalFilterStep([VertexStep(IN,[A],vertex), NotStep([VertexStep(IN,[B],edge)])])] LazyBarrierStrategy [O] [GraphStep(vertex,[]), TraversalFilterStep([VertexStep(IN,[A],vertex), NotStep([VertexStep(IN,[B],edge)])])] TinkerGraphCountStrategy [P] [GraphStep(vertex,[]), TraversalFilterStep([VertexStep(IN,[A],vertex), NotStep([VertexStep(IN,[B],edge)])])] TinkerGraphStepStrategy [P] [TinkerGraphStep(vertex,[]), TraversalFilterStep([VertexStep(IN,[A],vertex), NotStep([VertexStep(IN,[B],edge)])])] ProfileStrategy [F] [TinkerGraphStep(vertex,[]), TraversalFilterStep([VertexStep(IN,[A],vertex), NotStep([VertexStep(IN,[B],edge)])])] StandardVerificationStrategy [V] [TinkerGraphStep(vertex,[]), TraversalFilterStep([VertexStep(IN,[A],vertex), NotStep([VertexStep(IN,[B],edge)])])] Final Traversal [TinkerGraphStep(vertex,[]), TraversalFilterStep([VertexStep(IN,[A],vertex), NotStep([VertexStep(IN,[B],edge)])])]
Attachments
Issue Links
- is related to
-
TINKERPOP-1312 .count().is(0) is not properly optimized
- Closed
- links to