Data connectivity & integrationPipeline Builder ExpressionsLead

Lead

Supported in: Batch, Faster

Returns the value of the input expression from the row a set number of rows after the current row in the window, where the number of rows is given by the 'lead' argument (default 1, the immediately following row). Requires an ordered window, since the window's ordering determines which row is after the current row.

Expression categories: Aggregate

Declared arguments

  • Expression: Expression to lead.
    Expression<T>
  • optional Default value: Value returned when there are fewer than 'lead' rows after the current row.
    Literal<T>
  • optional Lead: Number of rows to lead.
    Literal<Integer>

Type variable bounds: T accepts AnyType

Output type: T

Examples

Example 1: Base case

Argument values:

  • Expression: price
  • Default value: null
  • Lead: 1
priceOutput
100105
10598
98102
102null

Example 2: Null case

Argument values:

  • Expression: price
  • Default value: 0
  • Lead: 1
priceOutput
100105
10598
98102
1020