| Modifier and Type | Field and Description |
|---|---|
| private List | |
| pack-priv ResultSetNode. | |
| pack-priv SubqueryList |
| Access | Constructor and Description |
|---|---|
| pack-priv | RowResultSetNode(ResultColumnList
The result column list for the VALUES clause. valuesClause, Properties Properties list associated with the table tableProperties, ContextManager The context manager cm)Constructor for a RowResultSetNode. |
| Modifier and Type | Method and Description |
|---|---|
| pack-priv ResultSetNode | Returns: ResultSetNode The new top of the tree.The predicate to add predicate)Overrides org. Add a new predicate to the list. |
| pack-priv void | adjustForSortElimination()
Overrides org. Notify the underlying result set tree that the optimizer has chosen to "eliminate" a sort. |
| pack-priv void | bindExpressions(FromList
FromList to use/append to. fromListParam)Overrides org. Bind the expressions in this RowResultSetNode. |
| 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: ResultSetNodeThe DataDictionary to use for binding dataDictionary, FromList FromList to use/append to. fromListParam)Overrides org. Bind the non VTI tables in this ResultSetNode. |
| pack-priv void | bindTargetExpressions(FromList fromListParam)
Overrides org. Bind the expressions in the target list. |
| pack-priv void | bindUntypedNullsToResultColumns(ResultColumnList
The ResultColumnList with the types to bind to. bindingRCL)Overrides org. Bind any untyped null nodes to the types in the given ResultColumnList. |
| private boolean | |
| pack-priv ResultSetNode | enhanceRCLForInsert(InsertNode
the target node for the insert target, boolean are source cols in same order as target cols? inOrder, int[] int array representation of correspondence between
RCLs - colmap[i] = -1 -> missing in current RCL
colmap[i] = j -> targetRCL(i) <-> thisRCL(j+1) colMap)Overrides org. Modify the RCL of this node to match the target of the insert. |
| pack-priv ResultSetNode | Returns: ResultSetNode A RSN tree with a node which has a PredicateList on top.The number of tables in the query. numTables)Overrides org. Ensure that the top of the RSN tree has a PredicateList. |
| public CostEstimate | estimateCost(OptimizablePredicateList
The predicate list to optimize against predList, ConglomerateDescriptor The conglomerate descriptor to get the cost of cd, CostEstimate The estimated cost of the part of the plan outer
to this optimizable. outerCost, Optimizer The optimizer to use to help estimate the cost optimizer, RowOrdering The row ordering for all the tables in the
join order, including this one. rowOrdering)Overrides org. Implements org. Estimate the cost of scanning this Optimizable using the given predicate list with the given conglomerate. |
| pack-priv boolean | Returns: boolean Whether or not the FromSubquery is flattenable.The outer from list fromList)Overrides org. Evaluate whether or not the subquery in a FromSubquery is flattenable. |
| pack-priv void | generate(ActivationClassBuilder
The ActivationClassBuilder for the class being built acb, MethodBuilder The method for the generated code to go into mb)Overrides org. The generated ResultSet will be: RowResultSet -- for the VALUES clause |
| pack-priv String | Returns: The exposed name of this table.Overrides org. Get the exposed name for this table, which is the name that can be used to refer to it in the rest of the query. |
| pack-priv ResultColumn | Returns: A ResultColumn whose expression is the ColumnNode that matches the ColumnReference. Returns null if there is no match.The columnReference whose name we're looking
for in the given table. columnReference)Overrides org. Try to find a ResultColumn in the table represented by this FromTable that matches the name in the given ColumnReference. |
| 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 ResultSetNode | Returns: ResultSetNode The top of the optimized treeThe DataDictionary to use for optimization dataDictionary, PredicateList The predicate list to optimize against predicateList, double The number of outer joining rows outerRows)Overrides org. Optimize this SelectNode. |
| pack-priv void | optimizeSubqueries(DataDictionary dd, double rowCount)
Overrides org. Optimize any subqueries that haven't been optimized any where else. |
| 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 | pushOffsetFetchFirst(ValueNode
the OFFSET, if any offset, ValueNode the OFFSET FIRST, if any fetchFirst, boolean true if the clauses were added by (and have the semantics of) a JDBC limit clause hasJDBClimitClause)Overrides org. Push down the offset and fetch first parameters, if any, to this node. |
| pack-priv void | pushOrderByList(OrderByList
The order by list orderByList)Overrides org. Push the order by list down from the cursor node into its child result set so that the optimizer has all of the information that it needs to consider sort avoidance. |
| public void | pushQueryExpressionSuffix()
Overrides org. Set up a new level for order by and fetch/offset clauses. |
| public boolean | referencesSessionSchema()
Overrides org. Return true if the node references SESSION schema tables (temporary or permanent) |
| pack-priv void | replaceOrForbidDefaults(TableDescriptor
The TableDescriptor for the target table. ttd, ResultColumnList The RCL for the target table. tcl, boolean true if allowed allowDefaults)Overrides org. Replace any DEFAULTs with the associated tree for the default if allowed, or flag (when inside top level set operator nodes). |
| pack-priv boolean | Returns: Whether or not this ResultSet tree is guaranteed to return at most 1 row based on heuristics.Overrides org. Return whether or not this ResultSet tree is guaranteed to return at most 1 row based on heuristics. |
| pack-priv void | setTableConstructorTypes(ResultColumnList
The ResultColumnList containing the desired result
types. typeColumns)Overrides org. Set the type of each parameter in the result column list for this table constructor. |
| pack-priv String | |
| pack-priv void | verifySelectStarSubquery(FromList
The FromList from the outer query block(s) outerFromList, int The subquery type subqueryType)Overrides org. Verify that a SELECT * is valid for this type of subquery. |
| aggregates | back to summary |
|---|---|
| private List<AggregateNode> aggregates | |
| qec | back to summary |
|---|---|
| pack-priv ResultSetNode. | |
| subquerys | back to summary |
|---|---|
| pack-priv SubqueryList subquerys | |
| RowResultSetNode | back to summary |
|---|---|
| pack-priv RowResultSetNode(ResultColumnList valuesClause, Properties tableProperties, ContextManager cm) Constructor for a RowResultSetNode.
| |
| addNewPredicate | back to summary |
|---|---|
| pack-priv ResultSetNode addNewPredicate(Predicate predicate) throws StandardException Overrides org. Add a new predicate to the list. This is useful when doing subquery transformations, when we build a new predicate with the left side of the subquery operator and the subquery's result column.
| |
| 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.
| |
| bindExpressions | back to summary |
|---|---|
| pack-priv void bindExpressions(FromList fromListParam) throws StandardException Overrides org. Bind the expressions in this RowResultSetNode. 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 ResultSetNode. This includes getting their descriptors from the data dictionary and numbering them.
| |
| bindTargetExpressions | back to summary |
|---|---|
| pack-priv void bindTargetExpressions(FromList fromListParam) throws StandardException Overrides org. Bind the expressions in the target list. This means binding the sub-expressions, as well as figuring out what the return type is for each expression. This is useful for EXISTS subqueries, where we need to validate the target list before blowing it away and replacing it with a SELECT true.
| |
| bindUntypedNullsToResultColumns | back to summary |
|---|---|
| pack-priv void bindUntypedNullsToResultColumns(ResultColumnList bindingRCL) throws StandardException Overrides org. Bind any untyped null nodes to the types in the given ResultColumnList.
| |
| canWeCacheResults | back to summary |
|---|---|
| private boolean canWeCacheResults() throws StandardException | |
| enhanceRCLForInsert | back to summary |
|---|---|
| pack-priv ResultSetNode enhanceRCLForInsert(InsertNode target, boolean inOrder, int[] colMap) throws StandardException Overrides org. Modify the RCL of this node to match the target of the insert.
| |
| ensurePredicateList | back to summary |
|---|---|
| pack-priv ResultSetNode ensurePredicateList(int numTables) throws StandardException Overrides org. Ensure that the top of the RSN tree has a PredicateList.
| |
| estimateCost | back to summary |
|---|---|
| public CostEstimate estimateCost(OptimizablePredicateList predList, ConglomerateDescriptor cd, CostEstimate outerCost, Optimizer optimizer, RowOrdering rowOrdering) throws StandardException Overrides org. Implements org. Doc from org. Estimate the cost of scanning this Optimizable using the given predicate list with the given conglomerate. It is assumed that the predicate list has already been classified. This cost estimate is just for one scan, not for the life of the query.
| |
| flattenableInFromSubquery | back to summary |
|---|---|
| pack-priv boolean flattenableInFromSubquery(FromList fromList) Overrides org. Evaluate whether or not the subquery in a FromSubquery is flattenable. Currently, a FSqry is flattenable if all of the following are true: o Subquery is a SelectNode or a RowResultSetNode (not a UnionNode) o It contains no top level subqueries. (RESOLVE - we can relax this) o It does not contain a group by or having clause o It does not contain aggregates. o There is at least one result set in the from list that is not a RowResultSetNode (the reason is to avoid having an outer SelectNode with an empty FromList. | |
| generate | back to summary |
|---|---|
| pack-priv void generate(ActivationClassBuilder acb, MethodBuilder mb) throws StandardException Overrides org. The generated ResultSet will be: RowResultSet -- for the VALUES clause
| |
| getExposedName | back to summary |
|---|---|
| pack-priv String getExposedName() throws StandardException Overrides org. Get the exposed name for this table, which is the name that can be used to refer to it in the rest of the query.
| |
| getMatchingColumn | back to summary |
|---|---|
| pack-priv ResultColumn getMatchingColumn(ColumnReference columnReference) throws StandardException Overrides org. Try to find a ResultColumn in the table represented by this FromTable that matches the name in the given ColumnReference.
| |
| 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.
| |
| optimize | back to summary |
|---|---|
| pack-priv ResultSetNode optimize(DataDictionary dataDictionary, PredicateList predicateList, double outerRows) throws StandardException Overrides org. Optimize this SelectNode. This means choosing the best access path for each table, among other things.
| |
| optimizeSubqueries | back to summary |
|---|---|
| pack-priv void optimizeSubqueries(DataDictionary dd, double rowCount) throws StandardException Overrides org. Optimize any subqueries that haven't been optimized any where else. This is useful for a RowResultSetNode as a derived table because it doesn't get optimized otherwise.
| |
| 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.
| |
| pushOffsetFetchFirst | back to summary |
|---|---|
| pack-priv void pushOffsetFetchFirst(ValueNode offset, ValueNode fetchFirst, boolean hasJDBClimitClause) Overrides org. Push down the offset and fetch first parameters, if any, to this node. | |
| pushOrderByList | back to summary |
|---|---|
| pack-priv void pushOrderByList(OrderByList orderByList) Overrides org. Push the order by list down from the cursor node into its child result set so that the optimizer has all of the information that it needs to consider sort avoidance.
| |
| pushQueryExpressionSuffix | back to summary |
|---|---|
| public void pushQueryExpressionSuffix() Overrides org. Doc from org. Set up a new level for order by and fetch/offset clauses.
See Javadoc for
| |
| referencesSessionSchema | back to summary |
|---|---|
| public boolean referencesSessionSchema() throws StandardException Overrides org. Doc from org. Return true if the node references SESSION schema tables (temporary or permanent)
| |
| replaceOrForbidDefaults | back to summary |
|---|---|
| pack-priv void replaceOrForbidDefaults(TableDescriptor ttd, ResultColumnList tcl, boolean allowDefaults) throws StandardException Overrides org. Doc from org. Replace any DEFAULTs with the associated tree for the default if allowed, or flag (when inside top level set operator nodes). Subqueries are checked for illegal DEFAULTs elsewhere.
| |
| returnsAtMostOneRow | back to summary |
|---|---|
| pack-priv boolean returnsAtMostOneRow() Overrides org. Return whether or not this ResultSet tree is guaranteed to return at most 1 row based on heuristics. (A RowResultSetNode and a SELECT with a non-grouped aggregate will return at most 1 row.)
| |
| setTableConstructorTypes | back to summary |
|---|---|
| pack-priv void setTableConstructorTypes(ResultColumnList typeColumns) throws StandardException Overrides org. Set the type of each parameter in the result column list for this table constructor.
| |
| statementToString | back to summary |
|---|---|
| pack-priv String statementToString() | |
| verifySelectStarSubquery | back to summary |
|---|---|
| pack-priv void verifySelectStarSubquery(FromList outerFromList, int subqueryType) throws StandardException Overrides org. Verify that a SELECT * is valid for this type of subquery.
| |