beam-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lc...@apache.org
Subject [4/6] incubator-beam git commit: Only duplicate valid values
Date Mon, 25 Apr 2016 23:16:30 GMT
Only duplicate valid values


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

Branch: refs/heads/master
Commit: a8f9e99fd9f931958b323bf84b1358d4f3d1ca69
Parents: a441a26
Author: Mark Shields <markshields@google.com>
Authored: Mon Apr 25 14:17:42 2016 -0700
Committer: Mark Shields <markshields@google.com>
Committed: Mon Apr 25 14:17:42 2016 -0700

----------------------------------------------------------------------
 .../beam/sdk/runners/dataflow/TestCountingSource.java     | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-beam/blob/a8f9e99f/sdks/java/core/src/test/java/org/apache/beam/sdk/runners/dataflow/TestCountingSource.java
----------------------------------------------------------------------
diff --git a/sdks/java/core/src/test/java/org/apache/beam/sdk/runners/dataflow/TestCountingSource.java
b/sdks/java/core/src/test/java/org/apache/beam/sdk/runners/dataflow/TestCountingSource.java
index cc7b6e8..226b3cb 100644
--- a/sdks/java/core/src/test/java/org/apache/beam/sdk/runners/dataflow/TestCountingSource.java
+++ b/sdks/java/core/src/test/java/org/apache/beam/sdk/runners/dataflow/TestCountingSource.java
@@ -176,11 +176,11 @@ public class TestCountingSource
       if (current >= numMessagesPerShard) {
         return false;
       }
-        // If testing dedup, occasionally insert a duplicate value;
-        if (dedup && ThreadLocalRandom.current().nextInt(5) == 0) {
-          return true;
-        }
-        current++;
+      // If testing dedup, occasionally insert a duplicate value;
+      if (current >= 0 && dedup && ThreadLocalRandom.current().nextInt(5)
== 0) {
+        return true;
+      }
+      current++;
       return current < numMessagesPerShard;
     }
 


Mime
View raw message