Enum TimestampCombiner
- java.lang.Object
-
- java.lang.Enum<TimestampCombiner>
-
- org.apache.beam.sdk.transforms.windowing.TimestampCombiner
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Comparable<TimestampCombiner>
@Experimental(OUTPUT_TIME) public enum TimestampCombiner extends java.lang.Enum<TimestampCombiner>
Policies for combining timestamps that occur within a window.In particular, these govern the timestamp on the output of a grouping transform such as
GroupByKey
orCombine
.
-
-
Enum Constant Summary
Enum Constants Enum Constant Description EARLIEST
The policy of taking at the earliest of a set of timestamps.END_OF_WINDOW
The policy of using the end of the window, regardless of input timestamps.LATEST
The policy of taking the latest of a set of timestamps.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description org.joda.time.Instant
assign(BoundedWindow intoWindow, org.joda.time.Instant timestamp)
Shorthand formerge(org.apache.beam.sdk.transforms.windowing.BoundedWindow, java.lang.Iterable<? extends org.joda.time.Instant>)
with just one element, to place it into the context of a window.abstract org.joda.time.Instant
combine(java.lang.Iterable<? extends org.joda.time.Instant> timestamps)
Combines the given times, which must be from the same window and must have been passed throughmerge(org.apache.beam.sdk.transforms.windowing.BoundedWindow, java.lang.Iterable<? extends org.joda.time.Instant>)
.org.joda.time.Instant
combine(org.joda.time.Instant... timestamps)
Varargs variant ofcombine(java.lang.Iterable<? extends org.joda.time.Instant>)
.abstract boolean
dependsOnlyOnEarliestTimestamp()
Returnstrue
if the result of combination of many output timestamps actually depends only on the earliest.abstract boolean
dependsOnlyOnWindow()
Returnstrue
if the result does not depend on what outputs were combined but only the window they are in.abstract org.joda.time.Instant
merge(BoundedWindow intoWindow, java.lang.Iterable<? extends org.joda.time.Instant> mergingTimestamps)
Merges the given timestamps, which may have originated in separate windows, into the context of the result window.org.joda.time.Instant
merge(BoundedWindow intoWindow, org.joda.time.Instant... timestamps)
static TimestampCombiner
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.static TimestampCombiner[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
EARLIEST
public static final TimestampCombiner EARLIEST
The policy of taking at the earliest of a set of timestamps.When used in windowed aggregations, the timestamps of non-late inputs will be combined after they are shifted by the
WindowFn
(to allow downstream watermark progress).If data arrives late, it has no effect on the output timestamp.
-
LATEST
public static final TimestampCombiner LATEST
The policy of taking the latest of a set of timestamps.When used in windowed aggregations, the timestamps of non-late inputs will be combined after they are shifted by the
WindowFn
(to allow downstream watermark progress).If data arrives late, it has no effect on the output timestamp.
-
END_OF_WINDOW
public static final TimestampCombiner END_OF_WINDOW
The policy of using the end of the window, regardless of input timestamps.When used in windowed aggregations, the timestamps of non-late inputs will be combined after they are shifted by the
WindowFn
(to allow downstream watermark progress).If data arrives late, it has no effect on the output timestamp.
-
-
Method Detail
-
values
public static TimestampCombiner[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (TimestampCombiner c : TimestampCombiner.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static TimestampCombiner valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is null
-
combine
public abstract org.joda.time.Instant combine(java.lang.Iterable<? extends org.joda.time.Instant> timestamps)
Combines the given times, which must be from the same window and must have been passed throughmerge(org.apache.beam.sdk.transforms.windowing.BoundedWindow, java.lang.Iterable<? extends org.joda.time.Instant>)
.combine
must be commutative:combine(a, b).equals(combine(b, a))
.combine
must be associative:combine(a, combine(b, c)).equals(combine(combine(a, b), c))
.
-
merge
public abstract org.joda.time.Instant merge(BoundedWindow intoWindow, java.lang.Iterable<? extends org.joda.time.Instant> mergingTimestamps)
Merges the given timestamps, which may have originated in separate windows, into the context of the result window.
-
assign
public final org.joda.time.Instant assign(BoundedWindow intoWindow, org.joda.time.Instant timestamp)
Shorthand formerge(org.apache.beam.sdk.transforms.windowing.BoundedWindow, java.lang.Iterable<? extends org.joda.time.Instant>)
with just one element, to place it into the context of a window.For example, the
END_OF_WINDOW
policy moves the timestamp to the end of the window.
-
combine
public final org.joda.time.Instant combine(org.joda.time.Instant... timestamps)
Varargs variant ofcombine(java.lang.Iterable<? extends org.joda.time.Instant>)
.
-
merge
public final org.joda.time.Instant merge(BoundedWindow intoWindow, org.joda.time.Instant... timestamps)
-
dependsOnlyOnEarliestTimestamp
public abstract boolean dependsOnlyOnEarliestTimestamp()
Returnstrue
if the result of combination of many output timestamps actually depends only on the earliest.This may allow optimizations when it is very efficient to retrieve the earliest timestamp to be combined.
-
dependsOnlyOnWindow
public abstract boolean dependsOnlyOnWindow()
Returnstrue
if the result does not depend on what outputs were combined but only the window they are in. The canonical example is if all timestamps are sure to be the end of the window.This may allow optimizations, since it is typically very efficient to retrieve the window and combining output timestamps is not necessary.
-
-