You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by sp...@apache.org on 2015/03/12 11:35:54 UTC

[1/3] incubator-tinkerpop git commit: optimized ScriptInputFormat - only local bindings and no new VertexWritable for each vertex

Repository: incubator-tinkerpop
Updated Branches:
  refs/heads/master 1ac8f4265 -> a228c82dd


optimized ScriptInputFormat - only local bindings and no new VertexWritable for each vertex


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

Branch: refs/heads/master
Commit: d4553edc6270f6db69b109848ed2f3c9cebefb4e
Parents: 9f6fa24
Author: Daniel Kuppitz <da...@hotmail.com>
Authored: Wed Mar 11 21:31:26 2015 +0100
Committer: Daniel Kuppitz <da...@hotmail.com>
Committed: Wed Mar 11 21:31:26 2015 +0100

----------------------------------------------------------------------
 .../hadoop/structure/io/script/ScriptRecordReader.java   | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/d4553edc/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/structure/io/script/ScriptRecordReader.java
----------------------------------------------------------------------
diff --git a/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/structure/io/script/ScriptRecordReader.java b/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/structure/io/script/ScriptRecordReader.java
index a976f0b..8150ff2 100644
--- a/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/structure/io/script/ScriptRecordReader.java
+++ b/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/structure/io/script/ScriptRecordReader.java
@@ -49,9 +49,9 @@ public class ScriptRecordReader extends RecordReader<NullWritable, VertexWritabl
     private final static String LINE = "line";
     private final static String FACTORY = "factory";
     private final static String READ_CALL = "parse(" + LINE + "," + FACTORY + ")";
+    private final VertexWritable vertex = new VertexWritable(null);
     private final LineRecordReader lineRecordReader;
     private ScriptEngine engine;
-    private VertexWritable vertex;
 
     public ScriptRecordReader() {
         this.lineRecordReader = new LineRecordReader();
@@ -75,11 +75,12 @@ public class ScriptRecordReader extends RecordReader<NullWritable, VertexWritabl
         while (true) {
             if (!this.lineRecordReader.nextKeyValue()) return false;
             try {
-                this.engine.put(LINE, this.lineRecordReader.getCurrentValue().toString());
-                this.engine.put(FACTORY, new ScriptElementFactory());
-                final Vertex v = (Vertex) engine.eval(READ_CALL);
+                final javax.script.Bindings bindings = this.engine.createBindings();
+                bindings.put(LINE, this.lineRecordReader.getCurrentValue().toString());
+                bindings.put(FACTORY, new ScriptElementFactory());
+                final Vertex v = (Vertex) engine.eval(READ_CALL, bindings);
                 if (v != null) {
-                    this.vertex = new VertexWritable(v);
+                    this.vertex.set(v);
                     return true;
                 }
             } catch (Exception e) {


[3/3] incubator-tinkerpop git commit: Merge branch 'script-input' of https://github.com/dkuppitz/incubator-tinkerpop

Posted by sp...@apache.org.
Merge branch 'script-input' of https://github.com/dkuppitz/incubator-tinkerpop


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

Branch: refs/heads/master
Commit: a228c82dd45673293292fbd2b08ed544299e77f6
Parents: 1ac8f42 466aa08
Author: Stephen Mallette <sp...@apache.org>
Authored: Thu Mar 12 06:35:36 2015 -0400
Committer: Stephen Mallette <sp...@apache.org>
Committed: Thu Mar 12 06:35:36 2015 -0400

----------------------------------------------------------------------
 .../structure/io/graphson/GraphSONRecordReader.java | 16 ++++++++--------
 .../structure/io/script/ScriptRecordReader.java     | 11 ++++++-----
 2 files changed, 14 insertions(+), 13 deletions(-)
----------------------------------------------------------------------



[2/3] incubator-tinkerpop git commit: optimized GraphSONInputFormat

Posted by sp...@apache.org.
optimized GraphSONInputFormat


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

Branch: refs/heads/master
Commit: 466aa0881adca7108dd1ae5a8512b7b475e61d2b
Parents: d4553ed
Author: Daniel Kuppitz <da...@hotmail.com>
Authored: Wed Mar 11 21:35:43 2015 +0100
Committer: Daniel Kuppitz <da...@hotmail.com>
Committed: Wed Mar 11 21:35:43 2015 +0100

----------------------------------------------------------------------
 .../structure/io/graphson/GraphSONRecordReader.java | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/466aa088/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/structure/io/graphson/GraphSONRecordReader.java
----------------------------------------------------------------------
diff --git a/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/structure/io/graphson/GraphSONRecordReader.java b/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/structure/io/graphson/GraphSONRecordReader.java
index c49e536..95f5b46 100644
--- a/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/structure/io/graphson/GraphSONRecordReader.java
+++ b/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/structure/io/graphson/GraphSONRecordReader.java
@@ -18,6 +18,11 @@
  */
 package org.apache.tinkerpop.gremlin.hadoop.structure.io.graphson;
 
+import org.apache.hadoop.io.NullWritable;
+import org.apache.hadoop.mapreduce.InputSplit;
+import org.apache.hadoop.mapreduce.RecordReader;
+import org.apache.hadoop.mapreduce.TaskAttemptContext;
+import org.apache.hadoop.mapreduce.lib.input.LineRecordReader;
 import org.apache.tinkerpop.gremlin.hadoop.structure.io.VertexWritable;
 import org.apache.tinkerpop.gremlin.structure.Direction;
 import org.apache.tinkerpop.gremlin.structure.Edge;
@@ -27,11 +32,6 @@ import org.apache.tinkerpop.gremlin.structure.util.detached.DetachedEdge;
 import org.apache.tinkerpop.gremlin.structure.util.detached.DetachedVertex;
 import org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerGraph;
 import org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerVertex;
-import org.apache.hadoop.io.NullWritable;
-import org.apache.hadoop.mapreduce.InputSplit;
-import org.apache.hadoop.mapreduce.RecordReader;
-import org.apache.hadoop.mapreduce.TaskAttemptContext;
-import org.apache.hadoop.mapreduce.lib.input.LineRecordReader;
 
 import java.io.ByteArrayInputStream;
 import java.io.IOException;
@@ -43,9 +43,9 @@ import java.util.function.Function;
  */
 public class GraphSONRecordReader extends RecordReader<NullWritable, VertexWritable> {
 
-    private final LineRecordReader lineRecordReader;
     private static final GraphSONReader GRAPHSON_READER = GraphSONReader.build().create();
-    private VertexWritable vertex = null;
+    private final VertexWritable vertex = new VertexWritable(null);
+    private final LineRecordReader lineRecordReader;
 
     public GraphSONRecordReader() {
         this.lineRecordReader = new LineRecordReader();
@@ -69,7 +69,7 @@ public class GraphSONRecordReader extends RecordReader<NullWritable, VertexWrita
             v = (TinkerVertex) GRAPHSON_READER.readVertex(in, Direction.BOTH, vertexMaker, edgeMaker);
         }
 
-        this.vertex = new VertexWritable(v);
+        this.vertex.set(v);
         return true;
     }