Class ColumnReference
- java.lang.Object
-
- org.apache.derby.impl.sql.compile.QueryTreeNode
-
- org.apache.derby.impl.sql.compile.ValueNode
-
- org.apache.derby.impl.sql.compile.ColumnReference
-
- All Implemented Interfaces:
Visitable
public class ColumnReference extends ValueNode
A ColumnReference represents a column in the query tree. The parser generates a ColumnReference for each column reference. A column reference could be a column in a base table, a column in a view (which could expand into a complex expression), or a column in a subquery in the FROM clause.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
ColumnReference.RemapInfo
Helper class to keep track of remap data when a ColumnReference is remapped multiple times.
-
Field Summary
Fields Modifier and Type Field Description private java.lang.String
_columnName
private int
_mergeTableID
Columns mentioned by MERGE statements need to be associated the SOURCE or TARGET tableprivate int
_origColumnNumber
private ResultColumn
_origSource
private int
_origTableNumber
private TableName
_qualifiedTableName
private int
columnNumber
The column number in the underlying FromTable.private int
columnNumberBeforeFlattening
static int
MERGE_SOURCE
static int
MERGE_TARGET
static int
MERGE_UNKNOWN
private int
nestingLevel
private java.lang.String
origName
private java.util.ArrayList<ColumnReference.RemapInfo>
remaps
private boolean
replacesAggregate
private boolean
replacesWindowFunctionCall
private boolean
scoped
private ResultColumn
source
This is where the value for this column reference will be coming from.private int
sourceLevel
private int
tableNumber
The FromTable this column reference is bound to.private int
tableNumberBeforeFlattening
-
Fields inherited from class org.apache.derby.impl.sql.compile.ValueNode
transformed
-
Fields inherited from class org.apache.derby.impl.sql.compile.QueryTreeNode
AUTOINCREMENT_CREATE_MODIFY, AUTOINCREMENT_CYCLE, AUTOINCREMENT_INC_INDEX, AUTOINCREMENT_IS_AUTOINCREMENT_INDEX, AUTOINCREMENT_START_INDEX
-
-
Constructor Summary
Constructors Constructor Description ColumnReference(java.lang.String columnName, TableName tableName, int tokBeginOffset, int tokEndOffset, ContextManager cm)
Constructor.ColumnReference(java.lang.String columnName, TableName tableName, ContextManager cm)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) void
acceptChildren(Visitor v)
Accept a visitor on all child nodes.(package private) ColumnReference
bindExpression(FromList fromList, SubqueryList subqueryList, java.util.List<AggregateNode> aggregates)
Bind this expression.(package private) boolean
categorize(JBitSet referencedTabs, boolean simplePredsOnly)
Categorize this predicate.(package private) boolean
constantExpression(PredicateList whereClause)
Return whether or not this expression tree represents a constant value.(package private) void
copyFields(ColumnReference oldCR)
Copy all of the "appropriate fields" for a shallow copy.(package private) void
generateExpression(ExpressionClassBuilder acb, MethodBuilder mb)
ColumnReference's are to the current row in the system.(package private) ValueNode
getClone()
Return a clone of this node.java.lang.String
getColumnName()
Get the name of this column(package private) int
getColumnNumber()
Get the column number for this ColumnReference.(package private) boolean
getCorrelated()
Return whether or not this CR is correlated.(package private) boolean
getGeneratedToReplaceAggregate()
Determine whether or not this node was generated to replace an aggregate in the user's SELECT.(package private) boolean
getGeneratedToReplaceWindowFunctionCall()
Determine whether or not this node was generated to replace a window function call in the user's SELECT.(package private) int
getMergeTableID()
Get the MERGE table (SOURCE or TARGET) associated with this columnprivate int
getNestingLevel()
Get the nesting level for this CR.protected int
getOrderableVariantType()
Return the variant type for the underlying expression.TableName
getQualifiedTableName()
Return the table name as the node it is.(package private) java.lang.String
getSchemaName()
Get the user-supplied schema name of this column.(package private) ResultColumn
getSource()
Get the source this columnReference(package private) int
getSourceLevel()
Get the source level for this CR.(package private) ResultColumn
getSourceResultColumn()
Get the source for this ValueNode.protected ResultSetNode
getSourceResultSet(int[] colNum)
Find the source result set for this ColumnReference and return it.(package private) java.lang.String
getSourceSchemaName()
Get the name of the schema for the Column's base table, if any.(package private) java.lang.String
getSourceTableName()
Get the name of the underlying(base) table this column comes from, if any.(package private) java.lang.String
getSQLColumnName()
Get the column name for purposes of error messages or debugging.(package private) java.lang.String
getTableName()
Get the user-supplied table name of this column.(package private) int
getTableNumber()
Get the table number for this ColumnReference.(package private) void
getTablesReferenced(JBitSet refs)
Update the table map to reflect the source of this CR.(package private) DataTypeDescriptor
getTypeServices()
The type of a ColumnReference is the type of its source unless the source is null then it is the type that has been set on this node.protected boolean
hasBeenRemapped()
Returns true if this ColumnReference has been remapped; false otherwise.(package private) boolean
isCloneable()
Return whether or not this expression tree is cloneable.(package private) boolean
isEquivalent(ValueNode o)
Tests if this node is equivalent to the specified ValueNode.protected boolean
isScoped()
Return whether or not this ColumnReference is scoped.protected void
markAsScoped()
Mark this column reference as "scoped", which means that it was created (as a clone of another ColumnReference) to serve as the left or right operand of a scoped predicate.(package private) void
markGeneratedToReplaceAggregate()
Mark this node as being generated to replace an aggregate.(package private) void
markGeneratedToReplaceWindowFunctionCall()
Mark this node as being generated to replace a window function call.(package private) boolean
pointsToColumnReference()
Return whether or not the source of this ColumnReference is itself a ColumnReference.private java.lang.String
prettyPrintMergeTableID(int mergeTableID)
(package private) void
printSubNodes(int depth)
Prints the sub-nodes of this object.(package private) ValueNode
putAndsOnTop()
Do the 1st step in putting an expression into conjunctive normal form.(package private) void
remapColumnReferences()
Remap all of the ColumnReferences in this expression tree to point to the ResultColumn that is 1 level under their current source ResultColumn.(package private) ValueNode
remapColumnReferencesToExpressions()
Remap all ColumnReferences in this tree to be clones of the underlying expression.(package private) void
setColumnNumber(int colNum)
Set the column number for this ColumnReference.(package private) void
setMergeTableID(int mergeTableID)
Associate this column with a SOURCE or TARGET table of a MERGE statement(package private) void
setNestingLevel(int nestingLevel)
Set the nesting level for this CR.(package private) void
setQualifiedTableName(TableName tableName)
(package private) void
setSource(ResultColumn source)
Set the source this columnReference(package private) void
setSourceLevel(int sourceLevel)
Set the source level for this CR.(package private) void
setTableNumber(int tableNumber)
Set this ColumnReference to refer to the given table number.java.lang.String
toString()
Convert this object to a String.(package private) void
unRemapColumnReferences()
boolean
updatableByCursor()
Is the column wirtable by the cursor or not.-
Methods inherited from class org.apache.derby.impl.sql.compile.ValueNode
bindExpression, changeToCNF, checkIsBoolean, checkTopPredicatesForEqualsConditions, copyFields, eliminateNots, evaluateConstantExpressions, genEqualsFalseTree, generate, genIsNullTree, genSQLJavaSQLTree, getConstantValueAsObject, getDataValueFactory, getTablesReferenced, getTransformed, getTypeCompiler, getTypeId, isBinaryEqualsOperatorNode, isBooleanFalse, isBooleanTrue, isConstantExpression, isInListProbeNode, isParameterNode, isRelationalOperator, isSameNodeKind, optimizableEqualityNode, preprocess, requiresTypeFromContext, selectivity, setCollationInfo, setCollationInfo, setCollationUsingCompilationSchema, setCollationUsingCompilationSchema, setNullability, setTransformed, setType, setType, setType, verifyChangeToCNF, verifyEliminateNots, verifyPutAndsOnTop
-
Methods inherited from class org.apache.derby.impl.sql.compile.QueryTreeNode
accept, addTag, addUDTUsagePriv, addUDTUsagePriv, bindOffsetFetch, bindRowMultiSet, bindUserCatalogType, bindUserType, checkReliability, checkReliability, convertDefaultNode, copyTagsFrom, createTypeDependency, debugFlush, debugPrint, disablePrivilegeCollection, formatNodeString, generateAuthorizeCheck, getBeginOffset, getClassFactory, getCompilerContext, getContext, getContextManager, getDataDictionary, getDependencyManager, getEndOffset, getExecutionFactory, getGenericConstantActionFactory, getIntProperty, getLanguageConnectionContext, getLongProperty, getNullNode, getOffsetOrderedNodes, getOptimizerFactory, getOptimizerTracer, getParameterTypes, getSchemaDescriptor, getSchemaDescriptor, getStatementType, getTableDescriptor, getTypeCompiler, getUDTDesc, isAtomic, isPrivilegeCollectionRequired, isSessionSchema, isSessionSchema, makeConstantAction, makeTableName, makeTableName, nodeHeader, optimizerTracingIsOn, orReliability, parseSearchCondition, parseStatement, printLabel, referencesSessionSchema, resolveTableToSynonym, setBeginOffset, setEndOffset, setRefActionInfo, stackPrint, taggedWith, treePrint, treePrint, verifyClassExist
-
-
-
-
Field Detail
-
MERGE_UNKNOWN
public static final int MERGE_UNKNOWN
- See Also:
- Constant Field Values
-
MERGE_SOURCE
public static final int MERGE_SOURCE
- See Also:
- Constant Field Values
-
MERGE_TARGET
public static final int MERGE_TARGET
- See Also:
- Constant Field Values
-
_columnName
private java.lang.String _columnName
-
_qualifiedTableName
private TableName _qualifiedTableName
-
tableNumber
private int tableNumber
The FromTable this column reference is bound to.
-
columnNumber
private int columnNumber
The column number in the underlying FromTable. But notesource
.- See Also:
source
-
source
private ResultColumn source
This is where the value for this column reference will be coming from. Note that for join nodes,tableNumber
/columnNumber
will point to the column in the left or right join participantFromTable
, whereassource
will be bound to the RC in the result column list of the join node. See also the comment at the end of JoinNode#getMatchingColumn.
-
_origSource
private ResultColumn _origSource
-
origName
private java.lang.String origName
-
_origTableNumber
private int _origTableNumber
-
_origColumnNumber
private int _origColumnNumber
-
tableNumberBeforeFlattening
private int tableNumberBeforeFlattening
-
columnNumberBeforeFlattening
private int columnNumberBeforeFlattening
-
replacesAggregate
private boolean replacesAggregate
-
replacesWindowFunctionCall
private boolean replacesWindowFunctionCall
-
nestingLevel
private int nestingLevel
-
sourceLevel
private int sourceLevel
-
scoped
private boolean scoped
-
remaps
private java.util.ArrayList<ColumnReference.RemapInfo> remaps
-
_mergeTableID
private int _mergeTableID
Columns mentioned by MERGE statements need to be associated the SOURCE or TARGET table
-
-
Constructor Detail
-
ColumnReference
ColumnReference(java.lang.String columnName, TableName tableName, int tokBeginOffset, int tokEndOffset, ContextManager cm)
Constructor. This one is called by the parser where we could be dealing with delimited identifiers.- Parameters:
columnName
- The name of the column being referencedtableName
- The qualification for the columntokBeginOffset
- begin position of token for the column name identifier from parser.tokEndOffset
- end position of token for the column name identifier from parser.cm
- The context manager
-
ColumnReference
ColumnReference(java.lang.String columnName, TableName tableName, ContextManager cm)
Constructor.- Parameters:
columnName
- The name of the column being referencedtableName
- The qualification for the columncm
- The context manager
-
-
Method Detail
-
toString
public java.lang.String toString()
Convert this object to a String. See comments in QueryTreeNode.java for how this should be done for tree printing.
-
printSubNodes
void printSubNodes(int depth)
Prints the sub-nodes of this object. See QueryTreeNode.java for how tree printing is supposed to work.- Overrides:
printSubNodes
in classQueryTreeNode
- Parameters:
depth
- The depth of this node in the tree
-
getCorrelated
boolean getCorrelated()
Return whether or not this CR is correlated.- Returns:
- Whether or not this CR is correlated.
-
setNestingLevel
void setNestingLevel(int nestingLevel)
Set the nesting level for this CR. (The nesting level at which the CR appears.)- Parameters:
nestingLevel
- The Nesting level at which the CR appears.
-
getNestingLevel
private int getNestingLevel()
Get the nesting level for this CR.- Returns:
- The nesting level for this CR.
-
setSourceLevel
void setSourceLevel(int sourceLevel)
Set the source level for this CR. (The nesting level of the source of the CR.)- Parameters:
sourceLevel
- The Nesting level of the source of the CR.
-
getSourceLevel
int getSourceLevel()
Get the source level for this CR.- Returns:
- The source level for this CR.
-
markGeneratedToReplaceAggregate
void markGeneratedToReplaceAggregate()
Mark this node as being generated to replace an aggregate. (Useful for replacing aggregates in the HAVING clause with column references to the matching aggregate in the user's SELECT.
-
markGeneratedToReplaceWindowFunctionCall
void markGeneratedToReplaceWindowFunctionCall()
Mark this node as being generated to replace a window function call.
-
getGeneratedToReplaceAggregate
boolean getGeneratedToReplaceAggregate()
Determine whether or not this node was generated to replace an aggregate in the user's SELECT.- Returns:
- boolean Whether or not this node was generated to replace an aggregate in the user's SELECT.
-
getGeneratedToReplaceWindowFunctionCall
boolean getGeneratedToReplaceWindowFunctionCall()
Determine whether or not this node was generated to replace a window function call in the user's SELECT.- Returns:
- boolean Whether or not this node was generated to replace a window function call in the user's SELECT.
-
getClone
ValueNode getClone() throws StandardException
Return a clone of this node.- Overrides:
getClone
in classValueNode
- Returns:
- ValueNode A clone of this node.
- Throws:
StandardException
- Thrown on error
-
copyFields
void copyFields(ColumnReference oldCR) throws StandardException
Copy all of the "appropriate fields" for a shallow copy.- Parameters:
oldCR
- The ColumnReference to copy from.- Throws:
StandardException
- Thrown on error
-
bindExpression
ColumnReference bindExpression(FromList fromList, SubqueryList subqueryList, java.util.List<AggregateNode> aggregates) throws StandardException
Bind this expression. This means binding the sub-expressions, as well as figuring out what the return type is for this expression. NOTE: We must explicitly check for a null FromList here, column reference without a FROM list, as the grammar allows the following: insert into t1 values(c1)- Overrides:
bindExpression
in classValueNode
- Parameters:
fromList
- The FROM list for the query this expression is in, for binding columns.subqueryList
- The subquery list being built as we find SubqueryNodesaggregates
- The aggregate list being built as we find AggregateNodes- Returns:
- The new top of the expression tree.
- Throws:
StandardException
- Thrown on error
-
getSQLColumnName
java.lang.String getSQLColumnName()
Get the column name for purposes of error messages or debugging. This returns the column name as used in the SQL statement. Thus if it was qualified with a table, alias name that will be included.- Returns:
- The column name in the form [[schema.]table.]column
-
getColumnName
public java.lang.String getColumnName()
Get the name of this column- Overrides:
getColumnName
in classValueNode
- Returns:
- The name of this column
-
getTableNumber
int getTableNumber()
Get the table number for this ColumnReference.- Returns:
- int The table number for this ColumnReference
-
setTableNumber
void setTableNumber(int tableNumber)
Set this ColumnReference to refer to the given table number.- Parameters:
tableNumber
- The table number this ColumnReference will refer to
-
getTableName
java.lang.String getTableName()
Get the user-supplied table name of this column. This will be null if the user did not supply a name (for example, select a from t). The method will return B for this example, select b.a from t as b The method will return T for this example, select t.a from t- Overrides:
getTableName
in classValueNode
- Returns:
- The user-supplied name of this column. Null if no user- supplied name.
-
getSourceTableName
java.lang.String getSourceTableName()
Get the name of the underlying(base) table this column comes from, if any. Following example queries will all return T select a from t select b.a from t as b select t.a from t- Returns:
- The name of the base table that this column comes from. Null if not a ColumnReference.
-
getSourceSchemaName
java.lang.String getSourceSchemaName() throws StandardException
Get the name of the schema for the Column's base table, if any. Following example queries will all return APP (assuming user is in schema APP) select t.a from t select b.a from t as b select app.t.a from t- Returns:
- The name of the schema for Column's base table. If the column is not in a schema (i.e. is a derived column), it returns NULL.
- Throws:
StandardException
-
updatableByCursor
public boolean updatableByCursor()
Is the column wirtable by the cursor or not. (ie, is it in the list of FOR UPDATE columns list)- Overrides:
updatableByCursor
in classValueNode
- Returns:
- TRUE, if the column is a base column of a table and is writable by cursor.
-
getQualifiedTableName
public TableName getQualifiedTableName()
Return the table name as the node it is.- Returns:
- the column's table name.
-
setQualifiedTableName
void setQualifiedTableName(TableName tableName)
-
getColumnNumber
int getColumnNumber()
Get the column number for this ColumnReference.- Returns:
- int The column number for this ColumnReference
-
setColumnNumber
void setColumnNumber(int colNum)
Set the column number for this ColumnReference. This is used when scoping predicates for pushdown.- Parameters:
colNum
- The new column number.
-
getSource
ResultColumn getSource()
Get the source this columnReference- Returns:
- The source of this columnReference
-
setSource
void setSource(ResultColumn source)
Set the source this columnReference- Parameters:
source
- The source of this columnReference
-
putAndsOnTop
ValueNode putAndsOnTop() throws StandardException
Do the 1st step in putting an expression into conjunctive normal form. This step ensures that the top level of the expression is a chain of AndNodes.- Overrides:
putAndsOnTop
in classValueNode
- Returns:
- The modified expression
- Throws:
StandardException
- Thrown on error
-
categorize
boolean categorize(JBitSet referencedTabs, boolean simplePredsOnly)
Categorize this predicate. Initially, this means building a bit map of the referenced tables for each predicate. If the source of this ColumnReference (at the next underlying level) is not a ColumnReference or a VirtualColumnNode then this predicate will not be pushed down. For example, in: select * from (select 1 from s) a (x) where x = 1 we will not push down x = 1. NOTE: It would be easy to handle the case of a constant, but if the inner SELECT returns an arbitrary expression, then we would have to copy that tree into the pushed predicate, and that tree could contain subqueries and method calls. Also, don't allow a predicate to be pushed down if it contains a ColumnReference that replaces an aggregate. This can happen if the aggregate is in the HAVING clause. In this case, we would be pushing the predicate into the SelectNode that evaluates the aggregate, which doesn't make sense, since the having clause is supposed to be applied to the result of the SelectNode. This also goes for column references that replaces a window function. RESOLVE - revisit this issue once we have views.- Overrides:
categorize
in classValueNode
- Parameters:
referencedTabs
- JBitSet with bit map of referenced FromTablessimplePredsOnly
- Whether or not to consider method calls, field references and conditional nodes when building bit map- Returns:
- boolean Whether or not source.expression is a ColumnReference or a VirtualColumnNode or a ConstantNode.
-
remapColumnReferences
void remapColumnReferences()
Remap all of the ColumnReferences in this expression tree to point to the ResultColumn that is 1 level under their current source ResultColumn. This is useful for pushing down single table predicates. RESOLVE: Once we start pushing join clauses, we will need to walk the ResultColumn/VirtualColumnNode chain for them to remap the references.
-
unRemapColumnReferences
void unRemapColumnReferences()
-
hasBeenRemapped
protected boolean hasBeenRemapped()
Returns true if this ColumnReference has been remapped; false otherwise.- Returns:
- Whether or not this ColumnReference has been remapped.
-
getSourceResultColumn
ResultColumn getSourceResultColumn()
Description copied from class:ValueNode
Get the source for this ValueNode.- Overrides:
getSourceResultColumn
in classValueNode
- Returns:
- The source of this ValueNode, null if this node is not sourced by a column.
-
remapColumnReferencesToExpressions
ValueNode remapColumnReferencesToExpressions() throws StandardException
Remap all ColumnReferences in this tree to be clones of the underlying expression.- Overrides:
remapColumnReferencesToExpressions
in classValueNode
- Returns:
- ValueNode The remapped expression tree.
- Throws:
StandardException
- Thrown on error
-
getTablesReferenced
void getTablesReferenced(JBitSet refs)
Update the table map to reflect the source of this CR.- Parameters:
refs
- The table map.
-
isCloneable
boolean isCloneable()
Return whether or not this expression tree is cloneable.- Overrides:
isCloneable
in classValueNode
- Returns:
- boolean Whether or not this expression tree is cloneable.
-
constantExpression
boolean constantExpression(PredicateList whereClause)
Description copied from class:ValueNode
Return whether or not this expression tree represents a constant value. In this case, "constant" means that it will always evaluate to the same thing, even if it includes columns. A column is constant if it is compared to a constant expression.- Overrides:
constantExpression
in classValueNode
- Returns:
- True means this expression tree represents a constant value.
- See Also:
ValueNode.constantExpression(org.apache.derby.impl.sql.compile.PredicateList)
-
generateExpression
void generateExpression(ExpressionClassBuilder acb, MethodBuilder mb) throws StandardException
ColumnReference's are to the current row in the system. This lets us generate a faster get that simply returns the column from the current row, rather than getting the value out and returning that, only to have the caller (in the situations needed) stuffing it back into a new column holder object. We will assume the general generate() path is for getting the value out, and use generateColumn() when we want to keep the column wrapped.- Overrides:
generateExpression
in classValueNode
- Parameters:
acb
- The ExpressionClassBuilder for the class being builtmb
- The method the expression will go into- Throws:
StandardException
- Thrown on error
-
getSchemaName
java.lang.String getSchemaName()
Get the user-supplied schema name of this column. This will be null if the user did not supply a name (for example, select t.a from t). Another example for null return value (for example, select b.a from t as b). But for following query select app.t.a from t, this will return APP Code generation of aggregate functions relies on this method- Overrides:
getSchemaName
in classValueNode
- Returns:
- The user-supplied schema name of this column. Null if no user- supplied name.
-
getOrderableVariantType
protected int getOrderableVariantType()
Return the variant type for the underlying expression. The variant type can be: VARIANT - variant within a scan (method calls and non-static field access) SCAN_INVARIANT - invariant within a scan (column references from outer tables) QUERY_INVARIANT - invariant within the life of a query (constant expressions)- Overrides:
getOrderableVariantType
in classValueNode
- Returns:
- The variant type for the underlying expression.
-
pointsToColumnReference
boolean pointsToColumnReference()
Return whether or not the source of this ColumnReference is itself a ColumnReference.- Returns:
- Whether or not the source of this ColumnReference is itself a ColumnReference.
-
getTypeServices
DataTypeDescriptor getTypeServices()
The type of a ColumnReference is the type of its source unless the source is null then it is the type that has been set on this node.- Overrides:
getTypeServices
in classValueNode
- Returns:
- The DataTypeServices from this ValueNode. This may be null if the node isn't bound yet.
-
getSourceResultSet
protected ResultSetNode getSourceResultSet(int[] colNum) throws StandardException
Find the source result set for this ColumnReference and return it. Also, when the source result set is found, return the position (within the source result set's RCL) of the column referenced by this ColumnReference. The position is returned vai the colNum parameter.- Parameters:
colNum
- Place to store the position of the column to which this ColumnReference points (position is w.r.t the source result set).- Returns:
- The source result set for this ColumnReference; null if there is no source result set.
- Throws:
StandardException
-
isEquivalent
boolean isEquivalent(ValueNode o) throws StandardException
Description copied from class:ValueNode
Tests if this node is equivalent to the specified ValueNode. Two ValueNodes are considered equivalent if they will evaluate to the same value during query execution.This method provides basic expression matching facility for the derived class of ValueNode and it is used by the language layer to compare the node structural form of the two expressions for equivalence at bind phase.
Note that it is not comparing the actual row values at runtime to produce a result; hence, when comparing SQL NULLs, they are considered to be equivalent and not unknown.
One usage case of this method in this context is to compare the select column expression against the group by expression to check if they are equivalent. e.g.:
SELECT c1+c2 FROM t1 GROUP BY c1+c2
In general, node equivalence is determined by the derived class of ValueNode. But they generally abide to the rules below:
- The two ValueNodes must be of the same node type to be considered equivalent. e.g.: CastNode vs. CastNode - equivalent (if their args also match), ColumnReference vs CastNode - not equivalent.
- If node P contains other ValueNode(s) and so on, those node(s) must also be of the same node type to be considered equivalent.
- If node P takes a parameter list, then the number of arguments and its arguments for the two nodes must also match to be considered equivalent. e.g.: CAST(c1 as INTEGER) vs CAST(c1 as SMALLINT), they are not equivalent.
- When comparing SQL NULLs in this context, they are considered to be equivalent.
- If this does not apply or it is determined that the two nodes are not equivalent then the derived class of this method should return false; otherwise, return true.
- Specified by:
isEquivalent
in classValueNode
- Parameters:
o
- the node to compare this ValueNode against.- Returns:
true
if the two nodes are equivalent,false
otherwise.- Throws:
StandardException
-
markAsScoped
protected void markAsScoped()
Mark this column reference as "scoped", which means that it was created (as a clone of another ColumnReference) to serve as the left or right operand of a scoped predicate.
-
isScoped
protected boolean isScoped()
Return whether or not this ColumnReference is scoped.
-
setMergeTableID
void setMergeTableID(int mergeTableID)
Associate this column with a SOURCE or TARGET table of a MERGE statement
-
prettyPrintMergeTableID
private java.lang.String prettyPrintMergeTableID(int mergeTableID)
-
getMergeTableID
int getMergeTableID()
Get the MERGE table (SOURCE or TARGET) associated with this column
-
acceptChildren
void acceptChildren(Visitor v) throws StandardException
Description copied from class:QueryTreeNode
Accept a visitor on all child nodes. All sub-classes that add fields that should be visited, should override this method and callaccept(v)
on all visitable fields, as well assuper.acceptChildren(v)
to make sure all visitable fields defined by the super-class are accepted too.- Overrides:
acceptChildren
in classQueryTreeNode
- Parameters:
v
- the visitor- Throws:
StandardException
- on errors raised by the visitor
-
-