Created
January 8, 2019 23:25
-
-
Save imrenagi/602e48f3eeada26e32f18ab4166fe55a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| final TupleTag<String> dataTag = new TupleTag<String>() {}; | |
| final TupleTag<String> errorTag = new TupleTag<String>() {}; | |
| PCollectionTuple mixedCollection = | |
| names.apply(ParDo | |
| .of(new DoFn<String, String>() { | |
| @ProcessElement | |
| public void processElement(ProcessContext c) { | |
| if (c.element().startsWith("Foo")) { | |
| c.output(c.element()); | |
| } else if (c.element().startsWith("Bar")) { | |
| c.output(errorTag, c.element()); | |
| } | |
| } | |
| }).withOutputTags(dataTag, TupleTagList.of(errorTag))); | |
| mixedCollection.get(dataTag).apply(...); | |
| mixedCollection.get(errorTag).apply(...); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment