RollingSum
RollingSum calculates a window-based rolling sum for an updateBy table operation. The rolling sum can be calculated using forward and/or backward windows.
Syntax
Parameters
| Parameter | Type | Description |
|---|---|---|
| revTicks | long | The look-behind window size in ticks (rows). |
| fwdTicks | long | The look-forward window size in ticks (rows). |
| pairs | String... | The input/output column name pairs. |
| timestampCol | String | The name of the DateTime column. |
| revTime | long | The look-behind window size in nanoseconds. |
| fwdTime | long | The look-forward window size in nanoseconds. |
| revDuration | Duration | The look-behind window size in Duration. |
| fwdDuration | Duration | The look-forward window size in Duration. |
Returns
An UpdateByOperation to be used in an updateBy table operation.
Examples
The following example performs an updateBy on the source table using three row-based RollingSum operations. Each operation gives varying revTicks and fwdTicks values to show how they affect the output. The windows for each operation are as follows:
opBefore: The window contains two rows. It starts two rows before the current row, and ends at the row before the current row.opAfter: The window contains three rows. It starts one row after the current row, and ends three rows after the current row.opMiddle: The window contains three rows. It starts one row before the current row, and ends one row ahead of the current row.
The following example performs an updateBy on the source table using three time-based RollingSum operations. Each operation gives varying revTime and fwdTime values to show how they affect the output. The windows for each operation are as follows:
opBefore: The window starts five seconds before the current row, and ends one second before the current row.opAfter: The window starts one second after the current row, and ends five seconds after the current row.opMiddle: The window starts three seconds before the current row, and ends three seconds after the current row.