Share via


Functions.Lag Method

Definition

Overloads

Lag(Column, Int32, Object)

Window function: returns the value that is 'offset' rows before the current row, and null if there is less than 'offset' rows before the current row. For example, an 'offset' of one will return the previous row at any given point in the window partition.

Lag(String, Int32, Object)

Window function: returns the value that is 'offset' rows before the current row, and null if there is less than 'offset' rows before the current row. For example, an 'offset' of one will return the previous row at any given point in the window partition.

Lag(Column, Int32, Object)

Window function: returns the value that is 'offset' rows before the current row, and null if there is less than 'offset' rows before the current row. For example, an 'offset' of one will return the previous row at any given point in the window partition.

public static Microsoft.Spark.Sql.Column Lag (Microsoft.Spark.Sql.Column column, int offset, object defaultValue = default);
static member Lag : Microsoft.Spark.Sql.Column * int * obj -> Microsoft.Spark.Sql.Column
Public Shared Function Lag (column As Column, offset As Integer, Optional defaultValue As Object = Nothing) As Column

Parameters

column
Column

Column to apply

offset
Int32

Offset from the current row

defaultValue
Object

Default value when the offset row doesn't exist

Returns

Column object

Remarks

This is equivalent to the LAG function in SQL.

Applies to

Lag(String, Int32, Object)

Window function: returns the value that is 'offset' rows before the current row, and null if there is less than 'offset' rows before the current row. For example, an 'offset' of one will return the previous row at any given point in the window partition.

public static Microsoft.Spark.Sql.Column Lag (string columnName, int offset, object defaultValue = default);
static member Lag : string * int * obj -> Microsoft.Spark.Sql.Column
Public Shared Function Lag (columnName As String, offset As Integer, Optional defaultValue As Object = Nothing) As Column

Parameters

columnName
String

Column name

offset
Int32

Offset from the current row

defaultValue
Object

Default value when the offset row doesn't exist

Returns

Column object

Remarks

This is equivalent to the LAG function in SQL.

Applies to