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 stream1.ts - before <= stream2.ts AND stream2.ts <= stream1.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(long timeDifference)
Specifies that records of the same key are joinable if their timestamps are within
timeDifference . |
long |
size() |
Map<Long,TimeWindow> |
windowsFor(long timestamp)
Not supported by
JoinWindows . |
maintainMs, segments, until
public final long before
public final long after
public static JoinWindows of(long timeDifference)
timeDifference
.
(timeDifference
must not be negative)timeDifference
- join window intervalpublic 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