Class TumblingWindows<L>
- java.lang.Object
-
- org.apache.storm.streams.windowing.BaseWindow<L,L>
-
- org.apache.storm.streams.windowing.TumblingWindows<L>
-
- Type Parameters:
L
- the type of the length of the window (e.g Count, Duration)
- All Implemented Interfaces:
Serializable
,Window<L,L>
public class TumblingWindows<L> extends BaseWindow<L,L>
A tumbling window specification. The window tumbles after the specified window length.- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class org.apache.storm.streams.windowing.BaseWindow
lag, lateTupleStream, timestampField
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object o)
L
getSlidingInterval()
The sliding interval of the window.L
getWindowLength()
The length of the window.int
hashCode()
static TumblingWindows<BaseWindowedBolt.Count>
of(BaseWindowedBolt.Count count)
A count based tumbling window.static TumblingWindows<BaseWindowedBolt.Duration>
of(BaseWindowedBolt.Duration duration)
A time duration based tumbling window.TumblingWindows<L>
withLag(BaseWindowedBolt.Duration duration)
Specify the maximum time lag of the tuple timestamp in milliseconds.TumblingWindows<L>
withLateTupleStream(String streamId)
Specify a stream id on which late tuples are going to be emitted.TumblingWindows<L>
withTimestampField(String fieldName)
The name of the field in the tuple that contains the timestamp when the event occurred as a long value.-
Methods inherited from class org.apache.storm.streams.windowing.BaseWindow
getLag, getLateTupleStream, getTimestampField
-
-
-
-
Method Detail
-
of
public static TumblingWindows<BaseWindowedBolt.Count> of(BaseWindowedBolt.Count count)
A count based tumbling window.- Parameters:
count
- the number of tuples after which the window tumbles
-
of
public static TumblingWindows<BaseWindowedBolt.Duration> of(BaseWindowedBolt.Duration duration)
A time duration based tumbling window.- Parameters:
duration
- the time duration after which the window tumbles
-
getWindowLength
public L getWindowLength()
Description copied from interface:Window
The length of the window.- Returns:
- the window length
-
getSlidingInterval
public L getSlidingInterval()
Description copied from interface:Window
The sliding interval of the window.- Returns:
- the sliding interval
-
withTimestampField
public TumblingWindows<L> withTimestampField(String fieldName)
The name of the field in the tuple that contains the timestamp when the event occurred as a long value. This is used of event-time based processing. If this config is set and the field is not present in the incoming tuple, anIllegalArgumentException
will be thrown.- Parameters:
fieldName
- the name of the field that contains the timestamp
-
withLateTupleStream
public TumblingWindows<L> withLateTupleStream(String streamId)
Specify a stream id on which late tuples are going to be emitted. They are going to be accessible via theWindowedBoltExecutor.LATE_TUPLE_FIELD
field. It must be defined on a per-component basis, and in conjunction with theBaseWindowedBolt.withTimestampField(java.lang.String)
, otherwiseIllegalArgumentException
will be thrown.- Parameters:
streamId
- the name of the stream used to emit late tuples on
-
withLag
public TumblingWindows<L> withLag(BaseWindowedBolt.Duration duration)
Specify the maximum time lag of the tuple timestamp in milliseconds. It means that the tuple timestamps cannot be out of order by more than this amount.- Parameters:
duration
- the max lag duration
-
equals
public boolean equals(Object o)
- Overrides:
equals
in classBaseWindow<L,L>
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classBaseWindow<L,L>
-
-