History
Expressions in parameters or output assignments of operator invocations can refer directly to tuples received in the past.
History access maintains a list of tuples, which can be subscripted by using the input port name. For example:
composite Main {
graph stream<int32 id, int32 diff, rstring name> In = Beacon() {}
stream<int32 id, int32 diff, rstring name> Out = Functor(In) {
param filter : name != In[1].name;
output Out : diff = id - In[1].id;
}
}
The expression In[1].name
refers to
a historical tuple on port In
, one tuple in the past,
and extracts the name
attribute from it. The current
tuple is at index 0, so a bare stream name like In
is
synonymous with In[0]
. For example, the filter parameter might
equivalently be written as In[0].name != In[1].name
.
The subscript must be a compile-time constant. History access does
not support slicing.
The tuples in the history
list correspond to the last n
tuples received on
the stream. Primitive operator parameters like partitionBy do
not affect the history.