lukecwik commented on a change in pull request #12016:
URL: https://github.com/apache/beam/pull/12016#discussion_r448088312
##########
File path: sdks/java/core/src/main/java/org/apache/beam/sdk/transforms/DoFn.java
##########
@@ -1053,6 +1056,51 @@ public Duration getAllowedTimestampSkew() {
@Experimental(Kind.SPLITTABLE_DO_FN)
public @interface SplitRestriction {}
+ /**
+ * Annotation for the method that truncates the restriction of a <a
+ * href="https://s.apache.org/splittable-do-fn">splittable</a> {@link DoFn}
into a bounded one to
+ * be processed when pipeline starts to drain.
+ *
+ * <p>This method is used to perform truncation of the restriction while it
is not actively being
+ * processed.
+ *
+ * <p>Signature: {@code void truncateRestriction(<arguments>);}
+ *
+ * <p>This method must satisfy the following constraints:
+ *
+ * <ul>
+ * <li>If one of the arguments is of type {@link OutputReceiver}, then it
will be passed an
+ * output receiver for outputting the truncated restrictions. All
truncated restrictions
+ * must be output through this parameter.
+ * <li>If one of its arguments is tagged with the {@link Element}
annotation, then it will be
+ * passed the current element being processed; the argument must be of
type {@code InputT}.
+ * Note that automatic conversion of {@link Row}s and {@link
FieldAccess} parameters are
+ * currently unsupported.
+ * <li>If one of its arguments is tagged with the {@link Restriction}
annotation, then it will
+ * be passed the current restriction being processed; the argument
must be of type {@code
+ * RestrictionT}.
+ * <li>If one of its arguments is tagged with the {@link Timestamp}
annotation, then it will be
+ * passed the timestamp of the current element being processed; the
argument must be of type
+ * {@link Instant}.
+ * <li>If one of its arguments is a {@link RestrictionTracker}, then it
will be passed a tracker
+ * that is initialized for the current {@link Restriction}. The
argument must be of the
+ * exact type {@code RestrictionTracker<RestrictionT, PositionT>}.
+ * <li>If one of its arguments is a subtype of {@link BoundedWindow}, then
it will be passed the
+ * window of the current element. When applied by {@link ParDo} the
subtype of {@link
+ * BoundedWindow} must match the type of windows on the input {@link
PCollection}. If the
+ * window is not accessed a runner may perform additional
optimizations.
+ * <li>If one of its arguments is of type {@link PaneInfo}, then it will
be passed information
+ * about the current triggering pane.
+ * <li>If one of the parameters is of type {@link PipelineOptions}, then
it will be passed the
+ * options for the current pipeline.
+ * </ul>
Review comment:
```suggestion
* </ul>
*
* <p>The default behavior when a pipeline is being drained is that {@link
IS_BOUNDED} restrictions process entirely while {@link IS_UNBOUNDED}
restrictions process till a checkpoint is possible. Splittable {@link DoFn}s
should only provide this method if they want to change this default behavior.
```
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]