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
-
objectWindowFrame
Properties
EndBoundary
Gets the ending boundary type for the frame.
public WindowBoundary EndBoundary { get; }
Property Value
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
StartBoundary
Gets the starting boundary type for the frame.
public WindowBoundary StartBoundary { get; }
Property Value
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
currentRowintCurrent row index (0-based)
totalRowsintTotal 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
precedingintNumber of rows before current row (0 for current row only)
followingintNumber 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
startWindowBoundaryStarting boundary type
startOffsetint?Offset for start boundary (required for Preceding/Following)
endWindowBoundaryEnding boundary type
endOffsetint?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