Fixed a bug in OLAP RepeatStep where emit().as('x') wasn't behaving correctly. 
Basically, forgot to add the step labels to the emitTraverser. One line fix. 
Added the complex @dkuppitz traversal DedupTest which demonstrates that local 
dedup works correctly in OLAP.


Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/85eebfab
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/85eebfab
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/85eebfab

Branch: refs/heads/master
Commit: 85eebfab89d9c130f9515e1e8953589a22f8e449
Parents: 0dcf659
Author: Marko A. Rodriguez <okramma...@gmail.com>
Authored: Tue Oct 11 09:06:28 2016 -0600
Committer: Marko A. Rodriguez <okramma...@gmail.com>
Committed: Tue Oct 11 09:06:28 2016 -0600

----------------------------------------------------------------------
 CHANGELOG.asciidoc                              |  1 +
 .../process/traversal/step/GraphComputing.java  |  1 -
 .../traversal/step/branch/RepeatStep.java       |  1 +
 .../step/filter/GroovyDedupTest.groovy          |  5 ++++
 .../traversal/step/filter/DedupTest.java        | 24 +++++++++++++++++---
 5 files changed, 28 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/85eebfab/CHANGELOG.asciidoc
----------------------------------------------------------------------
diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc
index fbb6043..17cd3b7 100644
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@ -26,6 +26,7 @@ 
image::https://raw.githubusercontent.com/apache/tinkerpop/master/docs/static/ima
 TinkerPop 3.2.3 (Release Date: NOT OFFICIALLY RELEASED YET)
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
+* Fixed a bug in `RepeatStep` where `emit().as('x')` wasn't adding the step 
labels to the emit-traverser.
 * Added `GraphComputing.atMaster(boolean)` to allow steps to know whether they 
are executing at master or distributed at workers.
 * Fixed a bug in OLAP where `DedupGlobalStep` wasn't de-duping local master 
traversers.
 * Added `HasContainerHolder.removeHasContainer()`-method with default 
`UnsupportedOperationException` implementation.

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/85eebfab/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/GraphComputing.java
----------------------------------------------------------------------
diff --git 
a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/GraphComputing.java
 
b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/GraphComputing.java
index bd9fc42..cec5708 100644
--- 
a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/GraphComputing.java
+++ 
b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/GraphComputing.java
@@ -61,5 +61,4 @@ public interface GraphComputing {
             }
         }
     }
-
 }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/85eebfab/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/branch/RepeatStep.java
----------------------------------------------------------------------
diff --git 
a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/branch/RepeatStep.java
 
b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/branch/RepeatStep.java
index b365d7f..ebdb657 100644
--- 
a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/branch/RepeatStep.java
+++ 
b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/branch/RepeatStep.java
@@ -291,6 +291,7 @@ public final class RepeatStep<S> extends 
ComputerAwareStep<S, S> implements Trav
                     final Traverser.Admin<S> emitSplit = start.split();
                     emitSplit.resetLoops();
                     emitSplit.setStepId(repeatStep.getNextStep().getId());
+                    emitSplit.addLabels(repeatStep.labels);
                     return IteratorUtils.of(start, emitSplit);
                 }
                 return IteratorUtils.of(start);

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/85eebfab/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/filter/GroovyDedupTest.groovy
----------------------------------------------------------------------
diff --git 
a/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/filter/GroovyDedupTest.groovy
 
b/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/filter/GroovyDedupTest.groovy
index a091c6f..83428c2 100644
--- 
a/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/filter/GroovyDedupTest.groovy
+++ 
b/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/filter/GroovyDedupTest.groovy
@@ -99,5 +99,10 @@ public abstract class GroovyDedupTest {
         public Traversal<Vertex, Long> 
get_g_V_groupCount_selectXvaluesX_unfold_dedup() {
             new ScriptTraversal<>(g, "gremlin-groovy", 
"g.V.groupCount.select(values).unfold.dedup")
         }
+
+        @Override
+        public Traversal<Vertex, Collection<Vertex>> 
get_g_V_asXaX_repeatXbothX_timesX3X_emit_asXbX_group_byXselectXaXX_byXselectXbX_dedup_order_byXidX_foldX_selectXvaluesX_unfold_dedup()
 {
+            new ScriptTraversal<>(g, "gremlin-groovy", 
"g.V.as('a').repeat(both()).times(3).emit.as('b').group.by(select('a')).by(select('b').dedup.order.by(id).fold).select(values).unfold.dedup")
+        }
     }
 }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/85eebfab/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/filter/DedupTest.java
----------------------------------------------------------------------
diff --git 
a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/filter/DedupTest.java
 
b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/filter/DedupTest.java
index 970a976..19e685a 100644
--- 
a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/filter/DedupTest.java
+++ 
b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/filter/DedupTest.java
@@ -85,6 +85,8 @@ public abstract class DedupTest extends 
AbstractGremlinProcessTest {
 
     public abstract Traversal<Vertex, Long> 
get_g_V_groupCount_selectXvaluesX_unfold_dedup();
 
+    public abstract Traversal<Vertex, Collection<Vertex>> 
get_g_V_asXaX_repeatXbothX_timesX3X_emit_asXbX_group_byXselectXaXX_byXselectXbX_dedup_order_byXidX_foldX_selectXvaluesX_unfold_dedup();
+
     @Test
     @LoadGraphWith(MODERN)
     public void g_V_out_in_valuesXnameX_fold_dedupXlocalX_unfold() {
@@ -281,6 +283,22 @@ public abstract class DedupTest extends 
AbstractGremlinProcessTest {
         checkResults(Collections.singletonList(1L), traversal);
     }
 
+    @Test
+    @LoadGraphWith
+    public void 
g_V_asXaX_repeatXbothX_timesX3X_emit_asXbX_group_byXselectXaXX_byXselectXbX_dedup_order_byXidX_foldX_selectXvaluesX_unfold_dedup()
 {
+        final Traversal<Vertex, Collection<Vertex>> traversal = 
get_g_V_asXaX_repeatXbothX_timesX3X_emit_asXbX_group_byXselectXaXX_byXselectXbX_dedup_order_byXidX_foldX_selectXvaluesX_unfold_dedup();
+        printTraversalForm(traversal);
+        final Collection<Vertex> vertices = traversal.next();
+        assertFalse(traversal.hasNext());
+        assertEquals(6, vertices.size());
+        assertTrue(vertices.contains(convertToVertex(graph, "marko")));
+        assertTrue(vertices.contains(convertToVertex(graph, "vadas")));
+        assertTrue(vertices.contains(convertToVertex(graph, "josh")));
+        assertTrue(vertices.contains(convertToVertex(graph, "peter")));
+        assertTrue(vertices.contains(convertToVertex(graph, "lop")));
+        assertTrue(vertices.contains(convertToVertex(graph, "ripple")));
+    }
+
     public static class Traversals extends DedupTest {
         @Override
         public Traversal<Vertex, String> 
get_g_V_out_in_valuesXnameX_fold_dedupXlocalX_unfold() {
@@ -352,9 +370,9 @@ public abstract class DedupTest extends 
AbstractGremlinProcessTest {
             return g.V().groupCount().select(values).<Long>unfold().dedup();
         }
 
-        /*@Override
-        public Traversal<Vertex,Collection<Vertex>> 
get_g_V_asXaX_repeatXbothX_timesX3X_emit_asXbX_group_byXselectXaXX_byXselectXbX_dedup_order_byXidX_foldX_selectXvaluesX_unfold_dedup()
 {
+        @Override
+        public Traversal<Vertex, Collection<Vertex>> 
get_g_V_asXaX_repeatXbothX_timesX3X_emit_asXbX_group_byXselectXaXX_byXselectXbX_dedup_order_byXidX_foldX_selectXvaluesX_unfold_dedup()
 {
             return 
g.V().as("a").repeat(both()).times(3).emit().as("b").group().by(select("a")).by(select("b").dedup().order().by(T.id).fold()).select(values).<Collection<Vertex>>unfold().dedup();
-        }*/
+        }
     }
 }

Reply via email to