Is there a way to create a DoFN with a lambda function? The DoFN class
itself should support it, but the overloading of the ParDo.of causes
ambiguity for a lambda function. Is there a different way to accomplish
this?
To answer the why would you want this:
static class EnrichWithTimestampFN extends DoFn<KV<String, Long>,
KV<String, KV<Instant, Long>>> {
@Override
public void processElement(DoFn<KV<String, Long>, KV<String,
KV<Instant, Long>>>.ProcessContext context) throws Exception {
context.output(KV.of(context.element().getKey(),
KV.of(context.timestamp(), context.element().getValue())));
}
}
This is a DoFN that I wrote to enrich a PCollection with a the time
(Instant). I need the access to the ProcessContext to get the timestamp.
This would be much easier expressed with a lambda.
Thanks,
Jesse