Top Description Fields Constructors Methods
org.h2.expression.analysis

public final Class Window

extends Object
Class Inheritance
Imports
java.util.ArrayList, .Iterator, .ListIterator, org.h2.api.ErrorCode, org.h2.command.query.QueryOrderBy, .Select, org.h2.engine.SessionLocal, org.h2.expression.Expression, org.h2.message.DbException, org.h2.result.SortOrder, org.h2.table.ColumnResolver, .TableFilter, org.h2.util.HasSQL, org.h2.value.Value, .ValueRow

Window clause.

Field Summary

Modifier and TypeField and Description
private WindowFrame
private ArrayList<QueryOrderBy>
private String
private ArrayList<Expression>

Constructor Summary

AccessConstructor and Description
public
Window(String
name of the parent window
parent
,
ArrayList<Expression>
PARTITION BY clause, or null
partitionBy
,
ArrayList<QueryOrderBy>
ORDER BY clause, or null
orderBy
,
WindowFrame
window frame clause, or null
frame
)

Creates a new instance of window clause.

Method Summary

Modifier and TypeMethod and Description
public static void
appendOrderBy(StringBuilder
string builder
builder
,
ArrayList<QueryOrderBy>
ORDER BY clause, or null
orderBy
,
int
formatting flags
sqlFlags
,
boolean
whether synthetic ORDER BY clause should be generated when it is missing
forceOrderBy
)

Appends ORDER BY clause to the specified builder.

private static void
public Value

Returns:

key for the current group, or null
getCurrentKey
(SessionLocal
session
session
)

Returns the key for the current group.

public ArrayList<QueryOrderBy>

Returns:

ORDER BY clause, or null
getOrderBy
()

Returns ORDER BY clause.

public StringBuilder

Returns:

the specified string builder
getSQL
(StringBuilder
string builder
builder
,
int
formatting flags
sqlFlags
,
boolean
whether synthetic ORDER BY clause should be generated when it is missing
forceOrderBy
)

Appends SQL representation to the specified builder.

public WindowFrame

Returns:

window frame, or null
getWindowFrame
()

Returns window frame, or null.

public boolean

Returns:

true if window ordering clause is specified or ROWS unit is used
isOrdered
()

Returns true if window ordering clause is specified or ROWS unit is used.

public void
mapColumns(ColumnResolver
the column resolver
resolver
,
int
the subquery nesting level
level
)

Map the columns of the resolver to expression columns.

public void
optimize(SessionLocal
the session
session
)

Try to optimize the window conditions.

private void
public void
setEvaluatable(TableFilter
the table filter
tableFilter
,
boolean
true if the table filter can return value
value
)

Tell the expression columns whether the table filter can return values now.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

public void
updateAggregate(SessionLocal
the session
session
,
int
select stage
stage
)

Update an aggregate value.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

frameback to summary
private WindowFrame frame
orderByback to summary
private ArrayList<QueryOrderBy> orderBy
parentback to summary
private String parent
partitionByback to summary
private ArrayList<Expression> partitionBy

Constructor Detail

Windowback to summary
public Window(String parent, ArrayList<Expression> partitionBy, ArrayList<QueryOrderBy> orderBy, WindowFrame frame)

Creates a new instance of window clause.

Parameters
parent:String

name of the parent window

partitionBy:ArrayList<Expression>

PARTITION BY clause, or null

orderBy:ArrayList<QueryOrderBy>

ORDER BY clause, or null

frame:WindowFrame

window frame clause, or null

Method Detail

appendOrderByback to summary
public static void appendOrderBy(StringBuilder builder, ArrayList<QueryOrderBy> orderBy, int sqlFlags, boolean forceOrderBy)

Appends ORDER BY clause to the specified builder.

Parameters
builder:StringBuilder

string builder

orderBy:ArrayList<QueryOrderBy>

ORDER BY clause, or null

sqlFlags:int

formatting flags

forceOrderBy:boolean

whether synthetic ORDER BY clause should be generated when it is missing

appendOrderByStartback to summary
private static void appendOrderByStart(StringBuilder builder)
getCurrentKeyback to summary
public Value getCurrentKey(SessionLocal session)

Returns the key for the current group.

Parameters
session:SessionLocal

session

Returns:Value

key for the current group, or null

getOrderByback to summary
public ArrayList<QueryOrderBy> getOrderBy()

Returns ORDER BY clause.

Returns:ArrayList<QueryOrderBy>

ORDER BY clause, or null

getSQLback to summary
public StringBuilder getSQL(StringBuilder builder, int sqlFlags, boolean forceOrderBy)

Appends SQL representation to the specified builder.

Parameters
builder:StringBuilder

string builder

sqlFlags:int

formatting flags

forceOrderBy:boolean

whether synthetic ORDER BY clause should be generated when it is missing

Returns:StringBuilder

the specified string builder

See Also
Expression#getSQL(StringBuilder, int, int)
getWindowFrameback to summary
public WindowFrame getWindowFrame()

Returns window frame, or null.

Returns:WindowFrame

window frame, or null

isOrderedback to summary
public boolean isOrdered()

Returns true if window ordering clause is specified or ROWS unit is used.

Returns:boolean

true if window ordering clause is specified or ROWS unit is used

mapColumnsback to summary
public void mapColumns(ColumnResolver resolver, int level)

Map the columns of the resolver to expression columns.

Parameters
resolver:ColumnResolver

the column resolver

level:int

the subquery nesting level

See Also
Expression#mapColumns(ColumnResolver, int, int)
optimizeback to summary
public void optimize(SessionLocal session)

Try to optimize the window conditions.

Parameters
session:SessionLocal

the session

resolveWindowsback to summary
private void resolveWindows(ColumnResolver resolver)
setEvaluatableback to summary
public void setEvaluatable(TableFilter tableFilter, boolean value)

Tell the expression columns whether the table filter can return values now. This is used when optimizing the query.

Parameters
tableFilter:TableFilter

the table filter

value:boolean

true if the table filter can return value

See Also
Expression#setEvaluatable(TableFilter, boolean)
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

a string representation of the object

Annotations
@Override
updateAggregateback to summary
public void updateAggregate(SessionLocal session, int stage)

Update an aggregate value.

Parameters
session:SessionLocal

the session

stage:int

select stage

See Also
Expression#updateAggregate(SessionLocal, int)