Java Code Examples for org.apache.beam.sdk.annotations.Experimental.Kind#TRIGGER

The following examples show how to use org.apache.beam.sdk.annotations.Experimental.Kind#TRIGGER . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Window.java    From beam with Apache License 2.0 4 votes vote down vote up
/**
 * <b><i>(Experimental)</i></b> Override the default {@link OnTimeBehavior}, to control whether to
 * output an empty on-time pane.
 */
@Experimental(Kind.TRIGGER)
public Window<T> withOnTimeBehavior(OnTimeBehavior behavior) {
  return toBuilder().setOnTimeBehavior(behavior).build();
}
 
Example 2
Source File: Window.java    From beam with Apache License 2.0 2 votes vote down vote up
/**
 * Sets a non-default trigger for this {@code Window} {@code PTransform}. Elements that are
 * assigned to a specific window will be output when the trigger fires.
 *
 * <p>{@link org.apache.beam.sdk.transforms.windowing.Trigger} has more details on the available
 * triggers.
 *
 * <p>Must also specify allowed lateness using {@link #withAllowedLateness} and accumulation mode
 * using either {@link #discardingFiredPanes()} or {@link #accumulatingFiredPanes()}.
 */
@Experimental(Kind.TRIGGER)
public Window<T> triggering(Trigger trigger) {
  return toBuilder().setTrigger(trigger).build();
}
 
Example 3
Source File: Window.java    From beam with Apache License 2.0 2 votes vote down vote up
/**
 * Returns a new {@code Window} {@code PTransform} that uses the registered WindowFn and
 * Triggering behavior, and that discards elements in a pane after they are triggered.
 *
 * <p>Does not modify this transform. The resulting {@code PTransform} is sufficiently specified
 * to be applied, but more properties can still be specified.
 */
@Experimental(Kind.TRIGGER)
public Window<T> discardingFiredPanes() {
  return toBuilder().setAccumulationMode(AccumulationMode.DISCARDING_FIRED_PANES).build();
}
 
Example 4
Source File: Window.java    From beam with Apache License 2.0 2 votes vote down vote up
/**
 * Returns a new {@code Window} {@code PTransform} that uses the registered WindowFn and
 * Triggering behavior, and that accumulates elements in a pane after they are triggered.
 *
 * <p>Does not modify this transform. The resulting {@code PTransform} is sufficiently specified
 * to be applied, but more properties can still be specified.
 */
@Experimental(Kind.TRIGGER)
public Window<T> accumulatingFiredPanes() {
  return toBuilder().setAccumulationMode(AccumulationMode.ACCUMULATING_FIRED_PANES).build();
}
 
Example 5
Source File: Window.java    From beam with Apache License 2.0 2 votes vote down vote up
/**
 * Override the amount of lateness allowed for data elements in the output {@link PCollection} and
 * downstream {@link PCollection PCollections} until explicitly set again. Like the other
 * properties on this {@link Window} operation, this will be applied at the next {@link
 * GroupByKey}. Any elements that are later than this as decided by the system-maintained
 * watermark will be dropped.
 *
 * <p>This value also determines how long state will be kept around for old windows. Once no
 * elements will be added to a window (because this duration has passed) any state associated with
 * the window will be cleaned up.
 *
 * <p>Depending on the trigger this may not produce a pane with {@link PaneInfo#isLast}. See
 * {@link ClosingBehavior#FIRE_IF_NON_EMPTY} for more details.
 */
@Experimental(Kind.TRIGGER)
public Window<T> withAllowedLateness(Duration allowedLateness) {
  return toBuilder().setAllowedLateness(allowedLateness).build();
}
 
Example 6
Source File: Window.java    From beam with Apache License 2.0 2 votes vote down vote up
/**
 * Override the amount of lateness allowed for data elements in the pipeline. Like the other
 * properties on this {@link Window} operation, this will be applied at the next {@link
 * GroupByKey}. Any elements that are later than this as decided by the system-maintained
 * watermark will be dropped.
 *
 * <p>This value also determines how long state will be kept around for old windows. Once no
 * elements will be added to a window (because this duration has passed) any state associated with
 * the window will be cleaned up.
 */
@Experimental(Kind.TRIGGER)
public Window<T> withAllowedLateness(Duration allowedLateness, ClosingBehavior behavior) {
  return toBuilder().setAllowedLateness(allowedLateness).setClosingBehavior(behavior).build();
}