[jira] [Commented] (TINKERPOP-1681) Multiple hasId's are or'd into GraphStep
[ https://issues.apache.org/jira/browse/TINKERPOP-1681?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16027948#comment-16027948 ] Daniel Kuppitz commented on TINKERPOP-1681: --- Yea, I've added your 2 test cases. See: https://github.com/apache/tinkerpop/commit/1856f79ba2558a30d56c8d08f26138dbd29cc370 {{not(identity())}} is out of question, as it would be a bad rewrite. Another thing that came to my mind was {{g.inject([] as Object[])}}, but, well, {{inject()}} always looks so hacky. > Multiple hasId's are or'd into GraphStep > > > Key: TINKERPOP-1681 > URL: https://issues.apache.org/jira/browse/TINKERPOP-1681 > Project: TinkerPop > Issue Type: Bug > Components: process >Affects Versions: 3.2.4 >Reporter: Daniel Kuppitz >Assignee: Daniel Kuppitz > > From the dev mailing list: > {noformat} > @Test > public void testHasId() { > final TinkerGraph graph = TinkerGraph.open(); > Vertex a = graph.addVertex(T.label, "A"); > Vertex b = graph.addVertex(T.label, "B"); > List vertices = > graph.traversal().V().hasId(a.id()).hasId(b.id()).toList(); > Assert.assertTrue(vertices.isEmpty()); > } > {noformat} > The test fails as the both vertices are returned. -- This message was sent by Atlassian JIRA (v6.3.15#6346)
[jira] [Commented] (TINKERPOP-1681) Multiple hasId's are or'd into GraphStep
[ https://issues.apache.org/jira/browse/TINKERPOP-1681?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16027922#comment-16027922 ] pieter martin commented on TINKERPOP-1681: -- Just to check does your fix also work for, {noformat} final TinkerGraph graph = TinkerGraph.open(); Vertex a = graph.addVertex(T.label, "A"); Vertex b = graph.addVertex(T.label, "B"); List vertices = graph.traversal().V(a.id()).hasId(b.id()).toList(); Assert.assertTrue(vertices.isEmpty()); {noformat} Regarding {{g.V().not(identity())}} it for sure is bad as {{not(identity())}} is not the kind of thing that Sqlg at least, even tries to optimize. > Multiple hasId's are or'd into GraphStep > > > Key: TINKERPOP-1681 > URL: https://issues.apache.org/jira/browse/TINKERPOP-1681 > Project: TinkerPop > Issue Type: Bug > Components: process >Affects Versions: 3.2.4 >Reporter: Daniel Kuppitz >Assignee: Daniel Kuppitz > > From the dev mailing list: > {noformat} > @Test > public void testHasId() { > final TinkerGraph graph = TinkerGraph.open(); > Vertex a = graph.addVertex(T.label, "A"); > Vertex b = graph.addVertex(T.label, "B"); > List vertices = > graph.traversal().V().hasId(a.id()).hasId(b.id()).toList(); > Assert.assertTrue(vertices.isEmpty()); > } > {noformat} > The test fails as the both vertices are returned. -- This message was sent by Atlassian JIRA (v6.3.15#6346)
[jira] [Commented] (TINKERPOP-1681) Multiple hasId's are or'd into GraphStep
[ https://issues.apache.org/jira/browse/TINKERPOP-1681?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16027825#comment-16027825 ] Daniel Kuppitz commented on TINKERPOP-1681: --- I have a fix locally (the only folds the first set of ids into GraphStep), but I wonder if we should be smarter. We could take the intersection of multiple {{hasId}}'s, so that {noformat} g.V().hasId(within(1,2)).hasId(within(2,3)) {noformat} ... becomes: {noformat} g.V().hasId(2) // or g.V().hasId(within(2)) {noformat} But what if the intersection is empty? {noformat} g.V().hasId(within(1,2)).hasId(3) {noformat} ... could be converted into something like this: {noformat} g.V().not(identity()) {noformat} However, that turns the query into a full-scan query, which is not acceptable IMO. Other suggestions? > Multiple hasId's are or'd into GraphStep > > > Key: TINKERPOP-1681 > URL: https://issues.apache.org/jira/browse/TINKERPOP-1681 > Project: TinkerPop > Issue Type: Bug > Components: process >Affects Versions: 3.2.4 >Reporter: Daniel Kuppitz >Assignee: Daniel Kuppitz > > From the dev mailing list: > {noformat} > @Test > public void testHasId() { > final TinkerGraph graph = TinkerGraph.open(); > Vertex a = graph.addVertex(T.label, "A"); > Vertex b = graph.addVertex(T.label, "B"); > List vertices = > graph.traversal().V().hasId(a.id()).hasId(b.id()).toList(); > Assert.assertTrue(vertices.isEmpty()); > } > {noformat} > The test fails as the both vertices are returned. -- This message was sent by Atlassian JIRA (v6.3.15#6346)
Re: hasId
I created the ticket: https://issues.apache.org/jira/browse/TINKERPOP-1681 On Sun, May 28, 2017 at 11:12 AM, Daniel Kuppitzwrote: > Hi Pieter, > > that's a nasty bug. I just verified that it's also a bug in master/: > > gremlin> graph = TinkerGraph.open() > ==>tinkergraph[vertices:0 edges:0] > gremlin> a = graph.addVertex(label, "A") > ==>v[0] > gremlin> b = graph.addVertex(label, "B") > ==>v[1] > gremlin> graph.traversal().V().hasId(a.id()).hasId(b.id()) > ==>v[0] > ==>v[1] > gremlin> graph.traversal().V().hasId(a.id()).hasId(b.id()).explain() > ==>Traversal Explanation > > == > Original Traversal [GraphStep(vertex,[]), > HasStep([~id.eq(0), ~id.eq(1)])] > > ConnectiveStrategy [D] [GraphStep(vertex,[]), > HasStep([~id.eq(0), ~id.eq(1)])] > MatchPredicateStrategy [O] [GraphStep(vertex,[]), > HasStep([~id.eq(0), ~id.eq(1)])] > FilterRankingStrategy[O] [GraphStep(vertex,[]), > HasStep([~id.eq(0), ~id.eq(1)])] > InlineFilterStrategy [O] [GraphStep(vertex,[]), > HasStep([~id.eq(0), ~id.eq(1)])] > IncidentToAdjacentStrategy [O] [GraphStep(vertex,[]), > HasStep([~id.eq(0), ~id.eq(1)])] > AdjacentToIncidentStrategy [O] [GraphStep(vertex,[]), > HasStep([~id.eq(0), ~id.eq(1)])] > RepeatUnrollStrategy [O] [GraphStep(vertex,[]), > HasStep([~id.eq(0), ~id.eq(1)])] > CountStrategy[O] [GraphStep(vertex,[]), > HasStep([~id.eq(0), ~id.eq(1)])] > PathRetractionStrategy [O] [GraphStep(vertex,[]), > HasStep([~id.eq(0), ~id.eq(1)])] > LazyBarrierStrategy [O] [GraphStep(vertex,[]), > HasStep([~id.eq(0), ~id.eq(1)])] > TinkerGraphCountStrategy [P] [GraphStep(vertex,[]), > HasStep([~id.eq(0), ~id.eq(1)])] > TinkerGraphStepStrategy [P] [TinkerGraphStep(vertex,[0, 1])] > ProfileStrategy [F] [TinkerGraphStep(vertex,[0, 1])] > StandardVerificationStrategy [V] [TinkerGraphStep(vertex,[0, 1])] > > Final Traversal[TinkerGraphStep(vertex,[0, 1])] > gremlin> Gremlin.version() > ==>3.3.0-SNAPSHOT > > Can you create a ticket? > > Cheers, > Daniel > > > On Sun, May 28, 2017 at 10:45 AM, pieter gmail > wrote: > >> Hi, >> >> The following code illustrates my concern/confusion. >> >> @Test >> public void testHasId() { >> final TinkerGraph graph = TinkerGraph.open(); >> Vertex a = graph.addVertex(T.label, "A"); >> Vertex b = graph.addVertex(T.label, "B"); >> >> List vertices = graph.traversal().V().hasId(a.id >> ()).hasId(b.id()).toList(); >> Assert.assertTrue(vertices.isEmpty()); >> } >> >> The test fails as the both vertices are returned. >> Is this expected, I expected 'and' not 'or' behavior. >> >> Similar to, >> >> @Test >> public void testHasLabel() { >> final TinkerGraph graph = TinkerGraph.open(); >> Vertex a = graph.addVertex(T.label, "A"); >> Vertex b = graph.addVertex(T.label, "B"); >> >> List vertices = graph.traversal().V().hasLabel >> ("A").hasLabel("B").toList(); >> Assert.assertTrue(vertices.isEmpty()); >> } >> >> This one passes. >> >> I checked the docs, >> >> |hasLabel(labels...)|: Remove the traverser if its element does not have >> any of the labels. >> |hasId(ids...)|: Remove the traverser if its element does not have any of >> the ids. >> >> Seems they should behave the same? >> >> I am working on version 3.2.4 >> >> Thanks >> Pieter >> >> >
[jira] [Created] (TINKERPOP-1681) Multiple hasId's are or'd into GraphStep
Daniel Kuppitz created TINKERPOP-1681: - Summary: Multiple hasId's are or'd into GraphStep Key: TINKERPOP-1681 URL: https://issues.apache.org/jira/browse/TINKERPOP-1681 Project: TinkerPop Issue Type: Bug Components: process Affects Versions: 3.2.4 Reporter: Daniel Kuppitz Assignee: Daniel Kuppitz >From the dev mailing list: {noformat} @Test public void testHasId() { final TinkerGraph graph = TinkerGraph.open(); Vertex a = graph.addVertex(T.label, "A"); Vertex b = graph.addVertex(T.label, "B"); List vertices = graph.traversal().V().hasId(a.id()).hasId(b.id()).toList(); Assert.assertTrue(vertices.isEmpty()); } {noformat} The test fails as the both vertices are returned. -- This message was sent by Atlassian JIRA (v6.3.15#6346)
Re: hasId
Hi Pieter, that's a nasty bug. I just verified that it's also a bug in master/: gremlin> graph = TinkerGraph.open() ==>tinkergraph[vertices:0 edges:0] gremlin> a = graph.addVertex(label, "A") ==>v[0] gremlin> b = graph.addVertex(label, "B") ==>v[1] gremlin> graph.traversal().V().hasId(a.id()).hasId(b.id()) ==>v[0] ==>v[1] gremlin> graph.traversal().V().hasId(a.id()).hasId(b.id()).explain() ==>Traversal Explanation == Original Traversal [GraphStep(vertex,[]), HasStep([~id.eq(0), ~id.eq(1)])] ConnectiveStrategy [D] [GraphStep(vertex,[]), HasStep([~id.eq(0), ~id.eq(1)])] MatchPredicateStrategy [O] [GraphStep(vertex,[]), HasStep([~id.eq(0), ~id.eq(1)])] FilterRankingStrategy[O] [GraphStep(vertex,[]), HasStep([~id.eq(0), ~id.eq(1)])] InlineFilterStrategy [O] [GraphStep(vertex,[]), HasStep([~id.eq(0), ~id.eq(1)])] IncidentToAdjacentStrategy [O] [GraphStep(vertex,[]), HasStep([~id.eq(0), ~id.eq(1)])] AdjacentToIncidentStrategy [O] [GraphStep(vertex,[]), HasStep([~id.eq(0), ~id.eq(1)])] RepeatUnrollStrategy [O] [GraphStep(vertex,[]), HasStep([~id.eq(0), ~id.eq(1)])] CountStrategy[O] [GraphStep(vertex,[]), HasStep([~id.eq(0), ~id.eq(1)])] PathRetractionStrategy [O] [GraphStep(vertex,[]), HasStep([~id.eq(0), ~id.eq(1)])] LazyBarrierStrategy [O] [GraphStep(vertex,[]), HasStep([~id.eq(0), ~id.eq(1)])] TinkerGraphCountStrategy [P] [GraphStep(vertex,[]), HasStep([~id.eq(0), ~id.eq(1)])] TinkerGraphStepStrategy [P] [TinkerGraphStep(vertex,[0, 1])] ProfileStrategy [F] [TinkerGraphStep(vertex,[0, 1])] StandardVerificationStrategy [V] [TinkerGraphStep(vertex,[0, 1])] Final Traversal[TinkerGraphStep(vertex,[0, 1])] gremlin> Gremlin.version() ==>3.3.0-SNAPSHOT Can you create a ticket? Cheers, Daniel On Sun, May 28, 2017 at 10:45 AM, pieter gmailwrote: > Hi, > > The following code illustrates my concern/confusion. > > @Test > public void testHasId() { > final TinkerGraph graph = TinkerGraph.open(); > Vertex a = graph.addVertex(T.label, "A"); > Vertex b = graph.addVertex(T.label, "B"); > > List vertices = graph.traversal().V().hasId(a.id()).hasId( > b.id()).toList(); > Assert.assertTrue(vertices.isEmpty()); > } > > The test fails as the both vertices are returned. > Is this expected, I expected 'and' not 'or' behavior. > > Similar to, > > @Test > public void testHasLabel() { > final TinkerGraph graph = TinkerGraph.open(); > Vertex a = graph.addVertex(T.label, "A"); > Vertex b = graph.addVertex(T.label, "B"); > > List vertices = graph.traversal().V().hasLabel > ("A").hasLabel("B").toList(); > Assert.assertTrue(vertices.isEmpty()); > } > > This one passes. > > I checked the docs, > > |hasLabel(labels...)|: Remove the traverser if its element does not have > any of the labels. > |hasId(ids...)|: Remove the traverser if its element does not have any of > the ids. > > Seems they should behave the same? > > I am working on version 3.2.4 > > Thanks > Pieter > >
RE: hasId
Hi, The following code illustrates my concern/confusion. @Test public void testHasId() { final TinkerGraph graph = TinkerGraph.open(); Vertex a = graph.addVertex(T.label, "A"); Vertex b = graph.addVertex(T.label, "B"); List vertices = graph.traversal().V().hasId(a.id()).hasId(b.id()).toList(); Assert.assertTrue(vertices.isEmpty()); } The test fails as the both vertices are returned. Is this expected, I expected 'and' not 'or' behavior. Similar to, @Test public void testHasLabel() { final TinkerGraph graph = TinkerGraph.open(); Vertex a = graph.addVertex(T.label, "A"); Vertex b = graph.addVertex(T.label, "B"); List vertices = graph.traversal().V().hasLabel("A").hasLabel("B").toList(); Assert.assertTrue(vertices.isEmpty()); } This one passes. I checked the docs, |hasLabel(labels...)|: Remove the traverser if its element does not have any of the labels. |hasId(ids...)|: Remove the traverser if its element does not have any of the ids. Seems they should behave the same? I am working on version 3.2.4 Thanks Pieter