Package org.h2.expression.analysis
Class Window
java.lang.Object
org.h2.expression.analysis.Window
Window clause.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate WindowFrame
private ArrayList
<QueryOrderBy> private String
private ArrayList
<Expression> -
Constructor Summary
ConstructorsConstructorDescriptionWindow
(String parent, ArrayList<Expression> partitionBy, ArrayList<QueryOrderBy> orderBy, WindowFrame frame) Creates a new instance of window clause. -
Method Summary
Modifier and TypeMethodDescriptionstatic void
appendOrderBy
(StringBuilder builder, ArrayList<QueryOrderBy> orderBy, int sqlFlags, boolean forceOrderBy) Appends ORDER BY clause to the specified builder.private static void
appendOrderByStart
(StringBuilder builder) getCurrentKey
(SessionLocal session) Returns the key for the current group.Returns ORDER BY clause.getSQL
(StringBuilder builder, int sqlFlags, boolean forceOrderBy) Appends SQL representation to the specified builder.Returns window frame, or null.boolean
Returnstrue
if window ordering clause is specified or ROWS unit is used.void
mapColumns
(ColumnResolver resolver, int level) Map the columns of the resolver to expression columns.void
optimize
(SessionLocal session) Try to optimize the window conditions.private void
resolveWindows
(ColumnResolver resolver) void
setEvaluatable
(TableFilter tableFilter, boolean value) Tell the expression columns whether the table filter can return values now.toString()
void
updateAggregate
(SessionLocal session, int stage) Update an aggregate value.
-
Field Details
-
partitionBy
-
orderBy
-
frame
-
parent
-
-
Constructor Details
-
Window
public Window(String parent, ArrayList<Expression> partitionBy, ArrayList<QueryOrderBy> orderBy, WindowFrame frame) Creates a new instance of window clause.- Parameters:
parent
- name of the parent windowpartitionBy
- PARTITION BY clause, or nullorderBy
- ORDER BY clause, or nullframe
- window frame clause, or null
-
-
Method Details
-
appendOrderBy
public static void appendOrderBy(StringBuilder builder, ArrayList<QueryOrderBy> orderBy, int sqlFlags, boolean forceOrderBy) Appends ORDER BY clause to the specified builder.- Parameters:
builder
- string builderorderBy
- ORDER BY clause, or nullsqlFlags
- formatting flagsforceOrderBy
- whether synthetic ORDER BY clause should be generated when it is missing
-
appendOrderByStart
-
mapColumns
Map the columns of the resolver to expression columns.- Parameters:
resolver
- the column resolverlevel
- the subquery nesting level- See Also:
-
resolveWindows
-
optimize
Try to optimize the window conditions.- Parameters:
session
- the session
-
setEvaluatable
Tell the expression columns whether the table filter can return values now. This is used when optimizing the query.- Parameters:
tableFilter
- the table filtervalue
- true if the table filter can return value- See Also:
-
getOrderBy
Returns ORDER BY clause.- Returns:
- ORDER BY clause, or null
-
getWindowFrame
Returns window frame, or null.- Returns:
- window frame, or null
-
isOrdered
public boolean isOrdered()Returnstrue
if window ordering clause is specified or ROWS unit is used.- Returns:
true
if window ordering clause is specified or ROWS unit is used
-
getCurrentKey
Returns the key for the current group.- Parameters:
session
- session- Returns:
- key for the current group, or null
-
getSQL
Appends SQL representation to the specified builder.- Parameters:
builder
- string buildersqlFlags
- formatting flagsforceOrderBy
- whether synthetic ORDER BY clause should be generated when it is missing- Returns:
- the specified string builder
- See Also:
-
updateAggregate
Update an aggregate value.- Parameters:
session
- the sessionstage
- select stage- See Also:
-
toString
-