Package org.h2.expression.analysis
Class WindowFrame
java.lang.Object
org.h2.expression.analysis.WindowFrame
Window frame clause.
-
Constructor Summary
ConstructorsConstructorDescriptionWindowFrame(WindowFrameUnits units, WindowFrameBound starting, WindowFrameBound following, WindowFrameExclusion exclusion) Creates new instance of window frame clause. -
Method Summary
Modifier and TypeMethodDescriptionstatic intgetEndIndex(Window over, SessionLocal session, ArrayList<Value[]> orderedRows, SortOrder sortOrder, int currentRow) Returns end index for the specified frame, or default end index if frame is null.Returns the exclusion clause.Returns the following clause.getSQL(StringBuilder builder, int formattingFlags) Append SQL representation to the specified builder.intgetStartIndex(SessionLocal session, ArrayList<Value[]> orderedRows, SortOrder sortOrder, int currentRow) Returns start index of this frame,Returns the starting clause.getUnits()Returns the units.booleanisValid()Checks validity of this frame.booleanCheck if bounds of this frame has variable expressions.iterator(SessionLocal session, ArrayList<Value[]> orderedRows, SortOrder sortOrder, int currentRow, boolean reverse) Returns iterator.iterator(Window over, SessionLocal session, ArrayList<Value[]> orderedRows, SortOrder sortOrder, int currentRow, boolean reverse) Returns iterator for the specified frame, or default iterator if frame is null.
-
Constructor Details
-
WindowFrame
public WindowFrame(WindowFrameUnits units, WindowFrameBound starting, WindowFrameBound following, WindowFrameExclusion exclusion) Creates new instance of window frame clause.- Parameters:
units- unitsstarting- starting clausefollowing- following clauseexclusion- exclusion clause
-
-
Method Details
-
iterator
public static Iterator<Value[]> iterator(Window over, SessionLocal session, ArrayList<Value[]> orderedRows, SortOrder sortOrder, int currentRow, boolean reverse) Returns iterator for the specified frame, or default iterator if frame is null.- Parameters:
over- windowsession- the sessionorderedRows- ordered rowssortOrder- sort ordercurrentRow- index of the current rowreverse- whether iterator should iterate in reverse order- Returns:
- iterator
-
getEndIndex
public static int getEndIndex(Window over, SessionLocal session, ArrayList<Value[]> orderedRows, SortOrder sortOrder, int currentRow) Returns end index for the specified frame, or default end index if frame is null.- Parameters:
over- windowsession- the sessionorderedRows- ordered rowssortOrder- sort ordercurrentRow- index of the current row- Returns:
- end index
- Throws:
UnsupportedOperationException- if over is not null and its exclusion clause is not EXCLUDE NO OTHERS
-
getUnits
Returns the units.- Returns:
- the units
-
getStarting
Returns the starting clause.- Returns:
- the starting clause
-
getFollowing
Returns the following clause.- Returns:
- the following clause, or null
-
getExclusion
Returns the exclusion clause.- Returns:
- the exclusion clause
-
isValid
public boolean isValid()Checks validity of this frame.- Returns:
- whether bounds of this frame valid
-
isVariableBounds
public boolean isVariableBounds()Check if bounds of this frame has variable expressions. This method may be used only afteroptimize(SessionLocal)invocation.- Returns:
- if bounds of this frame has variable expressions
-
iterator
public Iterator<Value[]> iterator(SessionLocal session, ArrayList<Value[]> orderedRows, SortOrder sortOrder, int currentRow, boolean reverse) Returns iterator.- Parameters:
session- the sessionorderedRows- ordered rowssortOrder- sort ordercurrentRow- index of the current rowreverse- whether iterator should iterate in reverse order- Returns:
- iterator
-
getStartIndex
public int getStartIndex(SessionLocal session, ArrayList<Value[]> orderedRows, SortOrder sortOrder, int currentRow) Returns start index of this frame,- Parameters:
session- the sessionorderedRows- ordered rowssortOrder- sort ordercurrentRow- index of the current row- Returns:
- start index
- Throws:
UnsupportedOperationException- if exclusion clause is not EXCLUDE NO OTHERS
-
getSQL
Append SQL representation to the specified builder.- Parameters:
builder- string builderformattingFlags- quote all identifiers- Returns:
- the specified string builder
- See Also:
-