You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by ok...@apache.org on 2015/03/28 02:43:51 UTC

incubator-tinkerpop git commit: DetachedEdge attach() has a good exception message now. SparkGraphComputer tweaks.

Repository: incubator-tinkerpop
Updated Branches:
  refs/heads/master f146e49c4 -> 0268df0ea


DetachedEdge attach() has a good exception message now. SparkGraphComputer tweaks.


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

Branch: refs/heads/master
Commit: 0268df0eafd2dd2c925b42ef426138f4efd52d1b
Parents: f146e49
Author: Marko A. Rodriguez <ok...@gmail.com>
Authored: Fri Mar 27 19:43:47 2015 -0600
Committer: Marko A. Rodriguez <ok...@gmail.com>
Committed: Fri Mar 27 19:43:47 2015 -0600

----------------------------------------------------------------------
 .../gremlin/structure/util/detached/DetachedEdge.java         | 7 +++++--
 .../hadoop/process/computer/spark/SparkGraphComputer.java     | 4 ++--
 2 files changed, 7 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/0268df0e/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/detached/DetachedEdge.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/detached/DetachedEdge.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/detached/DetachedEdge.java
index a3f60a8..1013129 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/detached/DetachedEdge.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/detached/DetachedEdge.java
@@ -97,13 +97,16 @@ public class DetachedEdge extends DetachedElement<Edge> implements Edge {
     public Edge attach(final Vertex hostVertex) {
         final Iterator<Edge> edges = IteratorUtils.filter(hostVertex.edges(Direction.OUT, this.label), edge -> edge.equals(this));
         if (!edges.hasNext())
-            throw new IllegalStateException("The detached edge could not be be found incident to the provided vertex: " + this);
+            throw new IllegalStateException("The detached edge could not be found incident to the provided vertex: " + this);
         return edges.next();
     }
 
     @Override
     public Edge attach(final Graph hostGraph) {
-        return hostGraph.edges(this.id).next();
+        final Iterator<Edge> edges = hostGraph.edges(this.id);
+        if (!edges.hasNext())
+            throw new IllegalStateException("The detached edge could not be found in the provided graph: " + this);
+        return edges.next();
     }
 
     public static Edge addTo(final Graph graph, final DetachedEdge detachedEdge) {

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/0268df0e/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/process/computer/spark/SparkGraphComputer.java
----------------------------------------------------------------------
diff --git a/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/process/computer/spark/SparkGraphComputer.java b/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/process/computer/spark/SparkGraphComputer.java
index c2d9a50..f7f5929 100644
--- a/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/process/computer/spark/SparkGraphComputer.java
+++ b/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/process/computer/spark/SparkGraphComputer.java
@@ -205,8 +205,8 @@ public final class SparkGraphComputer implements GraphComputer {
                             // drop all edges and messages in the graphRDD as they are no longer needed for the map reduce jobs
                             graphRDD = graphRDD.mapValues(vertex -> {
                                 vertex.getMessages().clear();
-                                vertex.asVertexPayload().getOutgoingMessages().clear();
-                                vertex.asVertexPayload().getVertex().edges(Direction.BOTH).forEachRemaining(Edge::remove);
+                                vertex.getOutgoingMessages().clear();
+                                vertex.getVertex().edges(Direction.BOTH).forEachRemaining(Edge::remove);
                                 return vertex;
                             });   // todo: cache()?
                             for (final MapReduce mapReduce : this.mapReducers) {