Hello Pieter, There was a bug in RepeatStep OLAP around emit().as(‘x’) that was fixed in 3.2.3. Perhaps it is related…
Marko. http://markorodriguez.com > On Oct 26, 2016, at 3:44 AM, pieter-gmail <pieter.mar...@gmail.com> wrote: > > Thanks, now I know Sqlg has indeed been bugged. I am loosing the label > after the emit().as("b"). > > Cheers > Pieter > > On 25/10/2016 21:29, Marko Rodriguez wrote: >> Here is a simple test. Remove PathRetractionStrategy from TinkerGraph >> traversal and see what you get? Do you get what Sqlg returns or the same as >> if with PathRetractionStrategy. >> >> E.g. >> >> graph = TinkerFactory.createModern(); >> g = graph.traversal().withoutStrategies(PathRetractionStrategy.class); >> g.V().the().traversal().to().test() >> >> If you get the same answer without PathRetractionStrategy, then you know >> that Sqlg is bugged. >> >> HTH, >> Marko. >> >> http://markorodriguez.com >> >> >> >>> On Oct 24, 2016, at 2:21 PM, pieter-gmail <pieter.mar...@gmail.com> wrote: >>> >>> Ok apologies. I thought I spotted the difference and simplified the >>> gremlin too much to highlight what I thought I saw. The above mentioned >>> queries are returning the same result in Sqlg as TinkerGraph. >>> >>> Here is what is not working. >>> >>> final TinkerGraph g = TinkerFactory.createModern(); >>> GraphTraversal<Vertex, Map<Vertex, Collection<Vertex>>> >>> traversal = g.traversal() >>> .V().as("a") >>> .repeat(both()).times(3).emit().as("b") >>> .<Vertex, Collection<Vertex>>group().by(select("a")); >>> printTraversalForm(traversal); >>> while (traversal.hasNext()) { >>> Map<Vertex, Collection<Vertex>> vertexMap = traversal.next(); >>> for (Vertex vertex : vertexMap.keySet()) { >>> Collection<Vertex> coll = vertexMap.get(vertex); >>> System.out.println("key: " + vertex.value("name") + ", >>> value: " + coll.size()); >>> } >>> } >>> >>> For this Sqlg has the same result as TinkerGraph. >>> >>> TinkerGraph >>> >>> post-strategy:[TinkerGraphStep(vertex,[])@[a], >>> RepeatStep([VertexStep(BOTH,vertex), >>> RepeatEndStep],until(loops(3)),emit(true))@[b], >>> GroupStep([SelectOneStep(a), NoOpBarrierStep(2500)],[FoldStep])] >>> >>> Sqlg >>> >>> post-strategy:[SqlgGraphStepCompiled(vertex,[])@[sqlgPathFakeLabel], >>> GroupStep([SelectOneStep(a)],[FoldStep])] >>> >>> key: marko, value: 27 >>> key: vadas, value: 11 >>> key: lop, value: 27 >>> key: josh, value: 27 >>> key: ripple, value: 11 >>> key: peter, value: 11 >>> >>> Adding in the extra by() >>> >>> final TinkerGraph g = TinkerFactory.createModern(); >>> GraphTraversal<Vertex, Map<Vertex, Collection<Vertex>>> >>> traversal = g.traversal() >>> .V().as("a") >>> .repeat(both()).times(3).emit().as("b") >>> .<Vertex, Collection<Vertex>>group().by(select("a")) >>> .by(select("b").dedup().order().by(T.id).fold()); >>> printTraversalForm(traversal); >>> while (traversal.hasNext()) { >>> Map<Vertex, Collection<Vertex>> vertexMap = traversal.next(); >>> for (Vertex vertex : vertexMap.keySet()) { >>> Collection<Vertex> coll = vertexMap.get(vertex); >>> System.out.println("key: " + vertex.value("name") + ", >>> value: " + coll.size()); >>> } >>> } >>> >>> TinkerGraph prints >>> >>> post-strategy:[TinkerGraphStep(vertex,[])@[a], >>> RepeatStep([VertexStep(BOTH,vertex), >>> RepeatEndStep],until(loops(3)),emit(true))@[b], >>> GroupStep([SelectOneStep(a), NoOpBarrierStep(2500)],[SelectOneStep(b), >>> DedupGlobalStep, OrderGlobalStep([[id, incr]]), FoldStep])] >>> >>> key: marko, value: 6 >>> key: vadas, value: 6 >>> key: lop, value: 6 >>> key: josh, value: 6 >>> key: ripple, value: 6 >>> key: peter, value: 6 >>> >>> and Sqlg >>> >>> post-strategy:[SqlgGraphStepCompiled(vertex,[])@[sqlgPathFakeLabel], >>> GroupStep([SelectOneStep(a)],[SelectOneStep(b), DedupGlobalStep, >>> OrderGlobalStep([[id, incr]]), FoldStep])] >>> >>> key: marko, value: 0 >>> key: ripple, value: 0 >>> key: peter, value: 0 >>> key: lop, value: 0 >>> key: josh, value: 0 >>> key: vadas, value: 0 >>> >>> The difference being the NoOpBarrierStep but I am not sure if that is >>> the culprit or not. >>> >>> Thanks >>> Pieter >>> >>> >>> >>> >>> >>> >>> On 24/10/2016 21:31, Marko Rodriguez wrote: >>>> Hi Pieter, >>>> >>>> What are the two answers --- TinkerGraph and Sqlg for the respective test >>>> traversal? >>>> >>>> (I suspect the test is bad because group() pushes traversers through with >>>> bulks and all so the test might just add to a collection without adding >>>> respecting bulks. Probably should change that test regardless to do like a >>>> count or something instead). >>>> >>>> Marko. >>>> >>>> http://markorodriguez.com >>>> >>>> >>>> >>>>> On Oct 24, 2016, at 12:57 PM, pieter-gmail <pieter.mar...@gmail.com> >>>>> wrote: >>>>> >>>>> Hi, >>>>> >>>>> This is on 3.2.3 >>>>> >>>>> I have been investigating why >>>>> `DedupTest.g_V_asXaX_repeatXbothX_timesX3X_emit_asXbX_group_byXselectXaXX_byXselectXbX_dedup_order_byXidX_foldX_selectXvaluesX_unfold_dedup` >>>>> fails on Sqlg. It is a fairly recently added test. >>>>> >>>>> My investigation so far has narrowed the problem to the >>>>> `PathRetractionStrategy` >>>>> >>>>> On the modern graph, >>>>> >>>>> GraphTraversal<Vertex, Map<Vertex, Collection<Vertex>>> >>>>> traversal = g.traversal() >>>>> .V().as("a") >>>>> .out().as("b") >>>>> .<Vertex, Collection<Vertex>>group().by(select("a")) >>>>> .by(select("b")); >>>>> printTraversalForm(traversal); >>>>> >>>>> Outputs the following on TinkerGraph >>>>> >>>>> pre-strategy:[GraphStep(vertex,[])@[a], VertexStep(OUT,vertex)@[b], >>>>> GroupStep([SelectOneStep(a)],[SelectOneStep(b)])] >>>>> post-strategy:[TinkerGraphStep(vertex,[])@[a], >>>>> VertexStep(OUT,vertex)@[b], GroupStep([SelectOneStep(a), >>>>> NoOpBarrierStep(2500)],[SelectOneStep(b), NoOpBarrierStep(2500)])] >>>>> >>>>> And on Sqlg >>>>> pre-strategy:[GraphStep(vertex,[])@[a], VertexStep(OUT,vertex)@[b], >>>>> GroupStep([SelectOneStep(a)],[SelectOneStep(b)])] >>>>> post-strategy:[SqlgGraphStepCompiled(vertex,[])@[b], >>>>> GroupStep([SelectOneStep(a)],[SelectOneStep(b)])] >>>>> >>>>> The difference being that Sqlg does not have the `NoOpBarrierStep` >>>>> inserted. >>>>> >>>>> For TinkerGraph the `NoOpBarrierStep` is being inserted in the >>>>> `PathRetractionStrategy` on line 113 >>>>> However this does not happen for Sqlg as Sqlg's GraphStep has >>>>> `TraverRequirement.PATH` as a requirement which prevents >>>>> `PathRetractionStrategy` from doing what it does. >>>>> >>>>> Is this a bug of sorts? Should Sqlg be adding in the `NoOpBarrierStep`? >>>>> >>>>> Thanks >>>>> Pieter >> >