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 2017/01/19 17:40:29 UTC
[23/50] [abbrv] tinkerpop git commit: HashPartitioner requires a
positive hashCode() value. Thus, wrapped calls in Math.abs().
HashPartitioner requires a positive hashCode() value. Thus, wrapped calls in Math.abs().
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/63f5c0f2
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/63f5c0f2
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/63f5c0f2
Branch: refs/heads/TINKERPOP-1564
Commit: 63f5c0f207d9a66b6e74780bf761c9e67c1c9a27
Parents: 483a0a0
Author: Marko A. Rodriguez <ok...@gmail.com>
Authored: Wed Jan 11 10:59:34 2017 -0700
Committer: Marko A. Rodriguez <ok...@gmail.com>
Committed: Thu Jan 19 10:27:16 2017 -0700
----------------------------------------------------------------------
.../gremlin/akka/process/actors/AkkaGroovyPlayTest.groovy | 8 ++------
.../gremlin/structure/util/partitioner/HashPartitioner.java | 6 +++---
2 files changed, 5 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/63f5c0f2/akka-gremlin/src/test/groovy/org/apache/tinkerpop/gremlin/akka/process/actors/AkkaGroovyPlayTest.groovy
----------------------------------------------------------------------
diff --git a/akka-gremlin/src/test/groovy/org/apache/tinkerpop/gremlin/akka/process/actors/AkkaGroovyPlayTest.groovy b/akka-gremlin/src/test/groovy/org/apache/tinkerpop/gremlin/akka/process/actors/AkkaGroovyPlayTest.groovy
index 2102abb..b4730c4 100644
--- a/akka-gremlin/src/test/groovy/org/apache/tinkerpop/gremlin/akka/process/actors/AkkaGroovyPlayTest.groovy
+++ b/akka-gremlin/src/test/groovy/org/apache/tinkerpop/gremlin/akka/process/actors/AkkaGroovyPlayTest.groovy
@@ -21,6 +21,7 @@ package org.apache.tinkerpop.gremlin.akka.process.actors
import org.apache.tinkerpop.gremlin.process.computer.Computer
import org.apache.tinkerpop.gremlin.structure.T
+import org.apache.tinkerpop.gremlin.structure.io.IoCore
import org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerGraph
import org.apache.tinkerpop.gremlin.util.TimeUtil
import org.junit.Ignore
@@ -36,14 +37,9 @@ class AkkaGroovyPlayTest {
public void testStuff() {
def graph = TinkerGraph.open()
+ graph.io(IoCore.gryo()).readGraph("/Users/marko/Desktop/test.kryo")
def g = graph.traversal()
def a = graph.traversal().withProcessor(AkkaGraphActors.open().workers(8));
- def r = new Random(123)
-
- (1..1000000).each {
- def vid = ["a", "b", "c", "d"].collectEntries { [it, r.nextInt() % 400000] }
- graph.addVertex(T.id, vid)
- }; []
println TimeUtil.clockWithResult(1) { g.V().id().select("c").count().next() }
println TimeUtil.clockWithResult(1) { g.V().id().select("c").dedup().count().next() }
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/63f5c0f2/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/partitioner/HashPartitioner.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/partitioner/HashPartitioner.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/partitioner/HashPartitioner.java
index 3e937d2..407ac72 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/partitioner/HashPartitioner.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/partitioner/HashPartitioner.java
@@ -82,17 +82,17 @@ public final class HashPartitioner implements Partitioner {
@Override
public boolean contains(final Element element) {
- return (this.splitId == element.hashCode() % this.totalSplits) && this.basePartition.contains(element);
+ return (this.splitId == Math.abs(element.hashCode()) % this.totalSplits) && this.basePartition.contains(element);
}
@Override
public Iterator<Vertex> vertices(final Object... ids) {
- return IteratorUtils.filter(this.basePartition.vertices(ids), vertex -> this.splitId == vertex.hashCode() % this.totalSplits);
+ return IteratorUtils.filter(this.basePartition.vertices(ids), vertex -> this.splitId == Math.abs(vertex.hashCode()) % this.totalSplits);
}
@Override
public Iterator<Edge> edges(final Object... ids) {
- return IteratorUtils.filter(this.basePartition.edges(ids), edge -> this.splitId == edge.hashCode() % this.totalSplits);
+ return IteratorUtils.filter(this.basePartition.edges(ids), edge -> this.splitId == Math.abs(edge.hashCode()) % this.totalSplits);
}
@Override