public final class Alias extends Expression
AUTO_PARENTHESES, MAP_IN_AGGREGATE, MAP_IN_WINDOW, MAP_INITIAL, WITH_PARENTHESES, WITHOUT_PARENTHESES
ADD_PLAN_INFORMATION, DEFAULT_SQL_FLAGS, NO_CASTS, QUOTE_ONLY_WHEN_REQUIRED, REPLACE_LOBS_FOR_TRACE, TRACE_SQL_FLAGS
Constructor and Description |
---|
Alias(Expression expression,
java.lang.String alias,
boolean aliasColumnName) |
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getAlias(SessionLocal session,
int columnIndex)
Get the alias name of a column or SQL expression
if it is not an aliased expression.
|
java.lang.String |
getColumnName(SessionLocal session,
int columnIndex)
Get the column name or alias name of this expression.
|
java.lang.String |
getColumnNameForView(SessionLocal session,
int columnIndex)
Get the column name of this expression for a view.
|
int |
getCost()
Estimate the cost to process the expression.
|
Expression |
getNonAliasExpression()
Returns the main expression, skipping aliases.
|
int |
getNullable()
Check whether this expression is a column and can store NULL.
|
java.lang.String |
getSchemaName()
Get the schema name, or null
|
java.lang.String |
getTableName()
Get the table name, or null
|
TypeInfo |
getType()
Returns the data type.
|
java.lang.StringBuilder |
getUnenclosedSQL(java.lang.StringBuilder builder,
int sqlFlags)
Get the SQL statement of this expression.
|
Value |
getValue(SessionLocal session)
Return the resulting value for the current row.
|
boolean |
isEverything(ExpressionVisitor visitor)
Check if this expression and all sub-expressions can fulfill a criteria.
|
boolean |
isIdentity()
Check if this is an identity column.
|
void |
mapColumns(ColumnResolver resolver,
int level,
int state)
Map the columns of the resolver to expression columns.
|
Expression |
optimize(SessionLocal session)
Try to optimize the expression.
|
void |
setEvaluatable(TableFilter tableFilter,
boolean b)
Tell the expression columns whether the table filter can return values
now.
|
void |
updateAggregate(SessionLocal session,
int stage)
Update an aggregate value.
|
addFilterConditions, createIndexConditions, getBooleanValue, getEnclosedSQL, getNotIfPossible, getSQL, getSQL, getSQL, getSQL, getSubexpression, getSubexpressionCount, getTableAlias, getWhenSQL, getWhenValue, isConstant, isNullConstant, isValueSet, isWhenConditionOperand, needParentheses, optimizeCondition, toString, writeExpressions, writeExpressions
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getTraceSQL
public Alias(Expression expression, java.lang.String alias, boolean aliasColumnName)
public Expression getNonAliasExpression()
Expression
getNonAliasExpression
in class Expression
public Value getValue(SessionLocal session)
Expression
getValue
in class Expression
session
- the sessionpublic TypeInfo getType()
Expression
getType
in interface Typed
getType
in class Expression
public void mapColumns(ColumnResolver resolver, int level, int state)
Expression
mapColumns
in class Expression
resolver
- the column resolverlevel
- the subquery nesting levelstate
- current state for nesting checks, initial value is
Expression.MAP_INITIAL
public Expression optimize(SessionLocal session)
Expression
optimize
in class Expression
session
- the sessionpublic void setEvaluatable(TableFilter tableFilter, boolean b)
Expression
setEvaluatable
in class Expression
tableFilter
- the table filterb
- true if the table filter can return valuepublic boolean isIdentity()
Expression
isIdentity
in class Expression
public java.lang.StringBuilder getUnenclosedSQL(java.lang.StringBuilder builder, int sqlFlags)
Expression
getUnenclosedSQL
in class Expression
builder
- string buildersqlFlags
- formatting flagspublic void updateAggregate(SessionLocal session, int stage)
Expression
updateAggregate
in class Expression
session
- the sessionstage
- select stagepublic java.lang.String getAlias(SessionLocal session, int columnIndex)
Expression
getAlias
in class Expression
session
- the sessioncolumnIndex
- 0-based column indexpublic java.lang.String getColumnNameForView(SessionLocal session, int columnIndex)
Expression
getColumnNameForView
in class Expression
session
- the sessioncolumnIndex
- 0-based column indexpublic int getNullable()
Expression
getNullable
in class Expression
public boolean isEverything(ExpressionVisitor visitor)
Expression
isEverything
in class Expression
visitor
- the visitorpublic int getCost()
Expression
getCost
in class Expression
public java.lang.String getSchemaName()
Expression
getSchemaName
in class Expression
public java.lang.String getTableName()
Expression
getTableName
in class Expression
public java.lang.String getColumnName(SessionLocal session, int columnIndex)
Expression
getColumnName
in class Expression
session
- the sessioncolumnIndex
- 0-based column index