Jump to content
  • How to emit an aggregate value for a trailing window of seconds


    For every new tuple, I want to emit the aggregate values for a window that contains the trailing X seconds. In order to do this, I need to open a window on every new tuple. Then, more or less, for every new tuple that comes in the largest (oldest) open window needs to emit a value ? although, first, windows should be closed (with NO emitting!) whose first value more than X seconds old.

    The point behind this is to emit the best known statistics for every new tuple that comes in.


    Use a data value for time if you possibly can. Otherwise you won't get the same answer each time you test.

    Use Predicate dimensions as follows: Open=true, Emit=true, Close=lastval(time) - firstval(time) > X seconds.

    Also follow the Aggregate with a Filter operator that discards deltaTime > X seconds.

    For example, use this Filter predicate "to_seconds(lastval(input1.time) - firstval(input1.time)) > 10".

    User Feedback

    Recommended Comments

    There are no comments to display.

  • Create New...