private Window<T> withWindowFn(WindowFn<? super T, ?> windowFn) { return toBuilder().setWindowFn(windowFn).build(); }
/** * <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(); }
/** * 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(); }
/** * 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(); }
/** * <b><i>(Experimental)</i></b> Override the default {@link TimestampCombiner}, to control the * output timestamp of values output from a {@link GroupByKey} operation. */ @Experimental(Kind.OUTPUT_TIME) public Window<T> withTimestampCombiner(TimestampCombiner timestampCombiner) { return toBuilder().setTimestampCombiner(timestampCombiner).build(); }
/** * 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(); }
/** * 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(); }
/** * 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(); }