Class BoundedWindow
- java.lang.Object
-
- org.apache.beam.sdk.transforms.windowing.BoundedWindow
-
- Direct Known Subclasses:
EncodedBoundedWindow
,GlobalWindow
,IntervalWindow
public abstract class BoundedWindow extends java.lang.Object
ABoundedWindow
represents window information assigned to data elements.It has one method
maxTimestamp()
to define an upper bound (inclusive) for element timestamps. AWindowFn
must assign an element only to windows wheremaxTimestamp()
is greater than or equal to the element timestamp. When the watermark passes the maximum timestamp, all data for a window is estimated to be received.A window does not need to have a lower bound. Only the upper bound is mandatory because it governs management of triggering and discarding of the window.
Windows must also implement
Object.equals(java.lang.Object)
andObject.hashCode()
such that windows that are logically equal will be treated as equal byequals()
andhashCode()
.
-
-
Field Summary
Fields Modifier and Type Field Description static org.joda.time.Instant
TIMESTAMP_MAX_VALUE
The maximum value for any Beam timestamp.static org.joda.time.Instant
TIMESTAMP_MIN_VALUE
The minimum value for any Beam timestamp.
-
Constructor Summary
Constructors Constructor Description BoundedWindow()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description static java.lang.String
formatTimestamp(org.joda.time.Instant timestamp)
Formats aInstant
timestamp with additional Beam-specific metadata, such as indicating whether the timestamp is the end of the global window or one of the distinguished valuesTIMESTAMP_MIN_VALUE
orTIMESTAMP_MIN_VALUE
.abstract org.joda.time.Instant
maxTimestamp()
Returns the inclusive upper bound of timestamps for values in this window.static void
validateTimestampBounds(org.joda.time.Instant timestamp)
Validates that a given timestamp is within min and max bounds.
-
-
-
Field Detail
-
TIMESTAMP_MIN_VALUE
public static final org.joda.time.Instant TIMESTAMP_MIN_VALUE
The minimum value for any Beam timestamp. Often referred to as "-infinity".This value and
TIMESTAMP_MAX_VALUE
are chosen so that their microseconds-since-epoch can be safely represented with along
.
-
TIMESTAMP_MAX_VALUE
public static final org.joda.time.Instant TIMESTAMP_MAX_VALUE
The maximum value for any Beam timestamp. Often referred to as "+infinity".This value and
TIMESTAMP_MIN_VALUE
are chosen so that their microseconds-since-epoch can be safely represented with along
.
-
-
Method Detail
-
formatTimestamp
public static java.lang.String formatTimestamp(org.joda.time.Instant timestamp)
Formats aInstant
timestamp with additional Beam-specific metadata, such as indicating whether the timestamp is the end of the global window or one of the distinguished valuesTIMESTAMP_MIN_VALUE
orTIMESTAMP_MIN_VALUE
.
-
maxTimestamp
public abstract org.joda.time.Instant maxTimestamp()
Returns the inclusive upper bound of timestamps for values in this window.
-
validateTimestampBounds
public static void validateTimestampBounds(org.joda.time.Instant timestamp)
Validates that a given timestamp is within min and max bounds.- Parameters:
timestamp
- timestamp to validate
-
-