Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 3.1.3
    • 3.1.5, 3.2.3
    • process
    • None

    Description

      Graph g = TinkerGraph.open();

      g.addVertex(T.label,"GROUP","name","Acme");

      List<Vertex> list = g.traversal()
      .V()
      .hasLabel("GROUP")
      .where(__.outE().hasLabel("PART_OF").count().is(0))
      .toList();

      Assert.assertEquals(1, list.size()); // actual size is 0

      Attachments

        Activity

          arikc note that the workaround for now would be to write your traversal as:

          gremlin> g.V().hasLabel('GROUP').where(__.outE("PART_OF").count().is(0))
          ==>v[0]
          

          Looks like a bug in the traversal strategies:

          gremlin> g.V().hasLabel('GROUP').where(__.outE().hasLabel("PART_OF").count().is(eq(0))).explain()
          ==>Traversal Explanation
          ==================================================================================================================================================================================================
          Original Traversal                 [GraphStep(vertex,[]), HasStep([~label.eq(GROUP)]), TraversalFilterStep([VertexStep(OUT,edge), HasStep([~label.eq(PART_OF)]), CountGlobalStep, IsStep(eq(0))])]
          
          ConnectiveStrategy           [D]   [GraphStep(vertex,[]), HasStep([~label.eq(GROUP)]), TraversalFilterStep([VertexStep(OUT,edge), HasStep([~label.eq(PART_OF)]), CountGlobalStep, IsStep(eq(0))])]
          IdentityRemovalStrategy      [O]   [GraphStep(vertex,[]), HasStep([~label.eq(GROUP)]), TraversalFilterStep([VertexStep(OUT,edge), HasStep([~label.eq(PART_OF)]), CountGlobalStep, IsStep(eq(0))])]
          IncidentToAdjacentStrategy   [O]   [GraphStep(vertex,[]), HasStep([~label.eq(GROUP)]), TraversalFilterStep([VertexStep(OUT,edge), HasStep([~label.eq(PART_OF)]), CountGlobalStep, IsStep(eq(0))])]
          AdjacentToIncidentStrategy   [O]   [GraphStep(vertex,[]), HasStep([~label.eq(GROUP)]), TraversalFilterStep([VertexStep(OUT,edge), HasStep([~label.eq(PART_OF)]), CountGlobalStep, IsStep(eq(0))])]
          FilterRankingStrategy        [O]   [GraphStep(vertex,[]), HasStep([~label.eq(GROUP)]), TraversalFilterStep([VertexStep(OUT,edge), HasStep([~label.eq(PART_OF)]), CountGlobalStep, IsStep(eq(0))])]
          MatchPredicateStrategy       [O]   [GraphStep(vertex,[]), HasStep([~label.eq(GROUP)]), TraversalFilterStep([VertexStep(OUT,edge), HasStep([~label.eq(PART_OF)]), CountGlobalStep, IsStep(eq(0))])]
          RepeatUnrollStrategy         [O]   [GraphStep(vertex,[]), HasStep([~label.eq(GROUP)]), TraversalFilterStep([VertexStep(OUT,edge), HasStep([~label.eq(PART_OF)]), CountGlobalStep, IsStep(eq(0))])]
          RangeByIsCountStrategy       [O]   [GraphStep(vertex,[]), HasStep([~label.eq(GROUP)]), TraversalFilterStep([VertexStep(OUT,edge), NotStep(![HasStep([~label.eq(PART_OF)])])])]
          PathRetractionStrategy       [O]   [GraphStep(vertex,[]), HasStep([~label.eq(GROUP)]), TraversalFilterStep([VertexStep(OUT,edge), NotStep(![HasStep([~label.eq(PART_OF)])])])]
          TinkerGraphStepStrategy      [P]   [TinkerGraphStep(vertex,[~label.eq(GROUP)]), TraversalFilterStep([VertexStep(OUT,edge), NotStep(![HasStep([~label.eq(PART_OF)])])])]
          ProfileStrategy              [F]   [TinkerGraphStep(vertex,[~label.eq(GROUP)]), TraversalFilterStep([VertexStep(OUT,edge), NotStep(![HasStep([~label.eq(PART_OF)])])])]
          StandardVerificationStrategy [V]   [TinkerGraphStep(vertex,[~label.eq(GROUP)]), TraversalFilterStep([VertexStep(OUT,edge), NotStep(![HasStep([~label.eq(PART_OF)])])])]
          
          Final Traversal                    [TinkerGraphStep(vertex,[~label.eq(GROUP)]), TraversalFilterStep([VertexStep(OUT,edge), NotStep(![HasStep([~label.eq(PART_OF)])])])]
          

          NotStep shoudl be wrapped around VertexStep and HasStep. It should generate this:

          gremlin> g.V().hasLabel('GROUP').where(__.outE().not(hasLabel("PART_OF"))) // what it does
          gremlin> g.V().hasLabel('GROUP').where(__.not(outE().hasLabel("PART_OF"))) // what it should do
          ==>v[0]
          
          spmallette Stephen Mallette added a comment - arikc note that the workaround for now would be to write your traversal as: gremlin> g.V().hasLabel( 'GROUP' ).where(__.outE( "PART_OF" ).count().is(0)) ==>v[0] Looks like a bug in the traversal strategies: gremlin> g.V().hasLabel( 'GROUP' ).where(__.outE().hasLabel( "PART_OF" ).count().is(eq(0))).explain() ==>Traversal Explanation ================================================================================================================================================================================================== Original Traversal [GraphStep(vertex,[]), HasStep([~label.eq(GROUP)]), TraversalFilterStep([VertexStep(OUT,edge), HasStep([~label.eq(PART_OF)]), CountGlobalStep, IsStep(eq(0))])] ConnectiveStrategy [D] [GraphStep(vertex,[]), HasStep([~label.eq(GROUP)]), TraversalFilterStep([VertexStep(OUT,edge), HasStep([~label.eq(PART_OF)]), CountGlobalStep, IsStep(eq(0))])] IdentityRemovalStrategy [O] [GraphStep(vertex,[]), HasStep([~label.eq(GROUP)]), TraversalFilterStep([VertexStep(OUT,edge), HasStep([~label.eq(PART_OF)]), CountGlobalStep, IsStep(eq(0))])] IncidentToAdjacentStrategy [O] [GraphStep(vertex,[]), HasStep([~label.eq(GROUP)]), TraversalFilterStep([VertexStep(OUT,edge), HasStep([~label.eq(PART_OF)]), CountGlobalStep, IsStep(eq(0))])] AdjacentToIncidentStrategy [O] [GraphStep(vertex,[]), HasStep([~label.eq(GROUP)]), TraversalFilterStep([VertexStep(OUT,edge), HasStep([~label.eq(PART_OF)]), CountGlobalStep, IsStep(eq(0))])] FilterRankingStrategy [O] [GraphStep(vertex,[]), HasStep([~label.eq(GROUP)]), TraversalFilterStep([VertexStep(OUT,edge), HasStep([~label.eq(PART_OF)]), CountGlobalStep, IsStep(eq(0))])] MatchPredicateStrategy [O] [GraphStep(vertex,[]), HasStep([~label.eq(GROUP)]), TraversalFilterStep([VertexStep(OUT,edge), HasStep([~label.eq(PART_OF)]), CountGlobalStep, IsStep(eq(0))])] RepeatUnrollStrategy [O] [GraphStep(vertex,[]), HasStep([~label.eq(GROUP)]), TraversalFilterStep([VertexStep(OUT,edge), HasStep([~label.eq(PART_OF)]), CountGlobalStep, IsStep(eq(0))])] RangeByIsCountStrategy [O] [GraphStep(vertex,[]), HasStep([~label.eq(GROUP)]), TraversalFilterStep([VertexStep(OUT,edge), NotStep(![HasStep([~label.eq(PART_OF)])])])] PathRetractionStrategy [O] [GraphStep(vertex,[]), HasStep([~label.eq(GROUP)]), TraversalFilterStep([VertexStep(OUT,edge), NotStep(![HasStep([~label.eq(PART_OF)])])])] TinkerGraphStepStrategy [P] [TinkerGraphStep(vertex,[~label.eq(GROUP)]), TraversalFilterStep([VertexStep(OUT,edge), NotStep(![HasStep([~label.eq(PART_OF)])])])] ProfileStrategy [F] [TinkerGraphStep(vertex,[~label.eq(GROUP)]), TraversalFilterStep([VertexStep(OUT,edge), NotStep(![HasStep([~label.eq(PART_OF)])])])] StandardVerificationStrategy [V] [TinkerGraphStep(vertex,[~label.eq(GROUP)]), TraversalFilterStep([VertexStep(OUT,edge), NotStep(![HasStep([~label.eq(PART_OF)])])])] Final Traversal [TinkerGraphStep(vertex,[~label.eq(GROUP)]), TraversalFilterStep([VertexStep(OUT,edge), NotStep(![HasStep([~label.eq(PART_OF)])])])] NotStep shoudl be wrapped around VertexStep and HasStep . It should generate this: gremlin> g.V().hasLabel( 'GROUP' ).where(__.outE().not(hasLabel( "PART_OF" ))) // what it does gremlin> g.V().hasLabel( 'GROUP' ).where(__.not(outE().hasLabel( "PART_OF" ))) // what it should do ==>v[0]

          arikc i'd assumed that this also failed in 3.1.3 - did you confirm that it works on 3.1.3 before changing the affected version to 3.2.1? if not, we should fix on the 3.1.x line.

          spmallette Stephen Mallette added a comment - arikc i'd assumed that this also failed in 3.1.3 - did you confirm that it works on 3.1.3 before changing the affected version to 3.2.1? if not, we should fix on the 3.1.x line.
          arikc Arik Cohen added a comment -

          spmallette Thanks very much for the workaround. This works!

          arikc Arik Cohen added a comment - spmallette Thanks very much for the workaround. This works!
          arikc Arik Cohen added a comment -

          spmalletteYou're right. it is an issue on 3.1.3. Interestingly, 3.2.0-incubating does not seem to be affected by this bug.

          arikc Arik Cohen added a comment - spmallette You're right. it is an issue on 3.1.3. Interestingly, 3.2.0-incubating does not seem to be affected by this bug.

          thanks for validating that.

          spmallette Stephen Mallette added a comment - thanks for validating that.
          dkuppitz Daniel Kuppitz added a comment -

          Last statement is invalid. 3.2.x has the same issue.

          dkuppitz Daniel Kuppitz added a comment - Last statement is invalid. 3.2.x has the same issue.
          githubbot ASF GitHub Bot added a comment -

          GitHub user dkuppitz opened a pull request:

          https://github.com/apache/tinkerpop/pull/405

          TINKERPOP-1391 issue with where filter

          Enclose filter steps and side-effect steps in `RangeByIsCountStrategy` when `NotStep` is used to wrap part of the traversal.

          You can merge this pull request into a Git repository by running:

          $ git pull https://github.com/apache/tinkerpop TINKERPOP-1391

          Alternatively you can review and apply these changes as the patch at:

          https://github.com/apache/tinkerpop/pull/405.patch

          To close this pull request, make a commit to your master/trunk branch
          with (at least) the following in the commit message:

          This closes #405



          githubbot ASF GitHub Bot added a comment - GitHub user dkuppitz opened a pull request: https://github.com/apache/tinkerpop/pull/405 TINKERPOP-1391 issue with where filter Enclose filter steps and side-effect steps in `RangeByIsCountStrategy` when `NotStep` is used to wrap part of the traversal. You can merge this pull request into a Git repository by running: $ git pull https://github.com/apache/tinkerpop TINKERPOP-1391 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/tinkerpop/pull/405.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #405
          githubbot ASF GitHub Bot added a comment -

          GitHub user dkuppitz opened a pull request:

          https://github.com/apache/tinkerpop/pull/406

          TINKERPOP-1391 issue with where filter

          Enclose filter steps and side-effect steps in `RangeByIsCountStrategy` when `NotStep` is used to wrap part of the traversal.

          You can merge this pull request into a Git repository by running:

          $ git pull https://github.com/apache/tinkerpop TINKERPOP-1391-master

          Alternatively you can review and apply these changes as the patch at:

          https://github.com/apache/tinkerpop/pull/406.patch

          To close this pull request, make a commit to your master/trunk branch
          with (at least) the following in the commit message:

          This closes #406



          githubbot ASF GitHub Bot added a comment - GitHub user dkuppitz opened a pull request: https://github.com/apache/tinkerpop/pull/406 TINKERPOP-1391 issue with where filter Enclose filter steps and side-effect steps in `RangeByIsCountStrategy` when `NotStep` is used to wrap part of the traversal. You can merge this pull request into a Git repository by running: $ git pull https://github.com/apache/tinkerpop TINKERPOP-1391 -master Alternatively you can review and apply these changes as the patch at: https://github.com/apache/tinkerpop/pull/406.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #406
          githubbot ASF GitHub Bot added a comment -

          Github user spmallette commented on the issue:

          https://github.com/apache/tinkerpop/pull/405

          Looks like this goes to tp31 and master - tp31 should get the CHANGELOG entry then, right?

          githubbot ASF GitHub Bot added a comment - Github user spmallette commented on the issue: https://github.com/apache/tinkerpop/pull/405 Looks like this goes to tp31 and master - tp31 should get the CHANGELOG entry then, right?
          githubbot ASF GitHub Bot added a comment -

          Github user dkuppitz commented on the issue:

          https://github.com/apache/tinkerpop/pull/405

          You're right. Updated both PRs.

          githubbot ASF GitHub Bot added a comment - Github user dkuppitz commented on the issue: https://github.com/apache/tinkerpop/pull/405 You're right. Updated both PRs.
          githubbot ASF GitHub Bot added a comment -

          Github user spmallette commented on the issue:

          https://github.com/apache/tinkerpop/pull/406

          It looks like the code for this is the same as in the PR for tp31, but the commit hashes are different. is this one of those cherry-pick situations you were referencing in hipchat? I suspect that this will merge cleanly if you re-issue the PR with:

          ```text
          git checkout TINKERPOP-1391-master
          git reset --hard origin/master
          git merge TINKERPOP-1391
          git push origin TINKERPOP-1391-master --force
          ```

          githubbot ASF GitHub Bot added a comment - Github user spmallette commented on the issue: https://github.com/apache/tinkerpop/pull/406 It looks like the code for this is the same as in the PR for tp31, but the commit hashes are different. is this one of those cherry-pick situations you were referencing in hipchat? I suspect that this will merge cleanly if you re-issue the PR with: ```text git checkout TINKERPOP-1391 -master git reset --hard origin/master git merge TINKERPOP-1391 git push origin TINKERPOP-1391 -master --force ```
          githubbot ASF GitHub Bot added a comment -

          Github user dkuppitz commented on the issue:

          https://github.com/apache/tinkerpop/pull/406

          Right, this one was cherry-picked. But now, after a reset, a merge and a forced push, the commit hashes are still different.

          githubbot ASF GitHub Bot added a comment - Github user dkuppitz commented on the issue: https://github.com/apache/tinkerpop/pull/406 Right, this one was cherry-picked. But now, after a reset, a merge and a forced push, the commit hashes are still different.
          githubbot ASF GitHub Bot added a comment -

          Github user spmallette commented on the issue:

          https://github.com/apache/tinkerpop/pull/405

          All tests pass with `docker/build.sh -t -i`

          VOTE +1

          githubbot ASF GitHub Bot added a comment - Github user spmallette commented on the issue: https://github.com/apache/tinkerpop/pull/405 All tests pass with `docker/build.sh -t -i` VOTE +1
          githubbot ASF GitHub Bot added a comment -

          Github user spmallette commented on the issue:

          https://github.com/apache/tinkerpop/pull/406

          All tests pass with `docker/build.sh -t -i`

          VOTE +1

          githubbot ASF GitHub Bot added a comment - Github user spmallette commented on the issue: https://github.com/apache/tinkerpop/pull/406 All tests pass with `docker/build.sh -t -i` VOTE +1
          githubbot ASF GitHub Bot added a comment -

          Github user okram commented on the issue:

          https://github.com/apache/tinkerpop/pull/405

          VOTE +1.

          githubbot ASF GitHub Bot added a comment - Github user okram commented on the issue: https://github.com/apache/tinkerpop/pull/405 VOTE +1.
          githubbot ASF GitHub Bot added a comment -

          Github user okram commented on the issue:

          https://github.com/apache/tinkerpop/pull/406

          VOTE +1.

          githubbot ASF GitHub Bot added a comment - Github user okram commented on the issue: https://github.com/apache/tinkerpop/pull/406 VOTE +1.
          githubbot ASF GitHub Bot added a comment -

          Github user asfgit closed the pull request at:

          https://github.com/apache/tinkerpop/pull/406

          githubbot ASF GitHub Bot added a comment - Github user asfgit closed the pull request at: https://github.com/apache/tinkerpop/pull/406
          githubbot ASF GitHub Bot added a comment -

          Github user asfgit closed the pull request at:

          https://github.com/apache/tinkerpop/pull/405

          githubbot ASF GitHub Bot added a comment - Github user asfgit closed the pull request at: https://github.com/apache/tinkerpop/pull/405

          People

            dkuppitz Daniel Kuppitz
            arikc Arik Cohen
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: