@Documented @Retention(value=RUNTIME) @Target(value=METHOD) public static @interface DoFn.ProcessElement
DoFnmust have a method with this annotation.
The signature of this method must satisfy the following constraints:
RestrictionTracker, then it is a splittable
DoFnsubject to the separate requirements described below. Items below are assuming this is not a splittable
BoundedWindowthen it will be passed the window of the current element. When applied by
ParDothe subtype of
BoundedWindowmust match the type of windows on the input
PCollection. If the window is not accessed a runner may perform additional optimizations.
DoFn is splittable if its
DoFn.ProcessElement method has a parameter
whose type is a subtype of
RestrictionTracker. This is an advanced feature and an
overwhelming majority of users will never need to write a splittable
Not all runners support Splittable DoFn. See the capability matrix.
See the proposal for an overview of the involved concepts (splittable DoFn, restriction, restriction tracker).
DoFn is splittable, the following constraints must be respected:
DoFn.NewTrackermethod returning the same type as the type of the
DoFn.ProcessElement, which in turn must be a subtype of
Ris the restriction type returned by
DoFn.GetInitialRestriction. This method is optional in case the restriction type returned by
DoFn.ProcessElementmethod may return a
DoFn.ProcessContinuationto indicate whether there is more work to be done for the current element.
DoFn.ProcessElementmethod must not use any extra context parameters, such as
DoFnitself may be annotated with
DoFn.UnboundedPerElement, but not both at the same time. If it's not annotated with either of these, it's assumed to be
DoFn.UnboundedPerElementif it returns a
DoFn must not define any of these methods.