Object - streams : ExternalTimeBatchWindow

This is a batch (tumbling) time window based on external time, that holds events arrived during window time periods, and gets updated for every window time. E.g. from inputStream window externalTimeBatch(inputStream.timestamp, 1000, 500, 1200, true) select inputStream.name, inputStream.age, sum(inputStream.age) as sumAge, count() as count group by inputStream.name => (TeacherOutput [] teachers) { foreach var t in teachers { outputStream.publish(t); } } The externalTimeBatch window should only have two to five parameters (timestamp field, windowTime, startTime, timeout, replaceTimestampWithBatchEndTime)

Constructor

__init

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

  • nextProcessPointer function(StreamEvent?[]) returns (())
  • windowParameters any[]

Methods

Fields

  • timeToKeep int
  • description

  • startTime int (default -1)
  • description

  • isStartTimeEnabled boolean (default false)
  • description

  • replaceTimestampWithBatchEndTime boolean (default false)
  • description

  • flushed boolean (default false)
  • description

  • endTime int (default -1)
  • description

  • schedulerTimeout int (default 0)
  • description

  • lastScheduledTime int
  • description

  • lastCurrentEventTime int (default 0)
  • description

  • nextProcessPointer function(StreamEvent?[]) returns (())
  • description

  • timeStamp string
  • description

  • storeExpiredEvents boolean (default false)
  • description

  • outputExpectsExpiredEvents boolean (default false)
  • description

  • windowParameters any[]
  • description

  • scheduler Scheduler? (default ())
  • description

getScheduler

()

returns Scheduler

initParameters

Parameters

  • parameters any[]

process

The process function process the incoming events to the events and update the current state of the window.

Parameters

  • streamEvents StreamEvent?[]
  • The array of stream events to be processed.

getCandidateEvents

(StreamEvent originEvent, function(map, map) returns (boolean) conditionFunc, boolean isLHSTrigger)

returns [StreamEvent?, StreamEvent?][]

Returns the events(State) which match with the where condition in the join clause for a given event.

Parameters

  • originEvent StreamEvent
  • The event against which the state or the events being held by the window is matched.

  • conditionFunc function(map, map) returns (boolean)
  • The function pointer to the lambda function which contain the condition logic in where clause.

  • isLHSTrigger boolean (default true)
  • Specify if the join is triggered when the lhs stream received the events, if so it should be true. Most of the time it is true. In rare cases, where the join is triggered when the rhs stream receives events this should be false.

  • Return Type

    ([StreamEvent?, StreamEvent?][])
  • Returns an array of 2 element tuples of events. A tuple contains the matching events one from lhs stream and one from rhs stream.

saveState

()

returns map

Return current state to be saved as a map of any typed values.

  • Return Type

    (map)
  • A map of any typed values.

restoreState

Restores the saved state which is passed as a map of any typed values.

Parameters

  • state map
  • A map of typed any values. This map contains the values to be restored from the persisted data.

cloneAppend

Parameters

flushToOutputChunk

Parameters

  • currentTime int
  • preserveCurrentEvents boolean

appendToOutputChunk

Parameters

  • currentTime int
  • preserveCurrentEvents boolean

findEndTime

(int currentTime, int startTime_, int timeToKeep_)

returns int

Parameters

  • currentTime int
  • startTime_ int
  • timeToKeep_ int
  • Return Type

    (int)

initTiming

Parameters

getTimestamp

(any val)

returns int

Parameters

  • val any
  • Return Type

    (int)