Excerpt | ||
---|---|---|
| ||
Siddhi Inbuilt functions windows in wiki format |
Following are the supported inbuilt functions windows of Siddhi
...
Table of Contents |
---|
...
time
Anchor |
---|
...
|
...
|
<event> time (<int|long|float|double|string|bool|object >
arg1, <int|long|float|double|string|bool|object > arg2,.., <int|long|float|double|string|bool|object > argNtime>
windowTime)
- Extension Type: Function
- Description: Returns the value of the first non null input parameter.
- Parameters: This function accepts one or more parameters, and they all have to be the same type of, any one of the available types.
- Return Type: Return type will be the first input parameter's type.
- Examples:
coalesce('123', null, '789')
returns '123'.coalesce(null, 76, 567)
returns 76.coalesce(null, null, null)
returns null.
...
< int|long|float|double|string|bool > convert (<int|long|float|double|string|bool>
toBeConverted, <string> convertedTo)
- Extension Type: Function
- Description: Converts the first input parameter according to the convertedTo parameter.
- Parameter: toBeConverted : To be converted parameter with type other than object.
- Parameter: convertedTo : A string constant parameter expressing the everted to type using one of the following strings values: 'int', 'long', 'float', 'double', 'string', 'bool'.
- Return Type: Return type will be type specified by the convertedTo parameter.
- Examples:
convert('123', 'double')
returns 123.0.convert(45.9, 'int')
returns 46.convert(true, 'string')
returns 'true'.
...
< bool > instanceOfBoolean (<int|long|float|double|string|bool|object>
arg)
- Extension Type: Function
- Description: Checks if the parameter is an instance of Boolean or not.
- Parameter: arg : The parameter to be checked.
- Return Type: Returns bool, true if the parameter is an instance of Boolean and false otherwise.
- Examples:
instanceOfBoolean(123)
returns false.instanceOfBoolean(true)
returns true.instanceOfBoolean(false)
returns true.
...
< bool > instanceOfDouble (<int|long|float|double|string|bool|object>
arg)
- Extension Type: Function
- Description: Checks if the parameter is an instance of Double or not.
- Parameter: arg : The parameter to be checked.
- Return Type: Returns bool, true if the parameter is an instance of Double and false otherwise.
- Examples:
instanceOfDouble(123)
returns false.instanceOfDouble(56.45)
returns true.instanceOfDouble(false)
returns false.
...
< bool > instanceOfFloat (<int|long|float|double|string|bool|object>
arg)
- Extension Type: Function
- Description: Checks if the parameter is an instance of Float or not.
- Parameter: arg : The parameter to be checked.
- Return Type: Returns bool, true if the parameter is an instance of Float and false otherwise.
- Examples:
instanceOfFloat(123)
returns false.instanceOfFloat(56.45)
returns false.instanceOfFloat(56.45f)
returns true.
...
< bool > instanceOfInteger (<int|long|float|double|string|bool|object>
arg)
- Extension Type: Function
- Description: Checks if the parameter is an instance of Integer or not.
- Parameter: arg : The parameter to be checked.
- Return Type: Returns bool, true if the parameter is an instance of Integer and false otherwise.
- Examples:
instanceOfInteger(123)
returns true.instanceOfInteger(56.45)
returns false.instanceOfInteger(56.45f)
returns false.
...
< bool > instanceOfLong (<int|long|float|double|string|bool|object>
arg)
- Extension Type: Function
- Description: Checks if the parameter is an instance of Long or not.
- Parameter: arg : The parameter to be checked.
- Return Type: Returns bool, true if the parameter is an instance of Long and false otherwise.
- Examples:
instanceOfLong(123)
returns false.instanceOfLong(5667l)
returns true.instanceOfLong(56.67)
returns false.
...
< bool > instanceOfString (<int|long|float|double|string|bool|object>
arg)
- Extension Type: Function
- Description: Checks if the parameter is an instance of String or not.
- Parameter: arg : The parameter to be checked.
- Return Type: Returns bool, true if the parameter is an instance of String and false otherwise.
- Examples:
instanceOfString('test')
returns true.instanceOfString('5667')
returns true.instanceOfString(56.67)
returns false.
UUID
< string > UUID (
)
- Extension Type: Function
- Description: Generate a UUID.
- Return Type: Returns a UUID string.
- Examples:
UUID()
returns a34eec40-32c2-44fe-8075-7f4fde2e2dd8.
E.g. Converting room number to string and introducing message ID to each event
...
language | sql |
---|---|
linenumbers | true |
...
- Window
- Description: Sliding time window, that holds events for that arrived during last windowTime period, and gets updated on every event arrival and expiry.
- Parameter: windowTime: The sliding time period for which the window should hold events.
- Return Type: Return current and expired events.
- Examples:
time(20)
for processing events arrived in last 20 milliseconds.time(2 min)
for processing events arrived in last 2 minutes.
timeBatch
Anchor | ||||
---|---|---|---|---|
|
<event> timeBatch (<int|long|time>
windowTime)
- Extension Type: Window
- Description: Batch (tumbling) time window, that holds events arrived between windowTime periods, and gets updated for every windowTime.
- Parameter: windowTime: The batch time period for which the window should hold events.
- Return Type: Return current and expired events.
- Examples:
timeBatch(20)
for processing events arrived every 20 milliseconds.time(2 min)
for processing events arrived every 2 minutes.
length
Anchor | ||||
---|---|---|---|---|
|
<event> length (<int>
windowLength)
- Extension Type: Window
- Description: Sliding length window, that holds last windowLength events, and gets updated on every event arrival and expiry.
- Parameter: windowLength : The number of events that need to should be in a sliding length window.
- Return Type: Return current and expired events.
- Examples:
length(10)
for processing last 10 events.time(200)
for processing last 200 events.
lengthBatch
Anchor | ||||
---|---|---|---|---|
|
<event> lengthBatch (<int>
windowLength)
- Extension Type: Window
- Description: Batch (tumbling) length window, that holds up to windowLength events, and gets updated on every windowLength event arrival.
- Parameter: windowLength : For the number of events the window should tumble.
- Return Type: Return current and expired events.
- Examples:
lengthBatch(10)
for processing 10 events as a batch.time(200)
for processing 200 events as a batch.
externalTime
Anchor | ||||
---|---|---|---|---|
|
<event> time (<long> timestamp, <int|long|time>
windowTime)
- Extension Type: Window
- Description: Sliding time window based on external time, that holds events for that arrived during last windowTime period from the external timestamp, and gets updated on every monotonically increasing timestamp.
- Parameter: timestamp : The time which the window determines as current time and will act upon, the value of this parameter should be monotonically increasing.
- Parameter: windowTime: The sliding time period for which the window should hold events.
- Return Type: Return current and expired events.
Examples: externalT
ime(eventTime,20)
for processing events arrived in last 20 milliseconds from the eventTime.externalTime(eventTimestamp, 2 min)
for processing events arrived in last 2 minutes from eventTimestamp.Excerpt hidden true To do: add other window types