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/05/12 00:52:57 UTC
incubator-tinkerpop git commit: Simplified ComputerGraph as MapReduce
does not need the VertexProgram.
Repository: incubator-tinkerpop
Updated Branches:
refs/heads/master 61af2e760 -> 8be247e35
Simplified ComputerGraph as MapReduce does not need the VertexProgram.
Project: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/commit/8be247e3
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/tree/8be247e3
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/diff/8be247e3
Branch: refs/heads/master
Commit: 8be247e355e3db41dccb8556215b9090af0ed7c1
Parents: 61af2e7
Author: Marko A. Rodriguez <ok...@gmail.com>
Authored: Mon May 11 16:52:50 2015 -0600
Committer: Marko A. Rodriguez <ok...@gmail.com>
Committed: Mon May 11 16:52:50 2015 -0600
----------------------------------------------------------------------
.../process/computer/util/ComputerGraph.java | 6 +-
.../computer/util/ComputerGraphTest.java | 81 --------------------
.../hadoop/process/computer/HadoopMap.java | 2 +-
.../process/computer/spark/SparkExecutor.java | 2 +-
.../process/computer/TinkerGraphComputer.java | 2 +-
5 files changed, 6 insertions(+), 87 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/8be247e3/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/util/ComputerGraph.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/util/ComputerGraph.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/util/ComputerGraph.java
index 8186a74..1e79132 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/util/ComputerGraph.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/util/ComputerGraph.java
@@ -55,7 +55,7 @@ public final class ComputerGraph implements Graph {
private final Set<String> computeKeys;
private State state;
- public ComputerGraph(final State state, final Vertex starVertex, final Optional<VertexProgram> vertexProgram) {
+ private ComputerGraph(final State state, final Vertex starVertex, final Optional<VertexProgram> vertexProgram) {
this.state = state;
this.computeKeys = vertexProgram.isPresent() ? vertexProgram.get().getElementComputeKeys() : Collections.emptySet();
this.starVertex = new ComputerVertex(starVertex);
@@ -65,8 +65,8 @@ public final class ComputerGraph implements Graph {
return new ComputerGraph(State.VERTEX_PROGRAM, starVertex, Optional.of(vertexProgram)).getStarVertex();
}
- public static ComputerVertex mapReduce(final Vertex starVertex, Optional<VertexProgram> vertexProgram) {
- return new ComputerGraph(State.MAP_REDUCE, starVertex, vertexProgram).getStarVertex();
+ public static ComputerVertex mapReduce(final Vertex starVertex) {
+ return new ComputerGraph(State.MAP_REDUCE, starVertex, Optional.empty()).getStarVertex();
}
public ComputerVertex getStarVertex() {
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/8be247e3/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/computer/util/ComputerGraphTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/computer/util/ComputerGraphTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/computer/util/ComputerGraphTest.java
deleted file mode 100644
index 3cb32a3..0000000
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/computer/util/ComputerGraphTest.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tinkerpop.gremlin.process.computer.util;
-
-import org.apache.tinkerpop.gremlin.AbstractGremlinTest;
-import org.apache.tinkerpop.gremlin.process.UseEngine;
-import org.apache.tinkerpop.gremlin.process.traversal.TraversalEngine;
-import org.junit.Test;
-
-/**
- * @author Stephen Mallette (http://stephen.genoprime.com)
- */
-@UseEngine(TraversalEngine.Type.COMPUTER)
-public class ComputerGraphTest extends AbstractGremlinTest {
-
- @Test
- public void shouldTrue() {
- }
-
- /*@Test
- @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
- public void shouldFilterHiddenProperties() {
- final ComputerGraph sg = new ComputerGraph(graph, new HashSet<>(Arrays.asList("***hidden-guy")));
-
- final Vertex v = sg.addVertex("***hidden-guy", "X", "not-hidden-guy", "Y");
- final Iterator<VertexProperty<String>> props = v.properties();
- final VertexProperty v1 = props.next();
- assertEquals("Y", v1.value());
- assertEquals("not-hidden-guy", v1.key());
- assertFalse(props.hasNext());
-
- final Iterator<String> values = v.values();
- assertEquals("Y", values.next());
- assertFalse(values.hasNext());
- }
-
- @Test
- @Ignore("We need to decide the semantics")
- @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
- public void shouldAccessHiddenProperties() {
- final ComputerGraph sg = new ComputerGraph(graph, new HashSet<>(new HashSet<>(Arrays.asList("***hidden-guy"))));
-
- final Vertex v = sg.addVertex("***hidden-guy", "X", "not-hidden-guy", "Y");
- final Iterator<VertexProperty<String>> props = v.properties("***hidden-guy");
- final VertexProperty<String> v1 = props.next();
- assertEquals("X", v1.value());
- assertEquals("***hidden-guy", v1.key());
- assertFalse(props.hasNext());
-
- final Iterator<String> values = v.values("***hidden-guy");
- assertEquals("X", values.next());
- assertFalse(values.hasNext());
- }
-
- @Test
- @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
- public void shouldHideHiddenKeys() {
- final ComputerGraph sg = new ComputerGraph(graph, new HashSet<>(Arrays.asList("***hidden-guy")));
-
- final Vertex v = sg.addVertex("***hidden-guy", "X", "not-hidden-guy", "Y");
- final Set<String> keys = v.keys();
- assertTrue(keys.contains("not-hidden-guy"));
- assertFalse(keys.contains("***hidden-guy"));
- } */
-}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/8be247e3/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/process/computer/HadoopMap.java
----------------------------------------------------------------------
diff --git a/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/process/computer/HadoopMap.java b/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/process/computer/HadoopMap.java
index 2250c7e..def0753 100644
--- a/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/process/computer/HadoopMap.java
+++ b/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/process/computer/HadoopMap.java
@@ -56,7 +56,7 @@ public class HadoopMap extends Mapper<NullWritable, VertexWritable, ObjectWritab
@Override
public void map(final NullWritable key, final VertexWritable value, final Mapper<NullWritable, VertexWritable, ObjectWritable, ObjectWritable>.Context context) throws IOException, InterruptedException {
this.mapEmitter.setContext(context);
- this.mapReduce.map(ComputerGraph.mapReduce(value.get(), Optional.empty()), this.mapEmitter); // TODO: not Optional.empty()!
+ this.mapReduce.map(ComputerGraph.mapReduce(value.get()), this.mapEmitter);
}
@Override
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/8be247e3/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/process/computer/spark/SparkExecutor.java
----------------------------------------------------------------------
diff --git a/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/process/computer/spark/SparkExecutor.java b/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/process/computer/spark/SparkExecutor.java
index 93decdb..278b257 100644
--- a/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/process/computer/spark/SparkExecutor.java
+++ b/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/process/computer/spark/SparkExecutor.java
@@ -166,7 +166,7 @@ public final class SparkExecutor {
workerMapReduce.workerStart(MapReduce.Stage.MAP);
final SparkMapEmitter<K, V> mapEmitter = new SparkMapEmitter<>();
return () -> IteratorUtils.flatMap(partitionIterator, vertexWritable -> {
- workerMapReduce.map(ComputerGraph.mapReduce(vertexWritable._2().get(),java.util.Optional.empty()), mapEmitter); // TODO: not Optional.empty()!
+ workerMapReduce.map(ComputerGraph.mapReduce(vertexWritable._2().get()), mapEmitter);
if (!partitionIterator.hasNext())
workerMapReduce.workerEnd(MapReduce.Stage.MAP);
return mapEmitter.getEmissions();
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/8be247e3/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/process/computer/TinkerGraphComputer.java
----------------------------------------------------------------------
diff --git a/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/process/computer/TinkerGraphComputer.java b/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/process/computer/TinkerGraphComputer.java
index b1e6ab5..737a6a0 100644
--- a/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/process/computer/TinkerGraphComputer.java
+++ b/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/process/computer/TinkerGraphComputer.java
@@ -168,7 +168,7 @@ public class TinkerGraphComputer implements GraphComputer {
while (true) {
final Vertex vertex = vertices.next();
if (null == vertex) return;
- workerMapReduce.map(ComputerGraph.mapReduce(vertex, Optional.ofNullable(this.vertexProgram)), mapEmitter);
+ workerMapReduce.map(ComputerGraph.mapReduce(vertex), mapEmitter);
}
});
workers.mapReduceWorkerEnd(MapReduce.Stage.MAP);