addTimeWindow
The addTimeWindow method adds a Boolean column to the source table.
- The Boolean column's value will be
falsewhen the row's timestamp is older than the specified number of nanoseconds. - If the timestamp is within N nanoseconds (
windowNanos) of the current time, the result column istrue. - If the timestamp is null, the value is null.
The resulting table adds a new row whenever the source table ticks, and modifies a row's value in the
resultcolumn (fromtruetofalse) when it passes out of the window.
Syntax
result = WindowCheck.addTimeWindow(table, timestampColumn, windowNanos, inWindowColumn)
Parameters
| Parameter | Type | Description |
|---|---|---|
| table | QueryTable | The source table. |
| timestampColumn | String | The timestamp column in the source table to monitor. |
| windowNanos | long | How much time, in nanoseconds, to include in the window.
Rows with a |
| inWindowColumn | String | The name of the new Boolean column. |
Returns
A new table that contains an in-window Boolean column.
Examples
The following example creates a time table, and then applies addTimeWindow to show whether a given row is within the last 10 seconds.
import io.deephaven.engine.util.WindowCheck
source = timeTable("PT00:00:01")
result = WindowCheck.addTimeWindow(source, "Timestamp", SECOND * 10, "WithinLast10Seconds")
