org.eigenbase.sql
Class SqlExplain
java.lang.Object
org.eigenbase.sql.SqlNode
org.eigenbase.sql.SqlCall
org.eigenbase.sql.SqlExplain
- All Implemented Interfaces:
- Cloneable
public class SqlExplain
- extends SqlCall
A SqlExplain
is a node of a parse tree which represents an
EXPLAIN PLAN statement.
Nested Class Summary |
static class |
SqlExplain.Depth
The level of abstraction with which to display the plan. |
Methods inherited from class org.eigenbase.sql.SqlCall |
accept, clone, equalsDeep, findValidOptions, getCallSignature, getFunctionQuantifier, getKind, getMonotonicity, getOperands, getOperator, isA, isCountStar, isExpanded, isName, setOperand, setOperator, validate |
EXPLICANDUM_OPERAND
public static final int EXPLICANDUM_OPERAND
- See Also:
- Constant Field Values
DETAIL_LEVEL_OPERAND
public static final int DETAIL_LEVEL_OPERAND
- See Also:
- Constant Field Values
DEPTH_OPERAND
public static final int DEPTH_OPERAND
- See Also:
- Constant Field Values
AS_XML_OPERAND
public static final int AS_XML_OPERAND
- See Also:
- Constant Field Values
OPERAND_COUNT
public static final int OPERAND_COUNT
- See Also:
- Constant Field Values
nDynamicParams
private final int nDynamicParams
SqlExplain
public SqlExplain(SqlSpecialOperator operator,
SqlNode explicandum,
SqlLiteral detailLevel,
SqlLiteral depth,
SqlLiteral asXml,
int nDynamicParams,
SqlParserPos pos)
getExplicandum
public SqlNode getExplicandum()
- Returns:
- the underlying SQL statement to be explained
getDetailLevel
public SqlExplainLevel getDetailLevel()
- Returns:
- detail level to be generated
getDepth
public SqlExplain.Depth getDepth()
- Returns the level of abstraction at which this plan should be displayed.
getDynamicParamCount
public int getDynamicParamCount()
- Returns:
- the number of dynamic parameters in the statement
withImplementation
public boolean withImplementation()
- Returns:
- whether physical plan implementation should be returned
withType
public boolean withType()
- Returns:
- whether type should be returned
isXml
public boolean isXml()
- Returns whether result is to be in XML format.
unparse
public void unparse(SqlWriter writer,
int leftPrec,
int rightPrec)
- Description copied from class:
SqlNode
- Writes a SQL representation of this node to a writer.
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)
.
- Overrides:
unparse
in class SqlCall
- Parameters:
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
immediately