Top Description Fields Constructors Methods
org.apache.derby.impl.sql.compile

pack-priv Class RowResultSetNode

extends FromTable
Class Inheritance
Imports
java.util.ArrayList, .List, .Properties, org.apache.derby.shared.common.error.StandardException, org.apache.derby.shared.common.reference.ClassName, .SQLState, org.apache.derby.iapi.services.classfile.VMOpcode, org.apache.derby.iapi.services.compiler.MethodBuilder, org.apache.derby.iapi.services.context.ContextManager, org.apache.derby.shared.common.sanity.SanityManager, org.apache.derby.iapi.sql.compile.CostEstimate, .Optimizable, .OptimizablePredicateList, .Optimizer, .RequiredRowOrdering, .RowOrdering, org.apache.derby.iapi.sql.dictionary.ConglomerateDescriptor, .DataDictionary, .TableDescriptor, org.apache.derby.iapi.store.access.Qualifier, org.apache.derby.iapi.types.DataTypeDescriptor, .TypeId, org.apache.derby.iapi.util.JBitSet

A RowResultSetNode represents the result set for a VALUES clause.

Field Summary

Modifier and TypeField and Description
private List<AggregateNode>
pack-priv ResultSetNode.QueryExpressionClauses
pack-priv SubqueryList
Inherited from org.apache.derby.impl.sql.compile.FromTable:
ADD_PLANbestAccessPathbestCostEstimatebestSortAvoidancePathcorrelationNamecorrTableNamecurrentAccessPathhashKeyColumnsinitialCapacitylevelLOAD_PLANloadFactormaxCapacityorigTableNameREMOVE_PLANtableNumbertablePropertiestrulyTheBestAccessPathuserSpecifiedJoinStrategy

Constructor Summary

AccessConstructor 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.

Method Summary

Modifier and TypeMethod and Description
pack-priv ResultSetNode

Returns:

ResultSetNode The new top of the tree.
addNewPredicate
(Predicate
The predicate to add
predicate
)

Overrides org.apache.derby.impl.sql.compile.ResultSetNode.addNewPredicate.

Add a new predicate to the list.

pack-priv void
adjustForSortElimination()

Overrides org.apache.derby.impl.sql.compile.ResultSetNode.adjustForSortElimination.

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.apache.derby.impl.sql.compile.ResultSetNode.bindExpressions.

Bind the expressions in this RowResultSetNode.

pack-priv void
bindExpressionsWithTables(FromList
FromList to use/append to.
fromListParam
)

Overrides org.apache.derby.impl.sql.compile.ResultSetNode.bindExpressionsWithTables.

Bind the expressions in this ResultSetNode if it has tables.

pack-priv ResultSetNode

Returns:

ResultSetNode
bindNonVTITables
(DataDictionary
The DataDictionary to use for binding
dataDictionary
,
FromList
FromList to use/append to.
fromListParam
)

Overrides org.apache.derby.impl.sql.compile.ResultSetNode.bindNonVTITables.

Bind the non VTI tables in this ResultSetNode.

pack-priv void
bindTargetExpressions(FromList fromListParam)

Overrides org.apache.derby.impl.sql.compile.ResultSetNode.bindTargetExpressions.

Bind the expressions in the target list.

pack-priv void
bindUntypedNullsToResultColumns(ResultColumnList
The ResultColumnList with the types to bind to.
bindingRCL
)

Overrides org.apache.derby.impl.sql.compile.ResultSetNode.bindUntypedNullsToResultColumns.

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.apache.derby.impl.sql.compile.ResultSetNode.enhanceRCLForInsert.

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.
ensurePredicateList
(int
The number of tables in the query.
numTables
)

Overrides org.apache.derby.impl.sql.compile.ResultSetNode.ensurePredicateList.

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.apache.derby.impl.sql.compile.FromTable.estimateCost.

Implements org.apache.derby.iapi.sql.compile.Optimizable.estimateCost.

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.
flattenableInFromSubquery
(FromList
The outer from list
fromList
)

Overrides org.apache.derby.impl.sql.compile.ResultSetNode.flattenableInFromSubquery.

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.apache.derby.impl.sql.compile.QueryTreeNode.generate.

The generated ResultSet will be: RowResultSet -- for the VALUES clause

pack-priv String

Returns:

The exposed name of this table.
getExposedName
()

Overrides org.apache.derby.impl.sql.compile.FromTable.getExposedName.

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.
getMatchingColumn
(ColumnReference
The columnReference whose name we're looking for in the given table.
columnReference
)

Overrides org.apache.derby.impl.sql.compile.ResultSetNode.getMatchingColumn.

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.apache.derby.impl.sql.compile.FromTable.modifyAccessPath.

Implements org.apache.derby.iapi.sql.compile.Optimizable.modifyAccessPath.

Modify the access path for this Optimizable, as necessary.

pack-priv ResultSetNode
modifyAccessPaths()

Overrides org.apache.derby.impl.sql.compile.ResultSetNode.modifyAccessPaths.

Modify the access paths according to the decisions the optimizer made.

pack-priv ResultSetNode

Returns:

ResultSetNode The top of the optimized tree
optimize
(DataDictionary
The DataDictionary to use for optimization
dataDictionary
,
PredicateList
The predicate list to optimize against
predicateList
,
double
The number of outer joining rows
outerRows
)

Overrides org.apache.derby.impl.sql.compile.ResultSetNode.optimize.

Optimize this SelectNode.

pack-priv void
optimizeSubqueries(DataDictionary dd, double rowCount)

Overrides org.apache.derby.impl.sql.compile.FromTable.optimizeSubqueries.

Optimize any subqueries that haven't been optimized any where else.

pack-priv ResultSetNode

Returns:

The generated ProjectRestrictNode atop the original FromTable.
preprocess
(int
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.apache.derby.impl.sql.compile.ResultSetNode.preprocess.

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.apache.derby.impl.sql.compile.ResultSetNode.printSubNodes.

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.apache.derby.impl.sql.compile.ResultSetNode.pushOffsetFetchFirst.

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.apache.derby.impl.sql.compile.ResultSetNode.pushOrderByList.

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.apache.derby.impl.sql.compile.ResultSetNode.pushQueryExpressionSuffix.

Set up a new level for order by and fetch/offset clauses.

public boolean
referencesSessionSchema()

Overrides org.apache.derby.impl.sql.compile.QueryTreeNode.referencesSessionSchema.

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.apache.derby.impl.sql.compile.ResultSetNode.replaceOrForbidDefaults.

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.
returnsAtMostOneRow
()

Overrides org.apache.derby.impl.sql.compile.ResultSetNode.returnsAtMostOneRow.

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.apache.derby.impl.sql.compile.ResultSetNode.setTableConstructorTypes.

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.apache.derby.impl.sql.compile.ResultSetNode.verifySelectStarSubquery.

Verify that a SELECT * is valid for this type of subquery.

Inherited from org.apache.derby.impl.sql.compile.FromTable:
acceptChildrenassignCostEstimatecanBeOrderedcolumnsAreUpdatableconsiderSortAvoidancePathconvertAbsoluteToRelativeColumnPositioncursorTargetTabledecrementLevelfeasibleJoinStrategyfillInReferencedTableMapflattenforUpdategetBaseTableNamegetBestAccessPathgetBestSortAvoidancePathgetCorrelationNamegetCostEstimategetCurrentAccessPathgetFinalCostEstimategetFromTableByNamegetLevelgetMergeTableIDgetNamegetNumColumnsReturnedgetOrigTableNamegetPropertiesgetResultColumnsForListgetSchemaDescriptorgetSchemaDescriptorgetScratchCostEstimategetTableDescriptorgetTableNamegetTableNumbergetTrulyTheBestAccessPathgetUserSpecifiedJoinStrategyhashKeyColumnshasLargeObjectColumnshasTableNumberinitAccessPathsinitialCapacityisBaseTableisCoveringIndexisFlattenableJoinNodeisJoinColumnForRightOuterJoinisMaterializableisOneRowScanisTargetTablelegalJoinOrderloadFactorLOJ_reorderablemarkUpdatableByCursormaxCapacitymemoryUsageOKneedsSpecialRCLBindingnextAccessPathoptimizeItpullOptPredicatespushExpressionspushOptPredicaterememberAsBestrememberJoinStrategyAsBestrememberSortAvoidancePathresetJoinStrategiessetCostEstimateCostsetHashKeyColumnssetLevelsetMergeTableIDsetOrigTableNamesetPropertiessetTableNumberstartOptimizingsupportsMultipleInstantiationstellRowOrderingAboutConstantColumnstoStringtransformOuterJoinsuniqueJoinupdateBestPlanMapverifyProperties

Field Detail

aggregatesback to summary
private List<AggregateNode> aggregates
qecback to summary
pack-priv ResultSetNode.QueryExpressionClauses qec
subquerysback to summary
pack-priv SubqueryList subquerys

Constructor Detail

RowResultSetNodeback to summary
pack-priv RowResultSetNode(ResultColumnList valuesClause, Properties tableProperties, ContextManager cm)

Constructor for a RowResultSetNode.

Parameters
valuesClause:ResultColumnList

The result column list for the VALUES clause.

tableProperties:Properties

Properties list associated with the table

cm:ContextManager

The context manager

Method Detail

addNewPredicateback to summary
pack-priv ResultSetNode addNewPredicate(Predicate predicate) throws StandardException

Overrides org.apache.derby.impl.sql.compile.ResultSetNode.addNewPredicate.

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.

Parameters
predicate:Predicate

The predicate to add

Returns:ResultSetNode

ResultSetNode The new top of the tree.

Annotations
@Override
Exceptions
StandardException:
Thrown on error
adjustForSortEliminationback to summary
pack-priv void adjustForSortElimination()

Overrides org.apache.derby.impl.sql.compile.ResultSetNode.adjustForSortElimination.

Doc from org.apache.derby.impl.sql.compile.ResultSetNode.adjustForSortElimination.

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.

Annotations
@Override
See Also
ResultSetNode#adjustForSortElimination
bindExpressionsback to summary
pack-priv void bindExpressions(FromList fromListParam) throws StandardException

Overrides org.apache.derby.impl.sql.compile.ResultSetNode.bindExpressions.

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.

Parameters
fromListParam:FromList

Doc from org.apache.derby.impl.sql.compile.ResultSetNode.bindExpressions.

FromList to use/append to.

Annotations
@Override
Exceptions
StandardException:
Thrown on error
bindExpressionsWithTablesback to summary
pack-priv void bindExpressionsWithTables(FromList fromListParam) throws StandardException

Overrides org.apache.derby.impl.sql.compile.ResultSetNode.bindExpressionsWithTables.

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.

Parameters
fromListParam:FromList

FromList to use/append to.

Annotations
@Override
Exceptions
StandardException:
Thrown on error
bindNonVTITablesback to summary
pack-priv ResultSetNode bindNonVTITables(DataDictionary dataDictionary, FromList fromListParam) throws StandardException

Overrides org.apache.derby.impl.sql.compile.ResultSetNode.bindNonVTITables.

Bind the non VTI tables in this ResultSetNode. This includes getting their descriptors from the data dictionary and numbering them.

Parameters
dataDictionary:DataDictionary

The DataDictionary to use for binding

fromListParam:FromList

FromList to use/append to.

Returns:ResultSetNode

ResultSetNode

Annotations
@Override
Exceptions
StandardException:
Thrown on error
bindTargetExpressionsback to summary
pack-priv void bindTargetExpressions(FromList fromListParam) throws StandardException

Overrides org.apache.derby.impl.sql.compile.ResultSetNode.bindTargetExpressions.

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.

Annotations
@Override
Exceptions
StandardException:
Thrown on error
bindUntypedNullsToResultColumnsback to summary
pack-priv void bindUntypedNullsToResultColumns(ResultColumnList bindingRCL) throws StandardException

Overrides org.apache.derby.impl.sql.compile.ResultSetNode.bindUntypedNullsToResultColumns.

Bind any untyped null nodes to the types in the given ResultColumnList.

Parameters
bindingRCL:ResultColumnList

The ResultColumnList with the types to bind to.

Annotations
@Override
Exceptions
StandardException:
Thrown on error
canWeCacheResultsback to summary
private boolean canWeCacheResults() throws StandardException
enhanceRCLForInsertback to summary
pack-priv ResultSetNode enhanceRCLForInsert(InsertNode target, boolean inOrder, int[] colMap) throws StandardException

Overrides org.apache.derby.impl.sql.compile.ResultSetNode.enhanceRCLForInsert.

Modify the RCL of this node to match the target of the insert.

Parameters
target:InsertNode

Doc from org.apache.derby.impl.sql.compile.ResultSetNode.enhanceRCLForInsert.

the target node for the insert

inOrder:boolean

Doc from org.apache.derby.impl.sql.compile.ResultSetNode.enhanceRCLForInsert.

are source cols in same order as target cols?

colMap:int[]

Doc from org.apache.derby.impl.sql.compile.ResultSetNode.enhanceRCLForInsert.

int array representation of correspondence between RCLs - colmap[i] = -1 -> missing in current RCL colmap[i] = j -> targetRCL(i) <-> thisRCL(j+1)

Returns:ResultSetNode

Doc from org.apache.derby.impl.sql.compile.ResultSetNode.enhanceRCLForInsert.

a node that replaces this node and whose RCL matches the target RCL. May return this node if no changes to the RCL are needed, or if the RCL is modified in-place.

Annotations
@Override
Exceptions
StandardException:

Doc from org.apache.derby.impl.sql.compile.ResultSetNode.enhanceRCLForInsert.

Thrown on error

ensurePredicateListback to summary
pack-priv ResultSetNode ensurePredicateList(int numTables) throws StandardException

Overrides org.apache.derby.impl.sql.compile.ResultSetNode.ensurePredicateList.

Ensure that the top of the RSN tree has a PredicateList.

Parameters
numTables:int

The number of tables in the query.

Returns:ResultSetNode

ResultSetNode A RSN tree with a node which has a PredicateList on top.

Annotations
@Override
Exceptions
StandardException:
Thrown on error
estimateCostback to summary
public CostEstimate estimateCost(OptimizablePredicateList predList, ConglomerateDescriptor cd, CostEstimate outerCost, Optimizer optimizer, RowOrdering rowOrdering) throws StandardException

Overrides org.apache.derby.impl.sql.compile.FromTable.estimateCost.

Implements org.apache.derby.iapi.sql.compile.Optimizable.estimateCost.

Doc from org.apache.derby.iapi.sql.compile.Optimizable.estimateCost.

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.

Parameters
predList:OptimizablePredicateList

The predicate list to optimize against

cd:ConglomerateDescriptor

The conglomerate descriptor to get the cost of

outerCost:CostEstimate

The estimated cost of the part of the plan outer to this optimizable.

optimizer:Optimizer

The optimizer to use to help estimate the cost

rowOrdering:RowOrdering

The row ordering for all the tables in the join order, including this one.

Returns:CostEstimate

The estimated cost of doing the scan

Annotations
@Override
Exceptions
StandardException:
Thrown on error
See Also
Optimizable#estimateCost
flattenableInFromSubqueryback to summary
pack-priv boolean flattenableInFromSubquery(FromList fromList)

Overrides org.apache.derby.impl.sql.compile.ResultSetNode.flattenableInFromSubquery.

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.

Parameters
fromList:FromList

The outer from list

Returns:boolean

boolean Whether or not the FromSubquery is flattenable.

Annotations
@Override
generateback to summary
pack-priv void generate(ActivationClassBuilder acb, MethodBuilder mb) throws StandardException

Overrides org.apache.derby.impl.sql.compile.QueryTreeNode.generate.

The generated ResultSet will be: RowResultSet -- for the VALUES clause

Parameters
acb:ActivationClassBuilder

Doc from org.apache.derby.impl.sql.compile.QueryTreeNode.generate.

The ActivationClassBuilder for the class being built

mb:MethodBuilder

Doc from org.apache.derby.impl.sql.compile.QueryTreeNode.generate.

The method for the generated code to go into

Annotations
@Override
Exceptions
StandardException:
Thrown on error
getExposedNameback to summary
pack-priv String getExposedName() throws StandardException

Overrides org.apache.derby.impl.sql.compile.FromTable.getExposedName.

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.

Returns:String

The exposed name of this table.

Annotations
@Override
Exceptions
StandardException:
Thrown on error
getMatchingColumnback to summary
pack-priv ResultColumn getMatchingColumn(ColumnReference columnReference) throws StandardException

Overrides org.apache.derby.impl.sql.compile.ResultSetNode.getMatchingColumn.

Try to find a ResultColumn in the table represented by this FromTable that matches the name in the given ColumnReference.

Parameters
columnReference:ColumnReference

The columnReference whose name we're looking for in the given table.

Returns:ResultColumn

A ResultColumn whose expression is the ColumnNode that matches the ColumnReference. Returns null if there is no match.

Annotations
@Override
Exceptions
StandardException:
Thrown on error
modifyAccessPathback to summary
public Optimizable modifyAccessPath(JBitSet outerTables) throws StandardException

Overrides org.apache.derby.impl.sql.compile.FromTable.modifyAccessPath.

Implements org.apache.derby.iapi.sql.compile.Optimizable.modifyAccessPath.

Doc from org.apache.derby.iapi.sql.compile.Optimizable.modifyAccessPath.

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

Parameters
outerTables:JBitSet

Bit map of the tables that are outer to this one in the join order.

Returns:Optimizable

The (potentially new) Optimizable at the top of the tree.

Annotations
@Override
Exceptions
StandardException:
Thrown on error
See Also
Optimizable#modifyAccessPath
modifyAccessPathsback to summary
pack-priv ResultSetNode modifyAccessPaths() throws StandardException

Overrides org.apache.derby.impl.sql.compile.ResultSetNode.modifyAccessPaths.

Doc from org.apache.derby.impl.sql.compile.ResultSetNode.modifyAccessPaths.

Modify the access paths according to the decisions the optimizer made. This can include adding project/restrict nodes, index-to-base-row nodes, etc.

Returns:ResultSetNode

The modified query tree

Annotations
@Override
Exceptions
StandardException:
Thrown on error
See Also
ResultSetNode#modifyAccessPaths
optimizeback to summary
pack-priv ResultSetNode optimize(DataDictionary dataDictionary, PredicateList predicateList, double outerRows) throws StandardException

Overrides org.apache.derby.impl.sql.compile.ResultSetNode.optimize.

Optimize this SelectNode. This means choosing the best access path for each table, among other things.

Parameters
dataDictionary:DataDictionary

The DataDictionary to use for optimization

predicateList:PredicateList

The predicate list to optimize against

outerRows:double

The number of outer joining rows

Returns:ResultSetNode

ResultSetNode The top of the optimized tree

Annotations
@Override
Exceptions
StandardException:
Thrown on error
optimizeSubqueriesback to summary
pack-priv void optimizeSubqueries(DataDictionary dd, double rowCount) throws StandardException

Overrides org.apache.derby.impl.sql.compile.FromTable.optimizeSubqueries.

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.

Annotations
@Override
Exceptions
StandardException:
Thrown on error
preprocessback to summary
pack-priv ResultSetNode preprocess(int numTables, GroupByList gbl, FromList fromList) throws StandardException

Overrides org.apache.derby.impl.sql.compile.ResultSetNode.preprocess.

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.

Parameters
numTables:int

Number of tables in the DML Statement

gbl:GroupByList

The group by list, if any

fromList:FromList

The from list, if any

Returns:ResultSetNode

The generated ProjectRestrictNode atop the original FromTable.

Annotations
@Override
Exceptions
StandardException:
Thrown on error
printSubNodesback to summary
pack-priv void printSubNodes(int depth)

Overrides org.apache.derby.impl.sql.compile.ResultSetNode.printSubNodes.

Prints the sub-nodes of this object. See QueryTreeNode.java for how tree printing is supposed to work.

Parameters
depth:int

The depth of this node in the tree

Annotations
@Override
pushOffsetFetchFirstback to summary
pack-priv void pushOffsetFetchFirst(ValueNode offset, ValueNode fetchFirst, boolean hasJDBClimitClause)

Overrides org.apache.derby.impl.sql.compile.ResultSetNode.pushOffsetFetchFirst.

Push down the offset and fetch first parameters, if any, to this node.

Parameters
offset:ValueNode

the OFFSET, if any

fetchFirst:ValueNode

the OFFSET FIRST, if any

hasJDBClimitClause:boolean

true if the clauses were added by (and have the semantics of) a JDBC limit clause

Annotations
@Override
pushOrderByListback to summary
pack-priv void pushOrderByList(OrderByList orderByList)

Overrides org.apache.derby.impl.sql.compile.ResultSetNode.pushOrderByList.

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.

Parameters
orderByList:OrderByList

The order by list

Annotations
@Override
pushQueryExpressionSuffixback to summary
public void pushQueryExpressionSuffix()

Overrides org.apache.derby.impl.sql.compile.ResultSetNode.pushQueryExpressionSuffix.

Doc from org.apache.derby.impl.sql.compile.ResultSetNode.pushQueryExpressionSuffix.

Set up a new level for order by and fetch/offset clauses. See Javadoc for ResultSetNode.QueryExpressionClauses. Overridden by implementors of pushOrderByNode, pushOffsetFetchFirst.

Annotations
@Override
referencesSessionSchemaback to summary
public boolean referencesSessionSchema() throws StandardException

Overrides org.apache.derby.impl.sql.compile.QueryTreeNode.referencesSessionSchema.

Doc from org.apache.derby.impl.sql.compile.QueryTreeNode.referencesSessionSchema.

Return true if the node references SESSION schema tables (temporary or permanent)

Returns:boolean

true if references SESSION schema tables, else false

Annotations
@Override
Exceptions
StandardException:
Thrown on error
replaceOrForbidDefaultsback to summary
pack-priv void replaceOrForbidDefaults(TableDescriptor ttd, ResultColumnList tcl, boolean allowDefaults) throws StandardException

Overrides org.apache.derby.impl.sql.compile.ResultSetNode.replaceOrForbidDefaults.

Doc from org.apache.derby.impl.sql.compile.ResultSetNode.replaceOrForbidDefaults.

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.

Parameters
ttd:TableDescriptor

The TableDescriptor for the target table.

tcl:ResultColumnList

The RCL for the target table.

allowDefaults:boolean

true if allowed

Annotations
@Override
Exceptions
StandardException:
Thrown on error
returnsAtMostOneRowback to summary
pack-priv boolean returnsAtMostOneRow()

Overrides org.apache.derby.impl.sql.compile.ResultSetNode.returnsAtMostOneRow.

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.)

Returns:boolean

Whether or not this ResultSet tree is guaranteed to return at most 1 row based on heuristics.

Annotations
@Override
setTableConstructorTypesback to summary
pack-priv void setTableConstructorTypes(ResultColumnList typeColumns) throws StandardException

Overrides org.apache.derby.impl.sql.compile.ResultSetNode.setTableConstructorTypes.

Set the type of each parameter in the result column list for this table constructor.

Parameters
typeColumns:ResultColumnList

The ResultColumnList containing the desired result types.

Annotations
@Override
Exceptions
StandardException:
Thrown on error
statementToStringback to summary
pack-priv String statementToString()
verifySelectStarSubqueryback to summary
pack-priv void verifySelectStarSubquery(FromList outerFromList, int subqueryType) throws StandardException

Overrides org.apache.derby.impl.sql.compile.ResultSetNode.verifySelectStarSubquery.

Verify that a SELECT * is valid for this type of subquery.

Parameters
outerFromList:FromList

The FromList from the outer query block(s)

subqueryType:int

The subquery type

Annotations
@Override
Exceptions
StandardException:
Thrown on error