public class Comparison extends Expression
| Modifier and Type | Field and Description |
|---|---|
static int |
BIGGER
The comparison type meaning > as in ID>1.
|
static int |
BIGGER_EQUAL
The comparison type meaning >= as in ID>=1.
|
static int |
EQUAL
The comparison type meaning = as in ID=1.
|
static int |
EQUAL_NULL_SAFE
The comparison type meaning ID IS 1 (ID IS NOT DISTINCT FROM 1).
|
static int |
FALSE
This is a pseudo comparison type that is only used for index conditions.
|
static int |
IN_LIST
This is a pseudo comparison type that is only used for index conditions.
|
static int |
IN_QUERY
This is a pseudo comparison type that is only used for index conditions.
|
static int |
IS_NOT_NULL
The comparison type meaning IS NOT NULL as in NAME IS NOT NULL.
|
static int |
IS_NULL
The comparison type meaning IS NULL as in NAME IS NULL.
|
static int |
NOT_EQUAL
The comparison type meaning <> as in ID<>1.
|
static int |
NOT_EQUAL_NULL_SAFE
The comparison type meaning ID IS NOT 1 (ID IS DISTINCT FROM 1).
|
static int |
NULL_SAFE
This is a flag meaning the comparison is null safe (meaning never returns
NULL even if one operand is NULL).
|
static int |
SMALLER
The comparison type meaning < as in ID<1.
|
static int |
SMALLER_EQUAL
The comparison type meaning <= as in ID<=1.
|
static int |
SPATIAL_INTERSECTS
This is a comparison type that is only used for spatial index
conditions (operator "&&").
|
MAP_IN_AGGREGATE, MAP_IN_WINDOW, MAP_INITIAL| Constructor and Description |
|---|
Comparison(Session session,
int compareType,
Expression left,
Expression right) |
| Modifier and Type | Method and Description |
|---|---|
void |
addFilterConditions(TableFilter filter,
boolean outerJoin)
Add conditions to a table filter if they can be evaluated.
|
void |
createIndexConditions(Session session,
TableFilter filter)
Create index conditions if possible and attach them to the table filter.
|
int |
getCost()
Estimate the cost to process the expression.
|
Expression |
getNotIfPossible(Session session)
If it is possible, return the negated expression.
|
java.lang.StringBuilder |
getSQL(java.lang.StringBuilder builder,
boolean alwaysQuote)
Appends the SQL statement of this expression to the specified builder.
|
Expression |
getSubexpression(int index)
Returns subexpression with specified index.
|
int |
getSubexpressionCount()
Returns count of subexpressions.
|
TypeInfo |
getType()
Returns the data type.
|
Value |
getValue(Session 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.
|
void |
mapColumns(ColumnResolver resolver,
int level,
int state)
Map the columns of the resolver to expression columns.
|
Expression |
optimize(Session 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(Session session,
int stage)
Update an aggregate value.
|
getAlias, getBooleanValue, getColumnName, getExpressionColumns, getExpressionColumns, getExpressionColumns, getNonAliasExpression, getNullable, getSchemaName, getSQL, getTableAlias, getTableName, getUnenclosedSQL, isAutoIncrement, isConstant, isGeneratedKey, isValueSet, toString, writeExpressions, writeExpressionspublic static final int NULL_SAFE
public static final int EQUAL
public static final int EQUAL_NULL_SAFE
public static final int BIGGER_EQUAL
public static final int BIGGER
public static final int SMALLER_EQUAL
public static final int SMALLER
public static final int NOT_EQUAL
public static final int NOT_EQUAL_NULL_SAFE
public static final int IS_NULL
public static final int IS_NOT_NULL
public static final int FALSE
public static final int IN_LIST
public static final int IN_QUERY
public static final int SPATIAL_INTERSECTS
public Comparison(Session session, int compareType, Expression left, Expression right)
public java.lang.StringBuilder getSQL(java.lang.StringBuilder builder,
boolean alwaysQuote)
ExpressiongetSQL in class Expressionbuilder - string builderalwaysQuote - quote all identifierspublic Expression optimize(Session session)
Expressionoptimize in class Expressionsession - the sessionpublic Value getValue(Session session)
ExpressiongetValue in class Expressionsession - the sessionpublic Expression getNotIfPossible(Session session)
ExpressiongetNotIfPossible in class Expressionsession - the sessionpublic void createIndexConditions(Session session, TableFilter filter)
ExpressioncreateIndexConditions in class Expressionsession - the sessionfilter - the table filterpublic void setEvaluatable(TableFilter tableFilter, boolean b)
ExpressionsetEvaluatable in class ExpressiontableFilter - the table filterb - true if the table filter can return valuepublic void updateAggregate(Session session, int stage)
ExpressionupdateAggregate in class Expressionsession - the sessionstage - select stagepublic void addFilterConditions(TableFilter filter, boolean outerJoin)
ExpressionaddFilterConditions in class Expressionfilter - the table filterouterJoin - if the expression is part of an outer joinpublic void mapColumns(ColumnResolver resolver, int level, int state)
ExpressionmapColumns in class Expressionresolver - the column resolverlevel - the subquery nesting levelstate - current state for nesting checks, initial value is
Expression.MAP_INITIALpublic boolean isEverything(ExpressionVisitor visitor)
ExpressionisEverything in class Expressionvisitor - the visitorpublic int getCost()
ExpressiongetCost in class Expressionpublic int getSubexpressionCount()
ExpressiongetSubexpressionCount in class Expressionpublic Expression getSubexpression(int index)
ExpressiongetSubexpression in class Expressionindex - 0-based indexpublic TypeInfo getType()
ExpressiongetType in class Expression