Table of Contents

Class WindowFrame

Namespace
Datafication.Core.Data
Assembly
Datafication.Core.dll

Defines the window frame specification for window functions. Corresponds to SQL ROWS BETWEEN / RANGE BETWEEN syntax.

public class WindowFrame
Inheritance
object
WindowFrame

Properties

EndBoundary

Gets the ending boundary type for the frame.

public WindowBoundary EndBoundary { get; }

Property Value

WindowBoundary

EndOffset

Gets the offset for the end boundary (used with Preceding/Following).

public int? EndOffset { get; }

Property Value

int?

FrameType

Gets the type of frame (Rows or Range).

public WindowFrameType FrameType { get; }

Property Value

WindowFrameType

StartBoundary

Gets the starting boundary type for the frame.

public WindowBoundary StartBoundary { get; }

Property Value

WindowBoundary

StartOffset

Gets the offset for the start boundary (used with Preceding/Following).

public int? StartOffset { get; }

Property Value

int?

Methods

CurrentRow()

Creates a frame containing only the current row. Equivalent to SQL: ROWS BETWEEN CURRENT ROW AND CURRENT ROW

public static WindowFrame CurrentRow()

Returns

WindowFrame

WindowFrame instance

GetWindowBounds(int, int)

Calculates the effective window bounds for a given row.

public (int startRow, int endRow) GetWindowBounds(int currentRow, int totalRows)

Parameters

currentRow int

Current row index (0-based)

totalRows int

Total number of rows in partition/dataset

Returns

(int startRow, int endRow)

Tuple of (startRow, endRow) both inclusive and 0-based

Rows(int, int)

Creates a simple row-based frame: N PRECEDING AND M FOLLOWING.

public static WindowFrame Rows(int preceding, int following = 0)

Parameters

preceding int

Number of rows before current row (0 for current row only)

following int

Number of rows after current row (default 0)

Returns

WindowFrame

WindowFrame instance

RowsBetween(WindowBoundary, int?, WindowBoundary, int?)

Creates a row-based frame with explicit boundary specifications. Equivalent to SQL: ROWS BETWEEN [start] AND [end]

public static WindowFrame RowsBetween(WindowBoundary start, int? startOffset, WindowBoundary end, int? endOffset)

Parameters

start WindowBoundary

Starting boundary type

startOffset int?

Offset for start boundary (required for Preceding/Following)

end WindowBoundary

Ending boundary type

endOffset int?

Offset for end boundary (required for Preceding/Following)

Returns

WindowFrame

WindowFrame instance

ToString()

Returns a string representation of the window frame.

public override string ToString()

Returns

string