Java Code Examples for org.apache.beam.sdk.annotations.Experimental.Kind#OUTPUT_TIME
The following examples show how to use
org.apache.beam.sdk.annotations.Experimental.Kind#OUTPUT_TIME .
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: WindowingStrategy.java From beam with Apache License 2.0 | 6 votes |
@Experimental(Kind.OUTPUT_TIME) public WindowingStrategy<T, W> withTimestampCombiner(TimestampCombiner timestampCombiner) { return new WindowingStrategy<>( windowFn, trigger, triggerSpecified, mode, modeSpecified, allowedLateness, allowedLatenessSpecified, timestampCombiner, true, closingBehavior, onTimeBehavior); }
Example 2
Source File: SlidingWindows.java From beam with Apache License 2.0 | 5 votes |
/** * Ensures that later sliding windows have an output time that is past the end of earlier windows. * * <p>If this is the earliest sliding window containing {@code inputTimestamp}, that's fine. * Otherwise, we pick the earliest time that doesn't overlap with earlier windows. */ @Experimental(Kind.OUTPUT_TIME) @Override public Instant getOutputTime(Instant inputTimestamp, IntervalWindow window) { Instant startOfLastSegment = window.maxTimestamp().minus(period); return startOfLastSegment.isBefore(inputTimestamp) ? inputTimestamp : startOfLastSegment.plus(1); }
Example 3
Source File: Window.java From beam with Apache License 2.0 | 4 votes |
/** * <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(); }
Example 4
Source File: WindowFn.java From beam with Apache License 2.0 | 2 votes |
/** * Returns the output timestamp to use for data depending on the given {@code inputTimestamp} in * the specified {@code window}. * * <p>The result of this method must be between {@code inputTimestamp} and {@code * window.maxTimestamp()} (inclusive on both sides). * * <p>This function must be monotonic across input timestamps. Specifically, if {@code A < B}, * then {@code getOutputTime(A, window) <= getOutputTime(B, window)}. * * <p>For a {@link WindowFn} that doesn't produce overlapping windows, this can (and typically * should) just return {@code inputTimestamp}. In the presence of overlapping windows, it is * suggested that the result in later overlapping windows is past the end of earlier windows so * that the later windows don't prevent the watermark from progressing past the end of the earlier * window. */ @Experimental(Kind.OUTPUT_TIME) public Instant getOutputTime(Instant inputTimestamp, W window) { return inputTimestamp; }