Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Excerpt
hiddentrue

Siddhi Inbuilt windows in wiki format

...

timeBatch
Anchor
timeBatch
timeBatch
 

Syntax<event> timeBatch(<int|long|time> windowTime)
Extension TypeWindow
DescriptionA batch (tumbling) time window that holds events that arrive during windowTime periods, and gets updated for each windowTime.
Parameter windowTime : The batch time period for which the window should hold events.
Return TypeReturns current and expired events.
Examples
  • timeBatch(20) for processing events that arrive every 20 milliseconds.
  • timeBatch(2 min) for processing events that arrive every 2 minutes.

length
Anchor
length
length
 

Syntax<event> length(<int> windowLength)
Extension TypeWindow
DescriptionA sliding length window that holds the last windowLength events at a given time, and gets updated for each arrival and expiry.
Parameter
  • windowLength : The number of events that should be included in a sliding length window.
Return TypeReturns current and expired events.
Examples
  • length(10) for processing the last 10 events.
  • length(200) for processing the last 200 events.

...

firstUnique
Anchor
firstUnique
firstUnique
 

Syntax<event> firstUnique(<string> attribute)
Extension TypeWindow
DescriptionFirst unique window processor keeps only the first events that are unique according to the given unique attribute.
Parameter attribute : The attribute that should be checked for uniqueness.
Return TypeReturns current and expired events.
ExamplesfirstUnique(ip) returns the first event arriving for each unique ip.

...

Syntax

<event> sort(<int> windowLength)

<event> sort(<int> windowLength, <string> attribute, <string> order)

<event> sort(<int> windowLength, <string> attribute, <string> order, .. , <string> attributeN, <string> orderN)

Extension TypeWindow
DescriptionThis window holds a batch of events that equal the number specified as the windowLength and sorts them in the given order.
Parameter
  • attribute : The attribute that should be checked for the order.
Return TypeReturns current and expired events.
Examplessort(5, volumeprice, 'asc', price, 'desc') returns ) keeps the events sorted by price in the ascending order of volume, and descending order of price for a window of 5 events. Therefore, at any given time, the window contains the 5 lowest prices.

frequent
Anchor
frequent
frequent

...

Syntax<event> externalTimeBatch(<long> timestamp, <int|long|time> windowTime)
Extension TypeWindow
DescriptionA batch (tumbling) time window based on external time, that holds events arrived during windowTime periods, and gets updated for every windowTime.
Parameters
  • timestamp : The time which the window determines as current time and will act upon. The value of this parameter should be monotonically increasing.
  • windowTime : The batch time period for which the window should hold events.
Return TypeReturns current and expired events.
Examples
  • externalTimeBatch(eventTime,20) for processing events that arrive every 20 milliseconds from the eventTime.
  • externalTimeBatch(eventTimestamp, 2 min) for processing events that arrive every 2 minutes from the eventTimestamp.

timeLength

Syntax<event> timeLength(<int|long|time> windowTime<int> windowLength)   
Extension TypeWindow
DescriptionA sliding time window that, at a given time holds the last windowLength events that arrived during last windowTime period, and gets updated for every event arrival and expiry.
Parameters
  • windowTime: The sliding time period for which the window should hold events.
  • windowLength: The number of events that should be be included in a sliding length window.
Return TypeReturns current and expired events.
Examples
  • timeLength(20 sec, 10) for processing the last 10 events that arrived within the last 20 seconds.
  • timeLength(2 min, 5) for processing the last 5 events that arrived within the last 2 minutes. 

...