Uploaded image for project: 'TinkerPop'
  1. TinkerPop
  2. TINKERPOP-2942

properties named ID cannot be used when combined with a label

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Not A Problem
    • 3.6.2
    • None
    • process
    • None

    Description

      When you have a property named `ID` you cannot filter on it when combined with a vertex label. Here is a testcase that runs on the gremlin-console:

      
      gremlin> graph = TinkerFactory.createModern()
      ==>tinkergraph[vertices:6 edges:6]
      gremlin> g = traversal().withEmbedded(graph)
      ==>graphtraversalsource[tinkergraph[vertices:6 edges:6], standard]
      gremlin> g.V(1).property("ID", "ABC")
      ==>v[1]
      gremlin> g.V(1).properties()
      ==>vp[name->marko]
      ==>vp[ID->ABC]
      ==>vp[age->29]
      gremlin> g.V().has('ID', 'ABC').count()
      ==>1
      gremlin> g.V().has('PERSON', 'ID', 'ABC').count()
      ==>0
      gremlin> g.V().hasLabel('PERSON').has('ID', 'ABC').count()
      ==>0
      

      if you compare the explain plans:

      gremlin> g.V().has('ID', 'ABC').count().explain()
      ==>Traversal Explanation
      ====================================================================================================
      Original Traversal                    [GraphStep(vertex,[]), HasStep([ID.eq(ABC)]), CountGlobalStep]
      
      ConnectiveStrategy              [D]   [GraphStep(vertex,[]), HasStep([ID.eq(ABC)]), CountGlobalStep]
      IdentityRemovalStrategy         [O]   [GraphStep(vertex,[]), HasStep([ID.eq(ABC)]), CountGlobalStep]
      ByModulatorOptimizationStrategy [O]   [GraphStep(vertex,[]), HasStep([ID.eq(ABC)]), CountGlobalStep]
      CountStrategy                   [O]   [GraphStep(vertex,[]), HasStep([ID.eq(ABC)]), CountGlobalStep]
      MatchPredicateStrategy          [O]   [GraphStep(vertex,[]), HasStep([ID.eq(ABC)]), CountGlobalStep]
      FilterRankingStrategy           [O]   [GraphStep(vertex,[]), HasStep([ID.eq(ABC)]), CountGlobalStep]
      IncidentToAdjacentStrategy      [O]   [GraphStep(vertex,[]), HasStep([ID.eq(ABC)]), CountGlobalStep]
      InlineFilterStrategy            [O]   [GraphStep(vertex,[]), HasStep([ID.eq(ABC)]), CountGlobalStep]
      AdjacentToIncidentStrategy      [O]   [GraphStep(vertex,[]), HasStep([ID.eq(ABC)]), CountGlobalStep]
      RepeatUnrollStrategy            [O]   [GraphStep(vertex,[]), HasStep([ID.eq(ABC)]), CountGlobalStep]
      PathRetractionStrategy          [O]   [GraphStep(vertex,[]), HasStep([ID.eq(ABC)]), CountGlobalStep]
      EarlyLimitStrategy              [O]   [GraphStep(vertex,[]), HasStep([ID.eq(ABC)]), CountGlobalStep]
      LazyBarrierStrategy             [O]   [GraphStep(vertex,[]), HasStep([ID.eq(ABC)]), CountGlobalStep]
      TinkerMergeEVStepStrategy       [P]   [GraphStep(vertex,[]), HasStep([ID.eq(ABC)]), CountGlobalStep]
      TinkerGraphCountStrategy        [P]   [GraphStep(vertex,[]), HasStep([ID.eq(ABC)]), CountGlobalStep]
      TinkerGraphStepStrategy         [P]   [TinkerGraphStep(vertex,[ID.eq(ABC)]), CountGlobalStep]
      ProfileStrategy                 [F]   [TinkerGraphStep(vertex,[ID.eq(ABC)]), CountGlobalStep]
      StandardVerificationStrategy    [V]   [TinkerGraphStep(vertex,[ID.eq(ABC)]), CountGlobalStep]
      
      Final Traversal                       [TinkerGraphStep(vertex,[ID.eq(ABC)]), CountGlobalStep]
      gremlin>
      
      gremlin> g.V().has('PERSON', 'ID', 'ABC').count().explain()
      ==>Traversal Explanation
      =======================================================================================================================
      Original Traversal                    [GraphStep(vertex,[]), HasStep([~label.eq(PERSON), ID.eq(ABC)]), CountGlobalStep]
      
      ConnectiveStrategy              [D]   [GraphStep(vertex,[]), HasStep([~label.eq(PERSON), ID.eq(ABC)]), CountGlobalStep]
      IdentityRemovalStrategy         [O]   [GraphStep(vertex,[]), HasStep([~label.eq(PERSON), ID.eq(ABC)]), CountGlobalStep]
      ByModulatorOptimizationStrategy [O]   [GraphStep(vertex,[]), HasStep([~label.eq(PERSON), ID.eq(ABC)]), CountGlobalStep]
      CountStrategy                   [O]   [GraphStep(vertex,[]), HasStep([~label.eq(PERSON), ID.eq(ABC)]), CountGlobalStep]
      MatchPredicateStrategy          [O]   [GraphStep(vertex,[]), HasStep([~label.eq(PERSON), ID.eq(ABC)]), CountGlobalStep]
      FilterRankingStrategy           [O]   [GraphStep(vertex,[]), HasStep([~label.eq(PERSON), ID.eq(ABC)]), CountGlobalStep]
      IncidentToAdjacentStrategy      [O]   [GraphStep(vertex,[]), HasStep([~label.eq(PERSON), ID.eq(ABC)]), CountGlobalStep]
      InlineFilterStrategy            [O]   [GraphStep(vertex,[]), HasStep([~label.eq(PERSON), ID.eq(ABC)]), CountGlobalStep]
      AdjacentToIncidentStrategy      [O]   [GraphStep(vertex,[]), HasStep([~label.eq(PERSON), ID.eq(ABC)]), CountGlobalStep]
      RepeatUnrollStrategy            [O]   [GraphStep(vertex,[]), HasStep([~label.eq(PERSON), ID.eq(ABC)]), CountGlobalStep]
      PathRetractionStrategy          [O]   [GraphStep(vertex,[]), HasStep([~label.eq(PERSON), ID.eq(ABC)]), CountGlobalStep]
      EarlyLimitStrategy              [O]   [GraphStep(vertex,[]), HasStep([~label.eq(PERSON), ID.eq(ABC)]), CountGlobalStep]
      LazyBarrierStrategy             [O]   [GraphStep(vertex,[]), HasStep([~label.eq(PERSON), ID.eq(ABC)]), CountGlobalStep]
      TinkerMergeEVStepStrategy       [P]   [GraphStep(vertex,[]), HasStep([~label.eq(PERSON), ID.eq(ABC)]), CountGlobalStep]
      TinkerGraphCountStrategy        [P]   [GraphStep(vertex,[]), HasStep([~label.eq(PERSON), ID.eq(ABC)]), CountGlobalStep]
      TinkerGraphStepStrategy         [P]   [TinkerGraphStep(vertex,[~label.eq(PERSON), ID.eq(ABC)]), CountGlobalStep]
      ProfileStrategy                 [F]   [TinkerGraphStep(vertex,[~label.eq(PERSON), ID.eq(ABC)]), CountGlobalStep]
      StandardVerificationStrategy    [V]   [TinkerGraphStep(vertex,[~label.eq(PERSON), ID.eq(ABC)]), CountGlobalStep]
      
      Final Traversal                       [TinkerGraphStep(vertex,[~label.eq(PERSON), ID.eq(ABC)]), CountGlobalStep]
      

      The `ID.eq(ABC)` part seems to be the same

      Attachments

        Activity

          People

            Unassigned Unassigned
            tkolanko Tom Kolanko
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: