Enum Class TimestampCombiner
- All Implemented Interfaces:
Serializable
,Comparable<TimestampCombiner>
,Constable
In particular, these govern the timestamp on the output of a grouping transform such as GroupByKey
or Combine
.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionThe policy of taking at the earliest of a set of timestamps.The policy of using the end of the window, regardless of input timestamps.The policy of taking the latest of a set of timestamps. -
Method Summary
Modifier and TypeMethodDescriptionfinal Instant
assign
(BoundedWindow intoWindow, 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 Instant
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>)
.final Instant
Varargs variant ofcombine(java.lang.Iterable<? extends org.joda.time.Instant>)
.abstract boolean
Returnstrue
if the result of combination of many output timestamps actually depends only on the earliest.abstract boolean
Returnstrue
if the result does not depend on what outputs were combined but only the window they are in.abstract Instant
merge
(BoundedWindow intoWindow, Iterable<? extends Instant> mergingTimestamps) Merges the given timestamps, which may have originated in separate windows, into the context of the result window.final Instant
merge
(BoundedWindow intoWindow, Instant... timestamps) static TimestampCombiner
Returns the enum constant of this class with the specified name.static TimestampCombiner[]
values()
Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
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
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
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 Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (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:
IllegalArgumentException
- if this enum class has no constant with the specified nameNullPointerException
- if the argument is null
-
combine
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 Instant merge(BoundedWindow intoWindow, Iterable<? extends Instant> mergingTimestamps) Merges the given timestamps, which may have originated in separate windows, into the context of the result window. -
assign
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
Varargs variant ofcombine(java.lang.Iterable<? extends org.joda.time.Instant>)
. -
merge
-
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.
-