public class StreamWindow<T> extends ArrayList<T> implements org.apache.flink.util.Collector<T>
WindowedDataStreams.
The user can apply transformations on these windows with the appropriate
WindowedDataStream methods. Each stream window consists of a
random ID, a number representing the number of partitions for this specific
window (ID) and the elements itself. The ID and number of parts will be used
to merge the subwindows after distributed transformations.| Modifier and Type | Field and Description |
|---|---|
int |
numberOfParts |
int |
windowID |
modCount| Constructor and Description |
|---|
StreamWindow()
Creates a new window with a random id
|
StreamWindow(int windowID)
Creates a new window with the specific id
|
StreamWindow(int windowID,
int numberOfParts)
Creates a new window with the given id and number of parts
|
StreamWindow(StreamWindow<T> window)
Creates a shallow copy of the window
|
StreamWindow(StreamWindow<T> window,
org.apache.flink.api.common.typeutils.TypeSerializer<T> serializer)
Creates a deep copy of the window using the given serializer
|
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
void |
collect(T record) |
boolean |
compatibleWith(StreamWindow<T> otherWindow)
Checks whether this window can be merged with the given one.
|
boolean |
equals(Object o) |
static <R> StreamWindow<R> |
fromElements(R... elements)
Creates a new
StreamWindow with random id from the given elements |
static <R> StreamWindow<R> |
merge(List<StreamWindow<R>> windows)
Merges compatible windows together.
|
static <R> StreamWindow<R> |
merge(StreamWindow<R>... windows)
Merges compatible windows together.
|
static <X> List<StreamWindow<X>> |
partitionBy(StreamWindow<X> streamWindow,
org.apache.flink.api.java.functions.KeySelector<X,?> keySelector,
boolean withKey)
Partitions the window using the given keyselector.
|
void |
setID(int id) |
StreamWindow<T> |
setNumberOfParts(int n) |
static <X> List<StreamWindow<X>> |
split(StreamWindow<X> window,
int n)
Splits the window into n equal (if possible) sizes.
|
String |
toString() |
add, add, addAll, addAll, clear, clone, contains, ensureCapacity, forEach, get, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, removeIf, removeRange, replaceAll, retainAll, set, size, sort, spliterator, subList, toArray, toArray, trimToSizehashCodecontainsAllfinalize, getClass, notify, notifyAll, wait, wait, waitcontainsAll, hashCodeparallelStream, streampublic StreamWindow()
public StreamWindow(int windowID)
windowID - ID of the windowpublic StreamWindow(int windowID,
int numberOfParts)
windowID - numberOfParts - public StreamWindow(StreamWindow<T> window)
window - The window to be copiedpublic StreamWindow(StreamWindow<T> window, org.apache.flink.api.common.typeutils.TypeSerializer<T> serializer)
window - The window to be copiedserializer - The serializer used for copying the records.public static <X> List<StreamWindow<X>> partitionBy(StreamWindow<X> streamWindow, org.apache.flink.api.java.functions.KeySelector<X,?> keySelector, boolean withKey) throws Exception
streamWindow - StreamWindow instance to partitionkeySelector - The keyselector used for extracting keys.withKey - Flag to decide whether the key object should be included in
the created windowExceptionpublic static <X> List<StreamWindow<X>> split(StreamWindow<X> window, int n)
window - Window to splitn - Number of desired partitionspublic StreamWindow<T> setNumberOfParts(int n)
public void setID(int id)
public boolean compatibleWith(StreamWindow<T> otherWindow)
otherWindow - The window to testpublic static <R> StreamWindow<R> merge(StreamWindow<R>... windows)
windows - Windows to mergepublic static <R> StreamWindow<R> merge(List<StreamWindow<R>> windows)
windows - Windows to mergepublic boolean equals(Object o)
equals in interface Collection<T>equals in interface List<T>equals in class AbstractList<T>public void collect(T record)
collect in interface org.apache.flink.util.Collector<T>public void close()
close in interface org.apache.flink.util.Collector<T>public String toString()
toString in class AbstractCollection<T>public static <R> StreamWindow<R> fromElements(R... elements)
StreamWindow with random id from the given elementselements - The elements contained in the resulting windowCopyright © 2014–2015 The Apache Software Foundation. All rights reserved.