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/11 17:59:40 UTC
tinkerpop git commit: HashPartitioner requires a positive hashCode()
value. Thus, wrapped calls in Math.abs().
Repository: tinkerpop
Updated Branches:
refs/heads/TINKERPOP-1564 b6c4b7510 -> 92d73d073
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/92d73d07
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/92d73d07
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/92d73d07
Branch: refs/heads/TINKERPOP-1564
Commit: 92d73d073f7ceda480422760a48793c6bb98667c
Parents: b6c4b75
Author: Marko A. Rodriguez <ok...@gmail.com>
Authored: Wed Jan 11 10:59:34 2017 -0700
Committer: Marko A. Rodriguez <ok...@gmail.com>
Committed: Wed Jan 11 10:59:34 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/92d73d07/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/92d73d07/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