|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.eigenbase.sql.SqlNode org.eigenbase.sql.SqlCall org.eigenbase.sql.SqlWindow
public class SqlWindow
SQL window specifcation.
For example, the query
declares windows w and w1, and uses a window in an OVER clause. It thus contains 3SELECT sum(a) OVER (w ROWS 3 PRECEDING) FROM t WINDOW w AS (PARTITION BY x, y ORDER BY z), w1 AS (w ROWS 5 PRECEDING UNBOUNDED FOLLOWING)
SqlWindow
objects.
Field Summary | |
---|---|
static int |
AllowPartial_OPERAND
Ordinal of the operand which declares whether to allow partial results. |
static int |
DeclName_OPERAND
Ordinal of the operand which holds the name of the window being declared. |
static int |
IsRows_OPERAND
Ordinal of the operand which declares whether it is a physical (rows) or logical (values) range. |
static int |
LowerBound_OPERAND
Ordinal of the operand which holds the lower bound of the window. |
static int |
OperandCount
|
static int |
OrderList_OPERAND
Ordinal of the operand which holds the list of ordering columns. |
static int |
PartitionList_OPERAND
Ordinal of the operand which holds the list of partitioning columns. |
static int |
RefName_OPERAND
Ordinal of operand which holds the name of the window being referenced, or null. |
static int |
UpperBound_OPERAND
Ordinal of the operand which holds the upper bound of the window. |
private SqlCall |
windowCall
|
Fields inherited from class org.eigenbase.sql.SqlCall |
---|
operands |
Fields inherited from class org.eigenbase.sql.SqlNode |
---|
emptyArray |
Constructor Summary | |
---|---|
SqlWindow(SqlWindowOperator operator,
SqlNode[] operands,
SqlParserPos pos)
Creates a window. |
Method Summary | |
---|---|
boolean |
equalsDeep(SqlNode node,
boolean fail)
Overridden method to specfically check only the right subtree of a window definition |
SqlIdentifier |
getDeclName()
|
SqlNode |
getLowerBound()
|
SqlWindowOperator.OffsetRange |
getOffsetAndRange()
|
SqlNodeList |
getOrderList()
|
SqlNodeList |
getPartitionList()
|
SqlIdentifier |
getRefName()
|
SqlNode |
getUpperBound()
|
SqlCall |
getWindowCall()
|
boolean |
isAllowPartial()
Returns whether partial windows are allowed. |
boolean |
isRows()
|
SqlWindow |
overlay(SqlWindow that,
SqlValidator validator)
Creates a new window by combining this one with another. |
void |
setDeclName(SqlIdentifier name)
|
void |
setLowerBound(SqlNode bound)
|
private static void |
setOperand(SqlNode[] destOperands,
SqlNode[] srcOperands,
int i,
SqlValidator validator)
|
void |
setUpperBound(SqlNode bound)
|
void |
setWindowCall(SqlCall windowCall)
|
void |
unparse(SqlWriter writer,
int leftPrec,
int rightPrec)
Writes a SQL representation of this node to a writer. |
Methods inherited from class org.eigenbase.sql.SqlCall |
---|
accept, clone, findValidOptions, getCallSignature, getFunctionQuantifier, getKind, getMonotonicity, getOperands, getOperator, isA, isCountStar, isExpanded, isName, setOperand, setOperator, validate |
Methods inherited from class org.eigenbase.sql.SqlNode |
---|
clone, cloneArray, equalDeep, getParserPosition, toSqlString, toSqlString, toString, validateExpr |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int DeclName_OPERAND
public static final int RefName_OPERAND
public static final int PartitionList_OPERAND
public static final int OrderList_OPERAND
public static final int IsRows_OPERAND
public static final int LowerBound_OPERAND
public static final int UpperBound_OPERAND
public static final int AllowPartial_OPERAND
public static final int OperandCount
private SqlCall windowCall
Constructor Detail |
---|
public SqlWindow(SqlWindowOperator operator, SqlNode[] operands, SqlParserPos pos)
Method Detail |
---|
public void unparse(SqlWriter writer, int leftPrec, int rightPrec)
SqlNode
The leftPrec
and rightPrec
parameters give
us enough context to decide whether we need to enclose the expression in
parentheses. For example, we need parentheses around "2 + 3" if preceded
by "5 *". This is because the precedence of the "*" operator is greater
than the precedence of the "+" operator.
The algorithm handles left- and right-associative operators by giving them slightly different left- and right-precedence.
If SqlWriter.isAlwaysUseParentheses()
is true, we use
parentheses even when they are not required by the precedence rules.
For the details of this algorithm, see SqlCall.unparse(org.eigenbase.sql.SqlWriter, int, int)
.
unparse
in class SqlCall
writer
- Target writerleftPrec
- The precedence of the SqlNode
immediately
preceding this node in a depth-first scan of the parse treerightPrec
- The precedence of the SqlNode
immediatelypublic SqlIdentifier getDeclName()
public void setDeclName(SqlIdentifier name)
public SqlNode getLowerBound()
public void setLowerBound(SqlNode bound)
public SqlNode getUpperBound()
public void setUpperBound(SqlNode bound)
public boolean isRows()
public SqlNodeList getOrderList()
public SqlNodeList getPartitionList()
public SqlIdentifier getRefName()
public void setWindowCall(SqlCall windowCall)
public SqlCall getWindowCall()
public SqlWindow overlay(SqlWindow that, SqlValidator validator)
For example,
WINDOW (w PARTITION BY x ORDER BY y) overlay WINDOW w AS (PARTITION BY z)yields
WINDOW (PARTITION BY z ORDER BY y)
Does not alter this or the other window.
private static void setOperand(SqlNode[] destOperands, SqlNode[] srcOperands, int i, SqlValidator validator)
public boolean equalsDeep(SqlNode node, boolean fail)
equalsDeep
in class SqlCall
node
- The SqlWindow to compare to "this" windowfail
-
public SqlWindowOperator.OffsetRange getOffsetAndRange()
public boolean isAllowPartial()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |