You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by dk...@apache.org on 2018/11/26 21:00:41 UTC
[tinkerpop] branch TINKERPOP-2100 updated (6780d05 -> c42a75e)
This is an automated email from the ASF dual-hosted git repository.
dkuppitz pushed a change to branch TINKERPOP-2100
in repository https://gitbox.apache.org/repos/asf/tinkerpop.git.
discard 6780d05 TINKERPOP-2100 coalesce() creating unexpected results when used with order()
new c42a75e TINKERPOP-2100 coalesce() creating unexpected results when used with order()
This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version. This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:
* -- * -- B -- O -- O -- O (6780d05)
\
N -- N -- N refs/heads/TINKERPOP-2100 (c42a75e)
You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.
Any revisions marked "omit" are not gone; other references still
refer to them. Any revisions marked "discard" are gone forever.
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
.../tinkerpop/gremlin/process/traversal/step/map/CoalesceStep.java | 2 --
1 file changed, 2 deletions(-)
[tinkerpop] 01/01: TINKERPOP-2100 coalesce() creating unexpected
results when used with order()
Posted by dk...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
dkuppitz pushed a commit to branch TINKERPOP-2100
in repository https://gitbox.apache.org/repos/asf/tinkerpop.git
commit c42a75ed97b15c3e0352dda8e3f4d6376c81c7fa
Author: Daniel Kuppitz <da...@hotmail.com>
AuthorDate: Mon Nov 26 13:45:50 2018 -0700
TINKERPOP-2100 coalesce() creating unexpected results when used with order()
---
CHANGELOG.asciidoc | 1 +
.../process/traversal/step/map/CoalesceStep.java | 4 +++-
gremlin-test/features/map/Coalesce.feature | 14 ++++++++++++++
.../process/traversal/step/map/CoalesceTest.java | 17 +++++++++++++++++
4 files changed, 35 insertions(+), 1 deletion(-)
diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc
index 1a0bee5..4972b13 100644
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@ -25,6 +25,7 @@ image::https://raw.githubusercontent.com/apache/tinkerpop/master/docs/static/ima
This release also includes changes from <<release-3-2-11, 3.2.11>>.
+* Fixed a bug in `CoalesceStep` which squared the bulk if the step followed a `Barrier` step.
* Added `:bytecode` command to help developers debugging `Bytecode`-based traversals.
* Fixed `PersistedOutputRDD` to eager persist RDD by adding `count()` action calls.
* Deserialized `g:Set` to a Python `Set` in GraphSON in `gremlin-python`.
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/CoalesceStep.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/CoalesceStep.java
index b80b115..0e6b123 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/CoalesceStep.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/CoalesceStep.java
@@ -50,9 +50,11 @@ public final class CoalesceStep<S, E> extends FlatMapStep<S, E> implements Trave
@Override
protected Iterator<E> flatMap(final Traverser.Admin<S> traverser) {
+ final Traverser.Admin<S> innerTraverser = traverser.clone().asAdmin();
+ innerTraverser.setBulk(1L);
for (final Traversal.Admin<S, E> coalesceTraversal : this.coalesceTraversals) {
coalesceTraversal.reset();
- coalesceTraversal.addStart(traverser.split());
+ coalesceTraversal.addStart(innerTraverser.split());
if (coalesceTraversal.hasNext())
return coalesceTraversal;
}
diff --git a/gremlin-test/features/map/Coalesce.feature b/gremlin-test/features/map/Coalesce.feature
index 8bdac15..3870ee2 100644
--- a/gremlin-test/features/map/Coalesce.feature
+++ b/gremlin-test/features/map/Coalesce.feature
@@ -76,3 +76,17 @@ Feature: Step - coalesce()
| p[josh,created,ripple] |
| p[josh,created,lop] |
| p[peter,created,lop] |
+
+ Scenario: g_V_outXcreatedX_order_byXnameX_coalesceXname_constantXxXX
+ Given the modern graph
+ And the traversal of
+ """
+ g.V().out("created").order().by("name").coalesce(__.values("name"), __.constant("x"))
+ """
+ When iterated to list
+ Then the result should be ordered
+ | result |
+ | lop |
+ | lop |
+ | lop |
+ | ripple |
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/CoalesceTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/CoalesceTest.java
index 9305659..75fd443 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/CoalesceTest.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/CoalesceTest.java
@@ -35,8 +35,10 @@ import java.util.HashMap;
import java.util.Map;
import static org.apache.tinkerpop.gremlin.LoadGraphWith.GraphData.MODERN;
+import static org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__.constant;
import static org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__.out;
import static org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__.outE;
+import static org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__.values;
import static org.junit.Assert.*;
/**
@@ -55,6 +57,8 @@ public abstract class CoalesceTest extends AbstractGremlinProcessTest {
public abstract Traversal<Vertex, Path> get_g_V_coalesceXoutEXknowsX_outEXcreatedXX_otherV_path_byXnameX_byXlabelX();
+ public abstract Traversal<Vertex, String> get_g_V_outXcreatedX_order_byXnameX_coalesceXname_constantXxXX();
+
@Test
@LoadGraphWith(MODERN)
public void g_V_coalesceXoutXfooX_outXbarXX() {
@@ -128,6 +132,14 @@ public abstract class CoalesceTest extends AbstractGremlinProcessTest {
assertFalse(traversal.hasNext());
}
+ @Test
+ @LoadGraphWith(MODERN)
+ public void g_V_outXcreatedX_order_byXnameX_coalesceXname_constantXxXX() {
+ final Traversal<Vertex, String> traversal = get_g_V_outXcreatedX_order_byXnameX_coalesceXname_constantXxXX();
+ printTraversalForm(traversal);
+ checkResults(Arrays.asList("lop", "lop", "lop", "ripple"), traversal);
+ }
+
public static class Traversals extends CoalesceTest {
@Override
public Traversal<Vertex, Vertex> get_g_V_coalesceXoutXfooX_outXbarXX() {
@@ -153,5 +165,10 @@ public abstract class CoalesceTest extends AbstractGremlinProcessTest {
public Traversal<Vertex, Path> get_g_V_coalesceXoutEXknowsX_outEXcreatedXX_otherV_path_byXnameX_byXlabelX() {
return g.V().coalesce(outE("knows"), outE("created")).otherV().path().by("name").by(T.label);
}
+
+ @Override
+ public Traversal<Vertex, String> get_g_V_outXcreatedX_order_byXnameX_coalesceXname_constantXxXX() {
+ return g.V().out("created").order().by("name").coalesce(values("name"), constant("x"));
+ }
}
}