Reputation: 18884
While reading about processing streaming elements in apache beam using Java, I came across DoFn<InputT, OutputT>
and then across SimpleFunction<InputT, OutputT>
.
Both of these look similar to me and I find it difficult to understand the difference.
Can someone explain the difference in layman terms?
Upvotes: 12
Views: 9411
Reputation: 2539
Conceptually you can think of SimpleFunction
is a simple case of DoFn
:
SimpleFunction<InputT, OutputT>
:
@Override
the apply()
method;MapElements.via(simpleFunction)
to convert/modify elements one by one, producing one output for each element;DoFn<InputT, OutputT>
:
ParDo
;You can find more specific examples and use cases for ParDos
in the dev guide.
This part mentions the MapElements
, which is the use case for SimpleFunctions
Upvotes: 15