Skip to content

Instantly share code, notes, and snippets.

@imrenagi
Created January 8, 2019 23:29
Show Gist options
  • Save imrenagi/0e0886a18909f7c964eaffd01dc9d667 to your computer and use it in GitHub Desktop.
Save imrenagi/0e0886a18909f7c964eaffd01dc9d667 to your computer and use it in GitHub Desktop.
PCollection<String> names = ...;
PCollection<String> fooCollection = names.apply("FooTrans", ParDo.of(new DoFn<String, String>(){
@ProcessElement
public void processElement(ProcessContext c) {
if(c.element().startsWith("Foo")){
c.output(c.element());
}
}}));
PCollection<String> errCollection = names.apply("BarTrans", ParDo.of(new DoFn<String, String>(){
@ProcessElement
public void processElement(ProcessContext c) {
if(c.element().startsWith("Bar")){
c.output(c.element());
}
}
}));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment