| Modifier and Type | Class and Description |
|---|---|
| private static class | ColumnReference.
Helper class to keep track of remap data when a ColumnReference is remapped multiple times. |
| Modifier and Type | Field and Description |
|---|---|
| private String | |
| private int | _mergeTableID
Columns mentioned by MERGE statements need to be associated the SOURCE or TARGET table |
| private int | |
| private ResultColumn | |
| private int | |
| private TableName | |
| private int | columnNumber
The column number in the underlying FromTable. |
| private int | |
| public static final int | |
| public static final int | |
| public static final int | |
| private int | |
| private String | |
| private ArrayList | |
| private boolean | |
| private boolean | |
| private boolean | |
| private ResultColumn | source
This is where the value for this column reference will be coming from. |
| private int | |
| private int | tableNumber
The FromTable this column reference is bound to. |
| private int |
| Access | Constructor and Description |
|---|---|
| pack-priv | ColumnReference(String
The name of the column being referenced columnName, TableName The qualification for the column tableName, int begin position of token for the column name
identifier from parser. tokBeginOffset, int end position of token for the column name
identifier from parser. tokEndOffset, ContextManager The context manager cm)Constructor. |
| pack-priv | ColumnReference(String
The name of the column being referenced columnName, TableName The qualification for the column tableName, ContextManager The context manager cm)Constructor. |
| Modifier and Type | Method and Description |
|---|---|
| pack-priv void | acceptChildren(Visitor
the visitor v)Overrides org. Accept a visitor on all child nodes. |
| pack-priv ColumnReference | Returns: The new top of the expression tree.The FROM list for the query this
expression is in, for binding columns. fromList, SubqueryList The subquery list being built as we find SubqueryNodes subqueryList, List<AggregateNode> The aggregate list being built as we find AggregateNodes aggregates)Overrides org. Bind this expression. |
| pack-priv boolean | Returns: boolean Whether or not source.expression is a ColumnReference or a VirtualColumnNode or a ConstantNode.JBitSet with bit map of referenced FromTables referencedTabs, boolean Whether or not to consider method
calls, field references and conditional nodes
when building bit map simplePredsOnly)Overrides org. Categorize this predicate. |
| pack-priv boolean | constantExpression(PredicateList whereClause)
Overrides org. Return whether or not this expression tree represents a constant value. |
| pack-priv void | copyFields(ColumnReference
The ColumnReference to copy from. oldCR)Copy all of the "appropriate fields" for a shallow copy. |
| pack-priv void | generateExpression(ExpressionClassBuilder
The ExpressionClassBuilder for the class being built acb, MethodBuilder The method the expression will go into mb)Overrides org. ColumnReference's are to the current row in the system. |
| pack-priv ValueNode | Returns: ValueNode A clone of this node.Overrides org. Return a clone of this node. |
| public String | Returns: The name of this columnOverrides org. Get the name of this column |
| pack-priv int | Returns: int The column number for this ColumnReferenceGet the column number for this ColumnReference. |
| pack-priv boolean | Returns: Whether or not this CR is correlated.Return whether or not this CR is correlated. |
| pack-priv boolean | Returns: boolean Whether or not this node was generated to replace an aggregate in the user's SELECT.Determine whether or not this node was generated to replace an aggregate in the user's SELECT. |
| pack-priv boolean | Returns: boolean Whether or not this node was generated to replace a window function call in the user's SELECT.Determine whether or not this node was generated to replace a window function call in the user's SELECT. |
| pack-priv int | |
| private int | |
| protected int | Returns: The variant type for the underlying expression.Overrides org. Return the variant type for the underlying expression. |
| public TableName | |
| pack-priv String | Returns: The user-supplied schema name of this column. Null if no user- supplied name.Overrides org. Get the user-supplied schema name of this column. |
| pack-priv ResultColumn | |
| pack-priv int | |
| pack-priv ResultColumn | getSourceResultColumn()
Overrides org. Get the source for this ValueNode. |
| protected ResultSetNode | Returns: The source result set for this ColumnReference; null if there is no source result set.Place to store the position of the column
to which this ColumnReference points (position is w.r.t
the source result set). colNum)Find the source result set for this ColumnReference and return it. |
| pack-priv String | 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.Get the name of the schema for the Column's base table, if any. |
| pack-priv String | Returns: The name of the base table that this column comes from. Null if not a ColumnReference.Get the name of the underlying(base) table this column comes from, if any. |
| pack-priv String | Returns: The column name in the form [[schema.]table.]columnGet the column name for purposes of error messages or debugging. |
| pack-priv String | Returns: The user-supplied name of this column. Null if no user- supplied name.Overrides org. Get the user-supplied table name of this column. |
| pack-priv int | Returns: int The table number for this ColumnReferenceGet the table number for this ColumnReference. |
| pack-priv void | getTablesReferenced(JBitSet
The table map. refs)Update the table map to reflect the source of this CR. |
| pack-priv DataTypeDescriptor | getTypeServices()
Overrides org. 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 | Returns: Whether or not this ColumnReference has been remapped.Returns true if this ColumnReference has been remapped; false otherwise. |
| pack-priv boolean | Returns: boolean Whether or not this expression tree is cloneable.Overrides org. Return whether or not this expression tree is cloneable. |
| pack-priv boolean | isEquivalent(ValueNode
the node to compare this ValueNode against. o)Implements abstract org. Tests if this node is equivalent to the specified ValueNode. |
| protected boolean | |
| 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. |
| pack-priv void | |
| pack-priv void | markGeneratedToReplaceWindowFunctionCall()
Mark this node as being generated to replace a window function call. |
| pack-priv boolean | Returns: Whether or not the source of this ColumnReference is itself a ColumnReference.Return whether or not the source of this ColumnReference is itself a ColumnReference. |
| private String | |
| pack-priv void | printSubNodes(int
The depth of this node in the tree depth)Overrides org. Prints the sub-nodes of this object. |
| pack-priv ValueNode | Returns: The modified expressionOverrides org. Do the 1st step in putting an expression into conjunctive normal form. |
| pack-priv 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. |
| pack-priv ValueNode | Returns: ValueNode The remapped expression tree.Overrides org. Remap all ColumnReferences in this tree to be clones of the underlying expression. |
| pack-priv void | |
| pack-priv void | setMergeTableID(int mergeTableID)
Associate this column with a SOURCE or TARGET table of a MERGE statement |
| pack-priv void | setNestingLevel(int
The Nesting level at which the CR appears. nestingLevel)Set the nesting level for this CR. |
| pack-priv void | |
| pack-priv void | |
| pack-priv void | setSourceLevel(int
The Nesting level of the source of the CR. sourceLevel)Set the source level for this CR. |
| pack-priv void | setTableNumber(int
The table number this ColumnReference will refer to tableNumber)Set this ColumnReference to refer to the given table number. |
| public String | Returns: This object as a StringOverrides org. Convert this object to a String. |
| pack-priv void | |
| public boolean | Returns: TRUE, if the column is a base column of a table and is writable by cursor.Overrides org. Is the column wirtable by the cursor or not. |
| _columnName | back to summary |
|---|---|
| private String _columnName | |
| _mergeTableID | back to summary |
|---|---|
| private int _mergeTableID Columns mentioned by MERGE statements need to be associated the SOURCE or TARGET table | |
| _origColumnNumber | back to summary |
|---|---|
| private int _origColumnNumber | |
| _origSource | back to summary |
|---|---|
| private ResultColumn _origSource | |
| _origTableNumber | back to summary |
|---|---|
| private int _origTableNumber | |
| _qualifiedTableName | back to summary |
|---|---|
| private TableName _qualifiedTableName | |
| columnNumber | back to summary |
|---|---|
| private int columnNumber The column number in the underlying FromTable. But note
| |
| columnNumberBeforeFlattening | back to summary |
|---|---|
| private int columnNumberBeforeFlattening | |
| MERGE_SOURCE | back to summary |
|---|---|
| public static final int MERGE_SOURCE | |
| MERGE_TARGET | back to summary |
|---|---|
| public static final int MERGE_TARGET | |
| MERGE_UNKNOWN | back to summary |
|---|---|
| public static final int MERGE_UNKNOWN | |
| nestingLevel | back to summary |
|---|---|
| private int nestingLevel | |
| origName | back to summary |
|---|---|
| private String origName | |
| remaps | back to summary |
|---|---|
| private ArrayList<ColumnReference. | |
| replacesAggregate | back to summary |
|---|---|
| private boolean replacesAggregate | |
| replacesWindowFunctionCall | back to summary |
|---|---|
| private boolean replacesWindowFunctionCall | |
| scoped | back to summary |
|---|---|
| private boolean scoped | |
| source | back to summary |
|---|---|
| private ResultColumn source This is where the value for this column reference will be coming from.
Note that for join nodes,
| |
| sourceLevel | back to summary |
|---|---|
| private int sourceLevel | |
| tableNumber | back to summary |
|---|---|
| private int tableNumber The FromTable this column reference is bound to. | |
| tableNumberBeforeFlattening | back to summary |
|---|---|
| private int tableNumberBeforeFlattening | |
| ColumnReference | back to summary |
|---|---|
| pack-priv ColumnReference(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.
| |
| ColumnReference | back to summary |
|---|---|
| pack-priv ColumnReference(String columnName, TableName tableName, ContextManager cm) Constructor.
| |
| acceptChildren | back to summary |
|---|---|
| pack-priv void acceptChildren(Visitor v) throws StandardException Overrides org. Doc from org. Accept a visitor on all child nodes. All sub-classes that add fields
that should be visited, should override this method and call
| |
| bindExpression | back to summary |
|---|---|
| pack-priv ColumnReference bindExpression(FromList fromList, SubqueryList subqueryList, List<AggregateNode> aggregates) throws StandardException Overrides org. 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)
| |
| categorize | back to summary |
|---|---|
| pack-priv boolean categorize(JBitSet referencedTabs, boolean simplePredsOnly) Overrides org. 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.
| |
| constantExpression | back to summary |
|---|---|
| pack-priv boolean constantExpression(PredicateList whereClause) Overrides org. Doc from org. 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.
| |
| copyFields | back to summary |
|---|---|
| pack-priv void copyFields(ColumnReference oldCR) throws StandardException Copy all of the "appropriate fields" for a shallow copy.
| |
| generateExpression | back to summary |
|---|---|
| pack-priv void generateExpression(ExpressionClassBuilder acb, MethodBuilder mb) throws StandardException Overrides org. 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.
| |
| getClone | back to summary |
|---|---|
| pack-priv ValueNode getClone() throws StandardException Overrides org. Return a clone of this node.
| |
| getColumnName | back to summary |
|---|---|
| public String getColumnName() Overrides org. Get the name of this column | |
| getColumnNumber | back to summary |
|---|---|
| pack-priv int getColumnNumber() Get the column number for this ColumnReference.
| |
| getCorrelated | back to summary |
|---|---|
| pack-priv boolean getCorrelated() Return whether or not this CR is correlated.
| |
| getGeneratedToReplaceAggregate | back to summary |
|---|---|
| pack-priv boolean getGeneratedToReplaceAggregate() Determine whether or not this node was generated to replace an aggregate in the user's SELECT.
| |
| getGeneratedToReplaceWindowFunctionCall | back to summary |
|---|---|
| pack-priv boolean getGeneratedToReplaceWindowFunctionCall() Determine whether or not this node was generated to replace a window function call in the user's SELECT.
| |
| getMergeTableID | back to summary |
|---|---|
| pack-priv int getMergeTableID() Get the MERGE table (SOURCE or TARGET) associated with this column | |
| getNestingLevel | back to summary |
|---|---|
| private int getNestingLevel() Get the nesting level for this CR.
| |
| getOrderableVariantType | back to summary |
|---|---|
| protected int getOrderableVariantType() Overrides org. 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)
| |
| getQualifiedTableName | back to summary |
|---|---|
| public TableName getQualifiedTableName() Return the table name as the node it is.
| |
| getSchemaName | back to summary |
|---|---|
| pack-priv String getSchemaName() Overrides org. 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 | |
| getSource | back to summary |
|---|---|
| pack-priv ResultColumn getSource() Get the source this columnReference
| |
| getSourceLevel | back to summary |
|---|---|
| pack-priv int getSourceLevel() Get the source level for this CR.
| |
| getSourceResultColumn | back to summary |
|---|---|
| pack-priv ResultColumn getSourceResultColumn() Overrides org. Doc from org. Get the source for this ValueNode.
| |
| getSourceResultSet | back to summary |
|---|---|
| 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.
| |
| getSourceSchemaName | back to summary |
|---|---|
| pack-priv 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
| |
| getSourceTableName | back to summary |
|---|---|
| pack-priv 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
| |
| getSQLColumnName | back to summary |
|---|---|
| pack-priv 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.
| |
| getTableName | back to summary |
|---|---|
| pack-priv String getTableName() Overrides org. 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 | |
| getTableNumber | back to summary |
|---|---|
| pack-priv int getTableNumber() Get the table number for this ColumnReference.
| |
| getTablesReferenced | back to summary |
|---|---|
| pack-priv void getTablesReferenced(JBitSet refs) Update the table map to reflect the source of this CR.
| |
| getTypeServices | back to summary |
|---|---|
| pack-priv DataTypeDescriptor getTypeServices() Overrides org. 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.
| |
| hasBeenRemapped | back to summary |
|---|---|
| protected boolean hasBeenRemapped() Returns true if this ColumnReference has been remapped; false otherwise.
| |
| isCloneable | back to summary |
|---|---|
| pack-priv boolean isCloneable() Overrides org. Return whether or not this expression tree is cloneable.
| |
| isEquivalent | back to summary |
|---|---|
| pack-priv boolean isEquivalent(ValueNode o) throws StandardException Implements abstract org. Doc from org. 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:
| |
| isScoped | back to summary |
|---|---|
| protected boolean isScoped() Return whether or not this ColumnReference is scoped. | |
| markAsScoped | back to summary |
|---|---|
| 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. | |
| markGeneratedToReplaceAggregate | back to summary |
|---|---|
| pack-priv 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 | back to summary |
|---|---|
| pack-priv void markGeneratedToReplaceWindowFunctionCall() Mark this node as being generated to replace a window function call. | |
| pointsToColumnReference | back to summary |
|---|---|
| pack-priv boolean pointsToColumnReference() Return whether or not the source of this ColumnReference is itself a ColumnReference.
| |
| prettyPrintMergeTableID | back to summary |
|---|---|
| private String prettyPrintMergeTableID(int mergeTableID) | |
| printSubNodes | back to summary |
|---|---|
| pack-priv void printSubNodes(int depth) Overrides org. Prints the sub-nodes of this object. See QueryTreeNode.java for how tree printing is supposed to work.
| |
| putAndsOnTop | back to summary |
|---|---|
| pack-priv ValueNode putAndsOnTop() throws StandardException Overrides org. 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.
| |
| remapColumnReferences | back to summary |
|---|---|
| pack-priv 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. | |
| remapColumnReferencesToExpressions | back to summary |
|---|---|
| pack-priv ValueNode remapColumnReferencesToExpressions() throws StandardException Overrides org. Remap all ColumnReferences in this tree to be clones of the underlying expression.
| |
| setColumnNumber | back to summary |
|---|---|
| pack-priv void setColumnNumber(int colNum) Set the column number for this ColumnReference. This is used when scoping predicates for pushdown.
| |
| setMergeTableID | back to summary |
|---|---|
| pack-priv void setMergeTableID(int mergeTableID) Associate this column with a SOURCE or TARGET table of a MERGE statement | |
| setNestingLevel | back to summary |
|---|---|
| pack-priv void setNestingLevel(int nestingLevel) Set the nesting level for this CR. (The nesting level at which the CR appears.)
| |
| setQualifiedTableName | back to summary |
|---|---|
| pack-priv void setQualifiedTableName(TableName tableName) | |
| setSource | back to summary |
|---|---|
| pack-priv void setSource(ResultColumn source) Set the source this columnReference
| |
| setSourceLevel | back to summary |
|---|---|
| pack-priv void setSourceLevel(int sourceLevel) Set the source level for this CR. (The nesting level of the source of the CR.)
| |
| setTableNumber | back to summary |
|---|---|
| pack-priv void setTableNumber(int tableNumber) Set this ColumnReference to refer to the given table number.
| |
| toString | back to summary |
|---|---|
| public String toString() Overrides org. Convert this object to a String. See comments in QueryTreeNode.java for how this should be done for tree printing. | |
| unRemapColumnReferences | back to summary |
|---|---|
| pack-priv void unRemapColumnReferences() | |
| updatableByCursor | back to summary |
|---|---|
| public boolean updatableByCursor() Overrides org. Is the column wirtable by the cursor or not. (ie, is it in the list of FOR UPDATE columns list)
| |
| Modifier and Type | Field and Description |
|---|---|
| pack-priv String | |
| pack-priv int | |
| pack-priv ResultColumn | |
| pack-priv int |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| pack-priv String | |
| pack-priv int | |
| pack-priv ResultColumn | |
| pack-priv int | |
| pack-priv void | |
| pack-priv void | |
| pack-priv void | |
| pack-priv void |
| colName | back to summary |
|---|---|
| pack-priv String colName | |
| colNum | back to summary |
|---|---|
| pack-priv int colNum | |
| source | back to summary |
|---|---|
| pack-priv ResultColumn source | |
| tableNum | back to summary |
|---|---|
| pack-priv int tableNum | |
| RemapInfo | back to summary |
|---|---|
| pack-priv RemapInfo(int cNum, int tNum, String cName, ResultColumn rc) | |
| getColumnName | back to summary |
|---|---|
| pack-priv String getColumnName() | |
| getColumnNumber | back to summary |
|---|---|
| pack-priv int getColumnNumber() | |
| getSource | back to summary |
|---|---|
| pack-priv ResultColumn getSource() | |
| getTableNumber | back to summary |
|---|---|
| pack-priv int getTableNumber() | |
| setColName | back to summary |
|---|---|
| pack-priv void setColName(String cName) | |
| setColNumber | back to summary |
|---|---|
| pack-priv void setColNumber(int cNum) | |
| setSource | back to summary |
|---|---|
| pack-priv void setSource(ResultColumn rc) | |
| setTableNumber | back to summary |
|---|---|
| pack-priv void setTableNumber(int tNum) | |