Functions - streams

avg

Returns a Average aggregator object. The aggregator function name which is used in a streaming query should have the same name as this function's name.

buildStreamEvent

Creates streams:StreamEvent object array for a record t received by the stream denoted by the name streamNme.

count

Returns a Count aggregator object. The aggregator function name which is used in a streaming query should have the same name as this function's name.

createAndOperatorProcessor

Creates and returns a AndOperatorProcessor instance.

createCompoundPatternProcessor

Creates and returns a CompoundPatternProcessor instance.

createFilter

Creates a Filter object and return it.

createFollowedByProcessor

Creates and returns a FollowedByProcessor instance.

createNotOperatorProcessor

Creates and returns a NotOperatorProcessor instance.

createOperandProcessor

Creates and returns a OperandProcessor instance.

createOrOperatorProcessor

Creates and returns a OrOperatorProcessor instance.

createOrderBy

Creates an OrderBy object and return it.

createOutputProcess

Creates and return a OutputProcess object.

createResetStreamEvent

Creates a RESET event from a given event.

createSelect

Creates and returns a select clause.

createStateMachine

Creates and returns a StateMachine object.

createStreamJoinProcessor

Creates a StreamJoinProcessor and returns it.

createTableJoinProcessor

Creates a TableJoinProcessor and return it.

delay

The delay function creates a DelayWindow object and returns it.

distinctCount

Returns a DistinctCount aggregator object. The aggregator function name which is used in a streaming query should have the same name as this function's name.

externalTime

The externalTime function creates a ExternalTimeWindow object and returns it.

externalTimeBatch

The externalTimeBatch function creates a ExternalTimeBatchWindow object and returns it.

getStreamEvent

Get the stream event from any? field. This function can only be used only if we are sure that the anyEvent is a streams:StreamEvent.

hopping

The hopping function creates a HoppingWindow object and returns it.

initPersistence

Function to initialize and start snapshotting.

length

The length function creates a LengthWindow object and returns it.

lengthBatch

The lengthBatch function creates a LengthBatchWindow object and returns it.

max

Returns a Max aggregator object. The aggregator function name which is used in a streaming query should have the same name as this function's name.

maxForever

Returns a MaxForever aggregator object. The aggregator function name which is used in a streaming query should have the same name as this function's name.

min

Returns a Min aggregator object. The aggregator function name which is used in a streaming query should have the same name as this function's name.

minForever

Returns a MinForever aggregator object. The aggregator function name which is used in a streaming query should have the same name as this function's name.

registerSnapshotable

Function to register Snapshotables.

removeState

Function to clear an existing state.

restoreState

Function to restore state of a given object.

sort

The sort function creates a SortWindow object and returns it.

stdDev

Returns a StdDev aggregator object. The aggregator function name which is used in a streaming query should have the same name as this function's name.

sum

Returns a Sum aggregator object. The aggregator function name which is used in a streaming query should have the same name as this function's name.

time

The time function creates a TimeWindow object and returns it.

timeAccum

The timeAccum function creates a TimeAccumulatingWindow object and returns it.

timeBatch

The timeBatch function creates a TimeBatchWindow object and returns it.

timeLength

The timeLength function creates a TimeLengthWindow object and returns it.

timeOrder

The timeOrder function creates a TimeOrderWindow object and returns it.

toSnapshottableEvent

Convert a single streams:StreamEvent object to streams:SnapshottableStreamEvent object.

toSnapshottableEvents

Converts a given array of streams:StreamEvent objects to an array of streams:SnapshottableStreamEvent.

toStreamEvent

Convert a single streams:SnapshottableStreamEvent object to streams:StreamEvent object.

toStreamEvents

Converts a given array of snapshotable events to an array of streams:StreamEvent objects.

uniqueLength

The uniqueLength function creates a UniqueLengthWindow object and returns it.

avg

()

returns Aggregator

Returns a Average aggregator object. The aggregator function name which is used in a streaming query should have the same name as this function's name.

  • Return Type

    (Aggregator)
  • A Aggregator object which performs averaging.

buildStreamEvent

(any t, string streamName)

returns StreamEvent[]

Creates streams:StreamEvent object array for a record t received by the stream denoted by the name streamNme.

Parameters

  • t any
  • A record received by the stream streamName.

  • streamName string
  • Name of the stream to which the record t is received.

  • Return Type

    (StreamEvent[])
  • Returns an array of streams:StreamEvents|()

count

()

returns Aggregator

Returns a Count aggregator object. The aggregator function name which is used in a streaming query should have the same name as this function's name.

  • Return Type

    (Aggregator)
  • A Aggregator object which performs counting.

createAndOperatorProcessor

()

returns AndOperatorProcessor

Creates and returns a AndOperatorProcessor instance.

createCompoundPatternProcessor

(int? withinTimeMillis)

returns CompoundPatternProcessor

Creates and returns a CompoundPatternProcessor instance.

Parameters

  • withinTimeMillis int? - ()
  • time from initial state to current state

createFilter

( function(StreamEvent[]) returns (()) nextProcPointer, function(map) returns (boolean) conditionFunc)

returns Filter

Creates a Filter object and return it.

Parameters

  • nextProcPointer function(StreamEvent[]) returns (())
  • The function pointer to the process function of the next processor.

  • conditionFunc function(map) returns (boolean)
  • The function pointer to the condition evaluator. This is a function which returns true or false based on the boolean expression given in the where clause.

  • Return Type

    (Filter)
  • Returns a Filter object.

createFollowedByProcessor

()

returns FollowedByProcessor

Creates and returns a FollowedByProcessor instance.

createNotOperatorProcessor

(int? forTimeMillis)

returns NotOperatorProcessor

Creates and returns a NotOperatorProcessor instance.

Parameters

  • forTimeMillis int?
  • for time in milliseconds

createOperandProcessor

(string alias, function(map) returns (boolean) onConditionFunc, int minOccurs, int maxOccurs)

returns OperandProcessor

Creates and returns a OperandProcessor instance.

Parameters

  • alias string
  • processor alias

  • onConditionFunc function(map) returns (boolean)
  • condition function (i.e [e1.id == id])

  • minOccurs int - 1
  • minimum occurrences of the event

  • maxOccurs int - 1
  • maximum occurrences of the event

createOrOperatorProcessor

()

returns OrOperatorProcessor

Creates and returns a OrOperatorProcessor instance.

createOrderBy

( function(StreamEvent[]) returns (()) nextProcessorPointer, function(map) returns (anydata) fields, string[] sortFieldMetadata)

returns OrderBy

Creates an OrderBy object and return it.

Parameters

  • nextProcessorPointer function(StreamEvent[]) returns (())
  • A function pointer to the process function of the next processor.

  • fields function(map) returns (anydata)
  • An array of function pointers which each returns a field by which the events are sorted. Events are sorted by the first field, if there are elements of same value, the second field is used and so on.

  • sortFieldMetadata string[]
  • sortTypes of the fields (streams:ASCENDING or streams:DESCENDING). First element is the sort type of the first element of fields and so on.

  • Return Type

    (OrderBy)
  • Returns a OrderBy object.

createOutputProcess

( function(map[]) returns (()) outputFunc)

returns OutputProcess

Creates and return a OutputProcess object.

Parameters

  • outputFunc function(map[]) returns (())
  • The function pointer to a lambda function created out of the statements in the streaming action

createResetStreamEvent

(StreamEvent event)

returns StreamEvent

Creates a RESET event from a given event.

Parameters

  • event StreamEvent
  • The event from which the reset event is created.

  • Return Type

    (StreamEvent)
  • A stream event of type streams:RESET.

createSelect

( function(StreamEvent[]) returns (()) nextProcPointer, Aggregator[] aggregatorArr, function(StreamEvent) returns (anydata) groupbyFuncArray, function(StreamEvent, Aggregator[]) returns (map) selectFunc, string scopeName)

returns Select

Creates and returns a select clause.

Parameters

  • nextProcPointer function(StreamEvent[]) returns (())
  • The function pointer to the process function of the next processor.

  • aggregatorArr Aggregator[]
  • The array of aggregators used in the select clause. If the same aggregator is used twice, the aggregatorArr will contains that specific aggregator twice in the order they appear in the select clause.

  • groupbyFuncArray function(StreamEvent) returns (anydata)
  • The array of function pointer which contains the lambda function which returns the expressions in the group by clause.

  • selectFunc function(StreamEvent, Aggregator[]) returns (map)
  • The function pointer to a lambda function that creates the data field of the output stream event.

  • scopeName string - $scope$name
  • A unique id to identify the forever block if there are multiple forever blocks.

  • Return Type

    (Select)
  • Returns a Select object.

createStateMachine

(CompoundPatternProcessor rootProcessor, function(StreamEvent[]) returns (()) nextProcPointer)

returns StateMachine

Creates and returns a StateMachine object.

Parameters

  • nextProcPointer function(StreamEvent[]) returns (())
  • pointer for the next processor

  • Return Type

    (StateMachine)
  • A StateMachine object which performs pattern processing.

createStreamJoinProcessor

( function(StreamEvent[]) returns (()) nextProcessor, JoinType joinType, function(map, map) returns (boolean) conditionFunc)

returns StreamJoinProcessor

Creates a StreamJoinProcessor and returns it.

Parameters

  • nextProcessor function(StreamEvent[]) returns (())
  • The process function of the next processor, which can be a Select processor, Aggregator processor, Having processor.. etc.

  • joinType JoinType
  • Type of the join being performed ("JOIN"|"LEFTOUTERJOIN"|"RIGHTOUTERJOIN"|"FULLOUTERJOIN")

  • conditionFunc function(map, map) returns (boolean) - ()
  • A lambda function which contains the joining condition and return true if the condition satifies the condition.

createTableJoinProcessor

( function(StreamEvent[]) returns (()) nextProcessor, JoinType joinType, function(StreamEvent) returns (map[]) tableQuery)

returns TableJoinProcessor

Creates a TableJoinProcessor and return it.

Parameters

  • nextProcessor function(StreamEvent[]) returns (())
  • The function pointer to process function of the next processor, which can be a Select processor, Aggregator processor, Having processor.. etc

  • joinType JoinType
  • The type of the join and it can be any value defined by streams:JoinType.

  • tableQuery function(StreamEvent) returns (map[])
  • The function pointer to a function which retrieves the records from the table and joins w ith each stream event.

delay

(any[] windowParameters, function(StreamEvent[]) returns (()) nextProcessPointer)

returns Window

The delay function creates a DelayWindow object and returns it.

Parameters

  • windowParameters any[]
  • Arguments which should be passed with the window function in the streams query in the order they appear in the argument list.

  • nextProcessPointer function(StreamEvent[]) returns (()) - ()
  • The function pointer to the process function of the next processor.

  • Return Type

    (Window)
  • Returns the created window.

distinctCount

()

returns Aggregator

Returns a DistinctCount aggregator object. The aggregator function name which is used in a streaming query should have the same name as this function's name.

  • Return Type

    (Aggregator)
  • A Aggregator object which represents DistinctCount.

externalTime

(any[] windowParameters, function(StreamEvent[]) returns (()) nextProcessPointer)

returns Window

The externalTime function creates a ExternalTimeWindow object and returns it.

Parameters

  • windowParameters any[]
  • Arguments which should be passed with the window function in the streams query in the order they appear in the argument list.

  • nextProcessPointer function(StreamEvent[]) returns (()) - ()
  • The function pointer to the process function of the next processor.

  • Return Type

    (Window)
  • Returns the created window.

externalTimeBatch

(any[] windowParameters, function(StreamEvent[]) returns (()) nextProcessPointer)

returns Window

The externalTimeBatch function creates a ExternalTimeBatchWindow object and returns it.

Parameters

  • windowParameters any[]
  • Arguments which should be passed with the window function in the streams query in the order they appear in the argument list.

  • nextProcessPointer function(StreamEvent[]) returns (()) - ()
  • The function pointer to the process function of the next processor.

  • Return Type

    (Window)
  • Returns the created window.

getStreamEvent

(any? anyEvent)

returns StreamEvent

Get the stream event from any? field. This function can only be used only if we are sure that the anyEvent is a streams:StreamEvent.

Parameters

  • anyEvent any?
  • The object from which, the stream event is extracted.

  • Return Type

    (StreamEvent)
  • Returns the extracted streams:StreamEvent object.

hopping

(any[] windowParameters, function(StreamEvent[]) returns (()) nextProcessPointer)

returns Window

The hopping function creates a HoppingWindow object and returns it.

Parameters

  • windowParameters any[]
  • Arguments which should be passed with the window function in the streams query in the order they appear in the argument list.

  • nextProcessPointer function(StreamEvent[]) returns (()) - ()
  • The function pointer to the process function of the next processor.

  • Return Type

    (Window)
  • Returns the created window.

initPersistence

Function to initialize and start snapshotting.

length

(any[] windowParameters, function(StreamEvent[]) returns (()) nextProcessPointer)

returns Window

The length function creates a LengthWindow object and returns it.

Parameters

  • windowParameters any[]
  • Arguments which should be passed with the window function in the streams query in the order they appear in the argument list.

  • nextProcessPointer function(StreamEvent[]) returns (()) - ()
  • The function pointer to the process function of the next processor.

  • Return Type

    (Window)
  • Returns the created window.

lengthBatch

(any[] windowParameters, function(StreamEvent[]) returns (()) nextProcessPointer)

returns Window

The lengthBatch function creates a LengthBatchWindow object and returns it.

Parameters

  • windowParameters any[]
  • Arguments which should be passed with the window function in the streams query in the order they appear in the argument list.

  • nextProcessPointer function(StreamEvent[]) returns (()) - ()
  • The function pointer to the process function of the next processor.

  • Return Type

    (Window)
  • Returns the created window.

max

()

returns Aggregator

Returns a Max aggregator object. The aggregator function name which is used in a streaming query should have the same name as this function's name.

  • Return Type

    (Aggregator)
  • A Aggregator which represents Max.

maxForever

()

returns Aggregator

Returns a MaxForever aggregator object. The aggregator function name which is used in a streaming query should have the same name as this function's name.

  • Return Type

    (Aggregator)
  • A Aggregator which represents MaxForever.

min

()

returns Aggregator

Returns a Min aggregator object. The aggregator function name which is used in a streaming query should have the same name as this function's name.

  • Return Type

    (Aggregator)
  • A Aggregator which represents Min.

minForever

()

returns Aggregator

Returns a MinForever aggregator object. The aggregator function name which is used in a streaming query should have the same name as this function's name.

  • Return Type

    (Aggregator)
  • A Aggregator which represents MainForever.

registerSnapshotable

Function to register Snapshotables.

Parameters

  • key string
  • An unique string identifier for the snapshotable reference.

  • reference any
  • The snapshotable reference to be registered.

removeState

(string key)

returns boolean

Function to clear an existing state.

Parameters

  • key string
  • An unique string identifier for the snapshotable reference.

  • Return Type

    (boolean)
  • A boolean indicating whether the state for the given key removed successfully.

restoreState

Function to restore state of a given object.

Parameters

  • key string
  • An unique string identifier for the snapshotable reference.

  • reference any
  • The snapshotable reference to be restored.

sort

(any[] windowParameters, function(StreamEvent[]) returns (()) nextProcessPointer)

returns Window

The sort function creates a SortWindow object and returns it.

Parameters

  • windowParameters any[]
  • Arguments which should be passed with the window function in the streams query in the order they appear in the argument list.

  • nextProcessPointer function(StreamEvent[]) returns (()) - ()
  • The function pointer to the process function of the next processor.

  • Return Type

    (Window)
  • Returns the created window.

stdDev

()

returns Aggregator

Returns a StdDev aggregator object. The aggregator function name which is used in a streaming query should have the same name as this function's name.

  • Return Type

    (Aggregator)
  • A Aggregator which represents StdDev.

sum

()

returns Aggregator

Returns a Sum aggregator object. The aggregator function name which is used in a streaming query should have the same name as this function's name.

  • Return Type

    (Aggregator)
  • A Aggregator which perform addition/summation.

time

(any[] windowParameters, function(StreamEvent[]) returns (()) nextProcessPointer)

returns Window

The time function creates a TimeWindow object and returns it.

Parameters

  • windowParameters any[]
  • Arguments which should be passed with the window function in the streams query in the order they appear in the argument list.

  • nextProcessPointer function(StreamEvent[]) returns (()) - ()
  • The function pointer to the process function of the next processor.

  • Return Type

    (Window)
  • Returns the created window.

timeAccum

(any[] windowParameters, function(StreamEvent[]) returns (()) nextProcessPointer)

returns Window

The timeAccum function creates a TimeAccumulatingWindow object and returns it.

Parameters

  • windowParameters any[]
  • Arguments which should be passed with the window function in the streams query in the order they appear in the argument list.

  • nextProcessPointer function(StreamEvent[]) returns (()) - ()
  • The function pointer to the process function of the next processor.

  • Return Type

    (Window)
  • Returns the created window.

timeBatch

(any[] windowParameters, function(StreamEvent[]) returns (()) nextProcessPointer)

returns Window

The timeBatch function creates a TimeBatchWindow object and returns it.

Parameters

  • windowParameters any[]
  • Arguments which should be passed with the window function in the streams query in the order they appear in the argument list.

  • nextProcessPointer function(StreamEvent[]) returns (()) - ()
  • The function pointer to the process function of the next processor.

  • Return Type

    (Window)
  • Returns the created window.

timeLength

(any[] windowParameters, function(StreamEvent[]) returns (()) nextProcessPointer)

returns Window

The timeLength function creates a TimeLengthWindow object and returns it.

Parameters

  • windowParameters any[]
  • Arguments which should be passed with the window function in the streams query in the order they appear in the argument list.

  • nextProcessPointer function(StreamEvent[]) returns (()) - ()
  • The function pointer to the process function of the next processor.

  • Return Type

    (Window)
  • Returns the created window.

timeOrder

(any[] windowParameters, function(StreamEvent[]) returns (()) nextProcessPointer)

returns Window

The timeOrder function creates a TimeOrderWindow object and returns it.

Parameters

  • windowParameters any[]
  • Arguments which should be passed with the window function in the streams query in the order they appear in the argument list.

  • nextProcessPointer function(StreamEvent[]) returns (()) - ()
  • The function pointer to the process function of the next processor.

  • Return Type

    (Window)
  • Returns the created window.

toSnapshottableEvent

(StreamEvent event)

returns SnapshottableStreamEvent

Convert a single streams:StreamEvent object to streams:SnapshottableStreamEvent object.

Parameters

  • event StreamEvent
  • The streams:StreamEvent object to be converted to snapshotable event.

toSnapshottableEvents

(StreamEvent[] | any[] | () events)

returns SnapshottableStreamEvent[]

Converts a given array of streams:StreamEvent objects to an array of streams:SnapshottableStreamEvent.

Parameters

  • events StreamEvent[] | any[] | ()
  • The events to be coverted to snapshotable events.

toStreamEvent

(SnapshottableStreamEvent event)

returns StreamEvent

Convert a single streams:SnapshottableStreamEvent object to streams:StreamEvent object.

Parameters

  • Return Type

    (StreamEvent)
  • The converted streams:StreamEvent object.

toStreamEvents

(SnapshottableStreamEvent[] | any[] | () events)

returns StreamEvent[]

Converts a given array of snapshotable events to an array of streams:StreamEvent objects.

Parameters

  • Return Type

    (StreamEvent[])
  • Returns the converted streams:StreamEvents objects array.

uniqueLength

(any[] windowParameters, function(StreamEvent[]) returns (()) nextProcessPointer)

returns Window

The uniqueLength function creates a UniqueLengthWindow object and returns it.

Parameters

  • windowParameters any[]
  • Arguments which should be passed with the window function in the streams query in the order they appear in the argument list.

  • nextProcessPointer function(StreamEvent[]) returns (()) - ()
  • The function pointer to the process function of the next processor.

  • Return Type

    (Window)
  • Returns the created window.