public class JoinWindows extends Windows<TimeWindow>
A JoinWindows
instance defines a join over two stream on the same key and a maximum time difference.
In SQL-style you would express this join as
SELECT * FROM stream1, stream2 WHERE stream1.key = stream2.key AND stream2.ts - before <= stream1.ts <= stream2.ts + afterThere are three different window configuration supported:
Both values (before and after) must not result in an "inverse" window, i.e., lower-interval-bound must not be larger than upper-interval.bound.
Modifier and Type | Field and Description |
---|---|
long |
after
Maximum time difference for tuples that are after the join tuple.
|
long |
before
Maximum time difference for tuples that are before the join tuple.
|
Modifier and Type | Method and Description |
---|---|
JoinWindows |
after(long timeDifference)
Specifies that records of the same key are joinable if their timestamps are within
the join window interval, and if the timestamp of a record from the secondary stream
is later than or equal to the timestamp of a record from the first stream.
|
JoinWindows |
before(long timeDifference)
Specifies that records of the same key are joinable if their timestamps are within
the join window interval, and if the timestamp of a record from the secondary stream is
earlier than or equal to the timestamp of a record from the first stream.
|
boolean |
equals(Object o) |
int |
hashCode() |
static JoinWindows |
of(String name)
Specifies that records of the same key are joinable if their timestamps are equal.
|
Map<Long,TimeWindow> |
windowsFor(long timestamp)
Not supported by
JoinWindows . |
JoinWindows |
with(long timeDifference)
Specifies that records of the same key are joinable if their timestamps are within
timeDifference . |
maintainMs, name, segments, until
public final long before
public final long after
public static JoinWindows of(String name)
name
- The name of the window. Must not be null or empty.public JoinWindows with(long timeDifference)
timeDifference
.timeDifference
- join window interval (must not be negative)public JoinWindows before(long timeDifference)
timeDifference
- join window intervalpublic JoinWindows after(long timeDifference)
timeDifference
- join window intervalpublic Map<Long,TimeWindow> windowsFor(long timestamp)
JoinWindows
. Throws UnsupportedOperationException
.windowsFor
in class Windows<TimeWindow>
timestamp
- the timestamp window should get created forwindowStartTimestamp -> Window
entries