beam-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lc...@apache.org
Subject [1/3] incubator-beam git commit: Add Flatten with Duplicate Inputs Test
Date Wed, 14 Sep 2016 23:23:29 GMT
Repository: incubator-beam
Updated Branches:
  refs/heads/master 3f882b773 -> ae6333a41


Add Flatten with Duplicate Inputs Test

This test demonstrates that if a Flatten.PCollections transform has the
same PCollectionList in its input multiple times, it will duplicate the
input PCollection for each time it occurs within the list.


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

Branch: refs/heads/master
Commit: 321ffc2ed8c48a6f4bc487d44eecf1355ca3798c
Parents: 3f882b7
Author: Thomas Groh <tgroh@google.com>
Authored: Wed Sep 14 15:58:58 2016 -0700
Committer: Luke Cwik <lcwik@google.com>
Committed: Wed Sep 14 16:06:27 2016 -0700

----------------------------------------------------------------------
 .../apache/beam/sdk/transforms/FlattenTest.java | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-beam/blob/321ffc2e/sdks/java/core/src/test/java/org/apache/beam/sdk/transforms/FlattenTest.java
----------------------------------------------------------------------
diff --git a/sdks/java/core/src/test/java/org/apache/beam/sdk/transforms/FlattenTest.java
b/sdks/java/core/src/test/java/org/apache/beam/sdk/transforms/FlattenTest.java
index d755e28..c188546 100644
--- a/sdks/java/core/src/test/java/org/apache/beam/sdk/transforms/FlattenTest.java
+++ b/sdks/java/core/src/test/java/org/apache/beam/sdk/transforms/FlattenTest.java
@@ -24,6 +24,7 @@ import static org.apache.beam.sdk.TestUtils.NO_LINES;
 import static org.apache.beam.sdk.TestUtils.NO_LINES_ARRAY;
 
 import com.google.common.collect.ImmutableSet;
+import com.google.common.collect.Iterables;
 import java.io.Serializable;
 import java.util.ArrayList;
 import java.util.Arrays;
@@ -114,6 +115,25 @@ public class FlattenTest implements Serializable {
     PAssert.that(output).empty();
     p.run();
   }
+  @Test
+  @Category(RunnableOnService.class)
+  public void testFlattenInputMultipleCopies() {
+    Pipeline p = TestPipeline.create();
+
+    PCollection<String> lines = p.apply("mkLines", Create.of(LINES));
+    PCollection<String> lines2 = p.apply("mkOtherLines", Create.of(LINES2));
+
+    PCollection<String> flattened = PCollectionList.of(lines)
+        .and(lines2)
+        .and(lines)
+        .and(lines)
+        .apply(Flatten.<String>pCollections());
+
+    PAssert.that(flattened).containsInAnyOrder(Iterables.concat(LINES, LINES, LINES, LINES2));
+
+    p.run();
+  }
+
 
   @Test
   @Category(RunnableOnService.class)


Mime
View raw message