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/04/27 23:03:44 UTC
incubator-tinkerpop git commit: small tweaks to GraphSONRecordReader
and GryoRecordReader. Cleanups mainly.
Repository: incubator-tinkerpop
Updated Branches:
refs/heads/master bef41c74b -> d3724e173
small tweaks to GraphSONRecordReader and GryoRecordReader. Cleanups mainly.
Project: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/commit/d3724e17
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/tree/d3724e17
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/diff/d3724e17
Branch: refs/heads/master
Commit: d3724e1738c0c4848220fcbf6321d483e6c370e5
Parents: bef41c7
Author: Marko A. Rodriguez <ok...@gmail.com>
Authored: Mon Apr 27 15:03:39 2015 -0600
Committer: Marko A. Rodriguez <ok...@gmail.com>
Committed: Mon Apr 27 15:03:39 2015 -0600
----------------------------------------------------------------------
.../structure/io/graphson/GraphSONRecordReader.java | 4 ++--
.../hadoop/structure/io/gryo/GryoRecordReader.java | 15 ++++-----------
2 files changed, 6 insertions(+), 13 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/d3724e17/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 69fca07..497b42f 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
@@ -65,8 +65,8 @@ public class GraphSONRecordReader extends RecordReader<NullWritable, VertexWrita
return false;
final StarGraph starGraph = StarGraph.open();
- final Function<Attachable<Vertex>, Vertex> vertexMaker = detachedVertex -> detachedVertex.attach(Attachable.Method.create(starGraph));
- final Function<Attachable<Edge>, Edge> edgeMaker = detachedEdge -> detachedEdge.attach(Attachable.Method.create(starGraph));
+ final Function<Attachable<Vertex>, Vertex> vertexMaker = attachableVertex -> attachableVertex.attach(Attachable.Method.create(starGraph));
+ final Function<Attachable<Edge>, Edge> edgeMaker = attachableEdge -> attachableEdge.attach(Attachable.Method.create(starGraph));
try (InputStream in = new ByteArrayInputStream(this.lineRecordReader.getCurrentValue().getBytes())) {
this.vertexWritable.set(this.hasEdges ?
this.graphsonReader.readVertex(in, vertexMaker, edgeMaker, Direction.BOTH) :
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/d3724e17/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/structure/io/gryo/GryoRecordReader.java
----------------------------------------------------------------------
diff --git a/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/structure/io/gryo/GryoRecordReader.java b/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/structure/io/gryo/GryoRecordReader.java
index b93c431..53b4162 100644
--- a/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/structure/io/gryo/GryoRecordReader.java
+++ b/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/structure/io/gryo/GryoRecordReader.java
@@ -125,15 +125,11 @@ public class GryoRecordReader extends RecordReader<NullWritable, VertexWritable>
currentVertexLength++;
output.write(currentByte);
- if (((byte) currentByte) == TERMINATOR[terminatorLocation])
- terminatorLocation++;
- else
- terminatorLocation = 0;
-
+ terminatorLocation = ((byte) currentByte) == TERMINATOR[terminatorLocation] ? terminatorLocation + 1 : 0;
if (terminatorLocation >= TERMINATOR.length) {
final StarGraph starGraph = StarGraph.open();
- final Function<Attachable<Vertex>, Vertex> vertexMaker = detachedVertex -> detachedVertex.attach(Attachable.Method.create(starGraph));
- final Function<Attachable<Edge>, Edge> edgeMaker = detachedEdge -> detachedEdge.attach(Attachable.Method.create(starGraph));
+ final Function<Attachable<Vertex>, Vertex> vertexMaker = attachableVertex -> attachableVertex.attach(Attachable.Method.create(starGraph));
+ final Function<Attachable<Edge>, Edge> edgeMaker = attachableEdge -> attachableEdge.attach(Attachable.Method.create(starGraph));
try (InputStream in = new ByteArrayInputStream(output.toByteArray())) {
this.vertexWritable.set(this.hasEdges ?
this.gryoReader.readVertex(in, vertexMaker, edgeMaker, Direction.BOTH) :
@@ -156,10 +152,7 @@ public class GryoRecordReader extends RecordReader<NullWritable, VertexWritable>
@Override
public float getProgress() throws IOException {
- if (0 == this.currentLength || 0 == this.splitLength)
- return 0.0f;
- else
- return (float) this.currentLength / (float) this.splitLength;
+ return (0 == this.currentLength || 0 == this.splitLength) ? 0.0f : (float) this.currentLength / (float) this.splitLength;
}
@Override