• Window function: returns the value that is offset rows after the current row.

    Parameters

    • column: string | Column

      The column name or Column to compute lead for

    • offset: number

      The number of rows to look ahead

    Returns Column

    A Column representing the lead value

    df.select(lead(col("value"), 1))
    
  • Window function: returns the value that is offset rows after the current row, with default value.

    Parameters

    • column: string | Column

      The column name or Column to compute lead for

    • offset: number

      The number of rows to look ahead

    • defaultValue: any

      Default value when the offset is beyond the window

    Returns Column

    A Column representing the lead value

  • Window function: returns the value that is offset rows after the current row, with default value and null handling.

    Parameters

    • column: string | Column

      The column name or Column to compute lead for

    • offset: number

      The number of rows to look ahead

    • defaultValue: any

      Default value when the offset is beyond the window

    • ignoreNulls: boolean

      Whether to skip null values

    Returns Column

    A Column representing the lead value