lead_not_null

lead_not_null(value: storable, leadby: const int64) -> value

Return the non-null value of one column in a following row across an ordered group. offset is the number of rows forward from the current row to obtain a value, and any null value does not count towards the offset. The function can still return null if no non-null value is found in the window frame. If no ordering is specified, the default ordering is that of the invoking verb, which is generally the valid_from timestamp, ascending. In this case, lead_not_null(col, 1) returns the next non-null value for column col.

Domain

This is a window function (calculates over a group of multiple input rows using windowing).

Categories

Examples

make_col next_value:window(lead_not_null(value, 1), group_by(key))

Obtain the next non-null value within the group identified by key and store the results in a new column named next_value.

timestampkeyvaluenext_value
100A53
150B65
180Anull3
200Anull3
300B5null
400A3null