| Modifier and Type | Field and Description |
|---|---|
| private boolean | |
| pack-priv Optimizer | |
| pack-priv ResultSetNode | |
| private boolean | |
| pack-priv Optimizer | |
| pack-priv ResultSetNode |
| Access | Constructor and Description |
|---|---|
| pack-priv | TableOperatorNode(ResultSetNode
The ResultSetNode on the left side of this node leftResultSet, ResultSetNode The ResultSetNode on the right side of this node rightResultSet, Properties Properties list associated with the table tableProperties, ContextManager The context manager cm)Constructor for a TableOperatorNode. |
| Modifier and Type | Method and Description |
|---|---|
| pack-priv void | acceptChildren(Visitor
the visitor v)Overrides org. Accept the visitor for all visitable children of this node. |
| pack-priv void | adjustForSortElimination()
Overrides org. Notify the underlying result set tree that the optimizer has chosen to "eliminate" a sort. |
| pack-priv void | adjustForSortElimination(RequiredRowOrdering rowOrdering)
Overrides org. Same goal as adjustForSortElimination above, but this version takes a RequiredRowOrdering to allow nodes to adjust based on the ORDER BY clause, if needed. |
| pack-priv void | bindExpressions(FromList
FromList to use/append to. fromListParam)Overrides org. Bind the expressions under this TableOperatorNode. |
| pack-priv void | bindExpressionsWithTables(FromList
FromList to use/append to. fromListParam)Overrides org. Bind the expressions in this ResultSetNode if it has tables. |
| pack-priv ResultSetNode | Returns: ResultSetNode Returns this.The DataDictionary to use for binding dataDictionary, FromList FromList to use/append to. fromListParam)Overrides org. Bind the non VTI tables in this TableOperatorNode. |
| pack-priv void | bindResultColumns(FromList
FromList to use/append to. fromListParam)Overrides org. Bind the result columns of this ResultSetNode when there is no base table to bind them to. |
| pack-priv void | bindResultColumns(TableDescriptor
The TableDescriptor for the table being
updated or inserted into targetTableDescriptor, FromVTI targetVTI, ResultColumnList For INSERT statements, the user
does not have to supply column
names (for example, "insert into t
values (1,2,3)". When this
parameter is null, it means that
the user did not supply column
names, and so the binding should
be done based on order. When it
is not null, it means do the binding
by name, not position. targetColumnList, DMLStatementNode Calling DMLStatementNode (Insert or Update) statement, FromList FromList to use/append to. fromListParam)Overrides org. Bind the result columns for this ResultSetNode to a base table. |
| pack-priv void | bindUntypedNullsToResultColumns(ResultColumnList
The ResultColumnList with the types to bind nulls to rcl)Overrides org. DERBY-4365 Bind untyped nulls to the types in the given ResultColumnList. |
| pack-priv ResultSetNode | Returns: ResultSetNode Returns this.FromList to use/append to. fromListParam)Overrides org. Bind the VTI tables in this TableOperatorNode. |
| pack-priv void | decrementLevel(int
The amount to decrement by. decrement)Overrides org. Decrement (query block) level (0-based) for all of the tables in this ResultSet tree. |
| pack-priv String | Returns: The exposed name for this table.Overrides org. Return the exposed name for this table, which is the name that can be used to refer to this table in the rest of the query. |
| pack-priv FromTable | Returns: The FromTable, if any, with the exposed name.The specified name to search for as an exposed name. name, String Schema name, if non-null. schemaName, boolean Whether or not we need an exact match on specified schema and table
names or match on table id. exactMatch)Overrides org. Determine whether or not the specified name is an exposed name in the current query block. |
| pack-priv ResultSetNode | |
| pack-priv ResultSetNode | Returns: ResultSetNode The leftResultSet from this node.Get the leftResultSet from this node. |
| pack-priv ResultSetNode | Returns: ResultSetNode The rightResultSet from this node.Get the rightResultSet from this node. |
| public Optimizable | modifyAccessPath(JBitSet
Bit map of the tables that are outer to this one
in the join order. outerTables)Overrides org. Implements org. Modify the access path for this Optimizable, as necessary. |
| pack-priv ResultSetNode | modifyAccessPaths()
Overrides org. Modify the access paths according to the decisions the optimizer made. |
| pack-priv boolean | needsSpecialRCLBinding()
Overrides org. apparently something special needs to be done for me.... |
| pack-priv ResultSetNode | Returns: ResultSetNode The top of the optimized query treeThe DataDictionary to use for optimization dataDictionary, PredicateList The PredicateList to apply. predicateList, double The number of outer joining rows outerRows)Overrides org. Optimize a TableOperatorNode. |
| protected ResultSetNode | optimizeSource(Optimizer optimizer, ResultSetNode sourceResultSet, PredicateList predList, CostEstimate outerCost)
Optimize a source result set to this table operator. |
| pack-priv ResultSetNode | Returns: The generated ProjectRestrictNode atop the original FromTable.Number of tables in the DML Statement numTables, GroupByList The group by list, if any gbl, FromList The from list, if any fromList)Overrides org. Put a ProjectRestrictNode on top of each FromTable in the FromList. |
| 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 void | projectResultColumns()
Overrides org. Find the unreferenced result columns and project them out. |
| public boolean | Returns: true if references SESSION schema tables, else falseOverrides org. Return true if the node references SESSION schema tables (temporary or permanent) |
| pack-priv boolean | Returns: true if found, else falseTable name (String) to search for. name, boolean Whether or not name is for a base table baseTable)Overrides org. Search to see if a query references the specifed table name. |
| pack-priv void | rejectParameters()
Overrides org. Check for (and reject) ? |
| pack-priv void | |
| pack-priv void | setLevel(int
The query block level for this FromTable. level)Overrides org. Set the (query block) level (0-based) for this FromTable. |
| pack-priv void | setNestedInParens(boolean
Whether or not this node is nested in parens. nestedInParens)Mark whether or not this node is nested in parens. |
| pack-priv void | |
| public String | Returns: This object as a StringOverrides org. Convert this object to a String. |
| public void | updateBestPlanMap(short
Indicates whether we're adding, loading, or removing
a best plan for the OptimizerImpl/Optimizable. action, Object Object to use as the map key when adding/looking up
a plan. If it is an instance of OptimizerImpl then it corresponds
to an outer query; otherwise it's some Optimizable above this
Optimizable that could potentially reject plans chosen by the
OptimizerImpl to which this Optimizable belongs. planKey)Overrides org. Implements org. When remembering "truly the best" access path for an Optimizable, we have to keep track of which OptimizerImpl the "truly the best" access is for. |
| public void | verifyProperties(DataDictionary
The DataDictionary to use. dDictionary)Overrides org. Implements org. Verify that the Properties list with optimizer overrides, if specified, is valid |
| leftModifyAccessPathsDone | back to summary |
|---|---|
| private boolean leftModifyAccessPathsDone | |
| leftOptimizer | back to summary |
|---|---|
| pack-priv Optimizer leftOptimizer | |
| leftResultSet | back to summary |
|---|---|
| pack-priv ResultSetNode leftResultSet | |
| rightModifyAccessPathsDone | back to summary |
|---|---|
| private boolean rightModifyAccessPathsDone | |
| rightOptimizer | back to summary |
|---|---|
| pack-priv Optimizer rightOptimizer | |
| rightResultSet | back to summary |
|---|---|
| pack-priv ResultSetNode rightResultSet | |
| TableOperatorNode | back to summary |
|---|---|
| pack-priv TableOperatorNode(ResultSetNode leftResultSet, ResultSetNode rightResultSet, Properties tableProperties, ContextManager cm) throws StandardException Constructor for a TableOperatorNode.
| |
| acceptChildren | back to summary |
|---|---|
| pack-priv void acceptChildren(Visitor v) throws StandardException Overrides org. Accept the visitor for all visitable children of this node.
| |
| adjustForSortElimination | back to summary |
|---|---|
| pack-priv void adjustForSortElimination() Overrides org. Doc from org. Notify the underlying result set tree that the optimizer has chosen to "eliminate" a sort. Sort elimination can happen as part of preprocessing (see esp. SelectNode.preprocess(...)) or it can happen if the optimizer chooses an access path that inherently returns the rows in the correct order (also known as a "sort avoidance" plan). In either case we drop the sort and rely on the underlying result set tree to return its rows in the correct order. For most types of ResultSetNodes we automatically get the rows in the correct order if the sort was eliminated. One exception to this rule, though, is the case of an IndexRowToBaseRowNode, for which we have to disable bulk fetching on the underlying base table. Otherwise the index scan could return rows out of order if the base table is updated while the scan is "in progress" (i.e. while the result set is open). In order to account for this (and potentially other, similar issues in the future) this method exists to notify the result set node that it is expected to return rows in the correct order. The result set can then take necessary action to satsify this requirement--such as disabling bulk fetch in the case of IndexRowToBaseRowNode. All of that said, any ResultSetNodes for which we could potentially eliminate sorts should override this method accordingly. So we don't ever expect to get here.
| |
| adjustForSortElimination | back to summary |
|---|---|
| pack-priv void adjustForSortElimination(RequiredRowOrdering rowOrdering) throws StandardException Overrides org. Doc from org. Same goal as adjustForSortElimination above, but this version takes a RequiredRowOrdering to allow nodes to adjust based on the ORDER BY clause, if needed.
| |
| bindExpressions | back to summary |
|---|---|
| pack-priv void bindExpressions(FromList fromListParam) throws StandardException Overrides org. Bind the expressions under this TableOperatorNode. This means binding the sub-expressions, as well as figuring out what the return type is for each expression.
| |
| bindExpressionsWithTables | back to summary |
|---|---|
| pack-priv void bindExpressionsWithTables(FromList fromListParam) throws StandardException Overrides org. Bind the expressions in this ResultSetNode if it has tables. This means binding the sub-expressions, as well as figuring out what the return type is for each expression.
| |
| bindNonVTITables | back to summary |
|---|---|
| pack-priv ResultSetNode bindNonVTITables(DataDictionary dataDictionary, FromList fromListParam) throws StandardException Overrides org. Bind the non VTI tables in this TableOperatorNode. This means getting their TableDescriptors from the DataDictionary. We will build an unbound RCL for this node. This RCL must be "bound by hand" after the underlying left and right RCLs are bound.
| |
| bindResultColumns | back to summary |
|---|---|
| pack-priv void bindResultColumns(FromList fromListParam) throws StandardException Overrides org. Bind the result columns of this ResultSetNode when there is no base table to bind them to. This is useful for SELECT statements, where the result columns get their types from the expressions that live under them.
| |
| bindResultColumns | back to summary |
|---|---|
| pack-priv void bindResultColumns(TableDescriptor targetTableDescriptor, FromVTI targetVTI, ResultColumnList targetColumnList, DMLStatementNode statement, FromList fromListParam) throws StandardException Overrides org. Bind the result columns for this ResultSetNode to a base table. This is useful for INSERT and UPDATE statements, where the result columns get their types from the table being updated or inserted into. If a result column list is specified, then the verification that the result column list does not contain any duplicates will be done when binding them by name.
| |
| bindUntypedNullsToResultColumns | back to summary |
|---|---|
| pack-priv void bindUntypedNullsToResultColumns(ResultColumnList rcl) throws StandardException Overrides org. DERBY-4365 Bind untyped nulls to the types in the given ResultColumnList. This is used for binding the nulls in row constructors and table constructors.
| |
| bindVTITables | back to summary |
|---|---|
| pack-priv ResultSetNode bindVTITables(FromList fromListParam) throws StandardException Overrides org. Bind the VTI tables in this TableOperatorNode. This means getting their TableDescriptors from the DataDictionary. We will build an unbound RCL for this node. This RCL must be "bound by hand" after the underlying left and right RCLs are bound.
| |
| decrementLevel | back to summary |
|---|---|
| pack-priv void decrementLevel(int decrement) Overrides org. Decrement (query block) level (0-based) for all of the tables in this ResultSet tree. This is useful when flattening a subquery.
| |
| getExposedName | back to summary |
|---|---|
| pack-priv String getExposedName() Overrides org. Return the exposed name for this table, which is the name that can be used to refer to this table in the rest of the query. | |
| getFromTableByName | back to summary |
|---|---|
| pack-priv FromTable getFromTableByName(String name, String schemaName, boolean exactMatch) throws StandardException Overrides org. Determine whether or not the specified name is an exposed name in the current query block.
| |
| getLeftmostResultSet | back to summary |
|---|---|
| pack-priv ResultSetNode getLeftmostResultSet() | |
| getLeftResultSet | back to summary |
|---|---|
| pack-priv ResultSetNode getLeftResultSet() Get the leftResultSet from this node.
| |
| getRightResultSet | back to summary |
|---|---|
| pack-priv ResultSetNode getRightResultSet() Get the rightResultSet from this node.
| |
| modifyAccessPath | back to summary |
|---|---|
| public Optimizable modifyAccessPath(JBitSet outerTables) throws StandardException Overrides org. Implements org. Doc from org. Modify the access path for this Optimizable, as necessary. This includes things like adding a result set to translate from index rows to base rows
| |
| modifyAccessPaths | back to summary |
|---|---|
| pack-priv ResultSetNode modifyAccessPaths() throws StandardException Overrides org. Doc from org. Modify the access paths according to the decisions the optimizer made. This can include adding project/restrict nodes, index-to-base-row nodes, etc.
| |
| needsSpecialRCLBinding | back to summary |
|---|---|
| pack-priv boolean needsSpecialRCLBinding() Overrides org. apparently something special needs to be done for me....
| |
| optimize | back to summary |
|---|---|
| pack-priv ResultSetNode optimize(DataDictionary dataDictionary, PredicateList predicateList, double outerRows) throws StandardException Overrides org. Optimize a TableOperatorNode.
| |
| optimizeSource | back to summary |
|---|---|
| protected ResultSetNode optimizeSource(Optimizer optimizer, ResultSetNode sourceResultSet, PredicateList predList, CostEstimate outerCost) throws StandardException Optimize a source result set to this table operator.
| |
| preprocess | back to summary |
|---|---|
| pack-priv ResultSetNode preprocess(int numTables, GroupByList gbl, FromList fromList) throws StandardException Overrides org. Put a ProjectRestrictNode on top of each FromTable in the FromList. ColumnReferences must continue to point to the same ResultColumn, so that ResultColumn must percolate up to the new PRN. However, that ResultColumn will point to a new expression, a VirtualColumnNode, which points to the FromTable and the ResultColumn that is the source for the ColumnReference. (The new PRN will have the original of the ResultColumnList and the ResultColumns from that list. The FromTable will get shallow copies of the ResultColumnList and its ResultColumns. ResultColumn.expression will remain at the FromTable, with the PRN getting a new VirtualColumnNode for each ResultColumn.expression.) We then project out the non-referenced columns. If there are no referenced columns, then the PRN's ResultColumnList will consist of a single ResultColumn whose expression is 1.
| |
| 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.
| |
| projectResultColumns | back to summary |
|---|---|
| pack-priv void projectResultColumns() throws StandardException Overrides org. Find the unreferenced result columns and project them out. This is used in pre-processing joins that are not flattened into the where clause.
| |
| referencesSessionSchema | back to summary |
|---|---|
| public boolean referencesSessionSchema() throws StandardException Overrides org. Return true if the node references SESSION schema tables (temporary or permanent)
| |
| referencesTarget | back to summary |
|---|---|
| pack-priv boolean referencesTarget(String name, boolean baseTable) throws StandardException Overrides org. Search to see if a query references the specifed table name.
| |
| rejectParameters | back to summary |
|---|---|
| pack-priv void rejectParameters() throws StandardException Overrides org. Check for (and reject) ? parameters directly under the ResultColumns. This is done for SELECT statements. For TableOperatorNodes, we simply pass the check through to the left and right children.
| |
| setLeftmostResultSet | back to summary |
|---|---|
| pack-priv void setLeftmostResultSet(ResultSetNode newLeftResultSet) | |
| setLevel | back to summary |
|---|---|
| pack-priv void setLevel(int level) Overrides org. Set the (query block) level (0-based) for this FromTable.
| |
| setNestedInParens | back to summary |
|---|---|
| pack-priv void setNestedInParens(boolean nestedInParens) Mark whether or not this node is nested in parens. (Useful to parser since some trees get created left deep and others right deep.) The resulting state of this cal was never used so its field was removed to save runtimespace for this node. Further cleanup can be done including parser changes if this call is really nor required.
| |
| setReferencedColumns | back to summary |
|---|---|
| pack-priv void setReferencedColumns() Set the referenced columns in the column list if it may not be correct. | |
| 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. | |
| updateBestPlanMap | back to summary |
|---|---|
| public void updateBestPlanMap(short action, Object planKey) throws StandardException Overrides org. Implements org. Doc from org. When remembering "truly the best" access path for an Optimizable, we have to keep track of which OptimizerImpl the "truly the best" access is for. In most queries there will only be one OptimizerImpl in question, but in cases where there are nested subqueries, there will be one OptimizerImpl for every level of nesting, and each OptimizerImpl might have its own idea of what this Optimizable's "truly the best path" access path really is. In addition, there could be Optimizables above this Optimizable that might need to override the best path chosen during optimization. So whenever we save a "truly the best" path, we take note of which Optimizer/Optimizable told us to do so. Then as each level of subquery finishes optimization, the corresponding OptimizerImpl/Optimizable can load its preferred access path into this Optimizable's trulyTheBestAccessPath field and pass it up the tree, until eventually the outer-most OptimizerImpl can choose to either use the best path that it received from below (by calling "rememberAsBest()") or else use the path that it found to be "best" for itself. This method is what allows us to keep track of which OptimizerImpl or Optimizable saved which "best plan", and allows us to load the appropriate plans after each round of optimization.
| |
| verifyProperties | back to summary |
|---|---|
| public void verifyProperties(DataDictionary dDictionary) throws StandardException Overrides org. Implements org. Doc from org. Verify that the Properties list with optimizer overrides, if specified, is valid
| |