Remember values for some time

this is an aggregate function. As such, it accepts a single operand which can wither be a scalar, in which case it will operate in turn on each item of the group, or an array or a vector in which case it will operate on each value in sequence and return the result (in practice, this process is delayed until the group is submitted for performance reasons)

User can choose to skip over NULL values or to include them in the computation with one of the modifiers SKIP NULLS to skip NULL values (the default) and KEEP NULLS to include them.

In the first case the result will still be NULL if all input values are NULL, and in the last case any NULL value will make the result NULL.

The other modifier tells whether the state used to compute the aggregate must be local (each group has its own independent state) or global (all groups share a single state). In general when using a GROUP-BY clause the former behavior is intended, and it is thus the default when an explicit GROUP-BY clause is present. Otherwise, the default is to use only one global state.

One can choose between those two with the modifier LOCALLY to force a group-wise state and GLOBALLY to force a global state.

This choice of the state lifespan is only meaningful when the operation is applied to a single scalar value, since the state required to compute the end result over a literal array or vector lives only as long as that computation.

Syntax

REMEMBER(…float-expr…, …time-expr…, …num-expr…, …expr…)

RECALL(…float-expr…, …time-expr…, …num-expr…, …expr…)

Typing

FLOAT, FLOAT, num, t -> BOOL

Description

Uses a series of Bloom-filters to remember any value for a given duration.

Returns TRUE if the value have been already encountered up to a configurable time D in the past (second operand).

The rate of false positive is provided (as the first operand) so that the trade-off between memory consumption and accuracy is easy to configure.

The third operand is the value to be remembered.

Optionally, a fourth operand can set explicitly the time to be used as current, overriding the event-time.

When a new value is remembered, the REMEMBER function will refresh its memory so that this value will be remembered for the next D duration, whereas the RECALL function will not, so that values will be reminded only for a duration D after it's first encountered.

See Also

Count Tells if an item is new