Partitioning
The flag
partitioned
in the window clause specifies that instead of
maintaining just one window per port, the operator invocation maintains one window per port per
partition. A partition is a set of tuples that have the same values for the
partitioning attributes.
While the partitioned
flag in the window
is a language feature, it is often supported by a partitionBy parameter,
which is a feature of an operator, not of the language. But by convention,
most operators implement it to follow the behavior described next. With
the partitioned
flag and parameter param
partitionBy: x, y
tuples belong to different partitions if
they differ in either attribute x
or y
.
When a new tuple arrives on a port, it is routed to the window for
its own partition. Each partition window uses an eviction policy and
a trigger policy as described for tumbling and sliding windows.
SPL supports the following partition eviction polices for partitioned windows:
partitionAge(float64 n)
: If a tuple is not inserted into a partition forn
seconds, the partition is deleted.partitionCount(uint32 c)
: If the number of partitions exceeds a count ofc
, partitions are deleted until the partition count is equal toc
.tupleCount(uint32 t)
: If the total number of tuples across all partitions exceeds a count oft
, partitions are deleted until the tuple count is less than or equal tot
.
Note: TimeInterval windows do not support partition
eviction.