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/06/08 23:13:17 UTC
incubator-tinkerpop git commit: fixed a itemization,
list bug in the-traversal.
Repository: incubator-tinkerpop
Updated Branches:
refs/heads/master ce6b2e612 -> 22fdecd1e
fixed a itemization, list bug in the-traversal.
Project: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/commit/22fdecd1
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/tree/22fdecd1
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/diff/22fdecd1
Branch: refs/heads/master
Commit: 22fdecd1ed3936b23b5b048ecf7f2d5f4aaf52b1
Parents: ce6b2e6
Author: Marko A. Rodriguez <ok...@gmail.com>
Authored: Mon Jun 8 15:13:13 2015 -0600
Committer: Marko A. Rodriguez <ok...@gmail.com>
Committed: Mon Jun 8 15:13:13 2015 -0600
----------------------------------------------------------------------
docs/src/the-traversal.asciidoc | 7 ++++---
.../gremlin/process/traversal/step/filter/CoinStep.java | 10 +++++++---
2 files changed, 11 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/22fdecd1/docs/src/the-traversal.asciidoc
----------------------------------------------------------------------
diff --git a/docs/src/the-traversal.asciidoc b/docs/src/the-traversal.asciidoc
index 902f55a..52aabb3 100644
--- a/docs/src/the-traversal.asciidoc
+++ b/docs/src/the-traversal.asciidoc
@@ -252,9 +252,10 @@ g.V().hasLabel('software').as('a','b','c').
Barrier Step
~~~~~~~~~~~~
-The `barrier()`-step turns the the lazy traversal pipeline into a bulk-synchronous pipeline (*barrier*). This step is useful in the following situations:
- . When everything prior to `barrier()` needs to be executed before moving onto the steps after the `barrier()` (i.e. ordering).
- . When "stalling" the traversal may lead to a "bulking optimization" in traversals that repeatedly touch many of the same elements (i.e. optimizing).
+The `barrier()`-step (*barrier*) turns the the lazy traversal pipeline into a bulk-synchronous pipeline. This step is useful in the following situations:
+
+ * When everything prior to `barrier()` needs to be executed before moving onto the steps after the `barrier()` (i.e. ordering).
+ * When "stalling" the traversal may lead to a "bulking optimization" in traversals that repeatedly touch many of the same elements (i.e. optimizing).
[gremlin-groovy,modern]
----
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/22fdecd1/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/filter/CoinStep.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/filter/CoinStep.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/filter/CoinStep.java
index fded56b..e5772b8 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/filter/CoinStep.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/filter/CoinStep.java
@@ -43,9 +43,13 @@ public final class CoinStep<S> extends FilterStep<S> {
@Override
protected boolean filter(final Traverser.Admin<S> traverser) {
long newBulk = 0l;
- for (int i = 0; i < traverser.bulk(); i++) {
- if (this.probability >= RANDOM.nextDouble())
- newBulk++;
+ if (traverser.bulk() < 10) {
+ for (int i = 0; i < traverser.bulk(); i++) {
+ if (this.probability >= RANDOM.nextDouble())
+ newBulk++;
+ }
+ } else {
+ newBulk = Double.valueOf(RANDOM.nextBoolean() ? Math.floor(this.probability * traverser.bulk()) : Math.ceil(this.probability * traverser.bulk())).longValue();
}
if (0 == newBulk) return false;
traverser.setBulk(newBulk);