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

pack-priv Class NormalizeResultSetNode

extends SingleChildResultSetNode
Class Inheritance
Imports
java.util.Properties, org.apache.derby.shared.common.error.StandardException, org.apache.derby.shared.common.reference.ClassName, 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.util.JBitSet

A NormalizeResultSetNode represents a normalization result set for any child result set that needs one. See non-javadoc comments for a walk-through of a couple sample code paths.

Field Summary

Modifier and TypeField and Description
private boolean
forUpdate

this indicates if the normalize is being performed for an Update statement or not.

Inherited from org.apache.derby.impl.sql.compile.SingleChildResultSetNode:
childResulthasTrulyTheBestAccessPath

Constructor Summary

AccessConstructor and Description
pack-priv
NormalizeResultSetNode(ResultSetNode
The child ResultSetNode
chldRes
,
ResultColumnList
The target resultColumnList from the InsertNode or UpdateNode. These will be the types used for the NormalizeResultSetNode.
targetResultColumnList
,
Properties
Properties list associated with the table
tableProperties
,
boolean
tells us if the normalize operation is being performed on behalf of an update statement.
forUpdate
,
ContextManager
The context manager
cm
)

Constructor for a NormalizeResultSetNode.

Method Summary

Modifier and TypeMethod and Description
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.

Do the code generation for this node.

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 through the offset and fetch first parameters, if any, to the child result set.

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

pack-priv void
setRefActionInfo(long fkIndexConglomId, int[] fkColArray, String parentResultSetId, boolean dependentScan)

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

set the Information gathered from the parent table that is required to perform a referential action on dependent table.

Inherited from org.apache.derby.impl.sql.compile.SingleChildResultSetNode:
acceptChildrenaddNewPredicateadjustForSortEliminationadjustForSortEliminationchangeAccessPathdecrementLevelensurePredicateListflattenableInFromSubqueryforUpdategetChildResultgetFinalCostEstimategetFromTableByNamegetTrulyTheBestAccessPathinitAccessPathsisNotExistsisOneRowResultSetisOrderedOnmodifyAccessPathsoptimizepreprocessprintSubNodespullOptPredicatespushExpressionsreferencesSessionSchemareferencesTargetreflectionNeededForProjectionsetChildResultsetLevelsubqueryReferencesTargetupdateBestPlanMapupdateTargetLockMode

Field Detail

forUpdateback to summary
private boolean forUpdate

this indicates if the normalize is being performed for an Update statement or not. The row passed to update also has before values of the columns being updated-- we need not normalize these values.

Constructor Detail

NormalizeResultSetNodeback to summary
pack-priv NormalizeResultSetNode(ResultSetNode chldRes, ResultColumnList targetResultColumnList, Properties tableProperties, boolean forUpdate, ContextManager cm) throws StandardException

Constructor for a NormalizeResultSetNode. 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 NRSN 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.) This is useful for UNIONs, where we want to generate a DistinctNode above the UnionNode to eliminate the duplicates, because the type going into the sort has to agree with what the sort expects. (insert into t1 (smallintcol) values 1 union all values 2;

Parameters
chldRes:ResultSetNode

The child ResultSetNode

targetResultColumnList:ResultColumnList

The target resultColumnList from the InsertNode or UpdateNode. These will be the types used for the NormalizeResultSetNode.

tableProperties:Properties

Properties list associated with the table

forUpdate:boolean

tells us if the normalize operation is being performed on behalf of an update statement.

cm:ContextManager

The context manager

Method Detail

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

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

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

Do the code generation for this node. This is a place-holder method - it should be over-ridden in the sub-classes.

Parameters
acb:ActivationClassBuilder

The ActivationClassBuilder for the class being built

mb:MethodBuilder

The method for the generated code to go into

Annotations
@Override
Exceptions
StandardException:
Thrown on error
pushOffsetFetchFirstback to summary
pack-priv void pushOffsetFetchFirst(ValueNode offset, ValueNode fetchFirst, boolean hasJDBClimitClause)

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

Push through the offset and fetch first parameters, if any, to the child result set.

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 InsertNode 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
setRefActionInfoback to summary
pack-priv void setRefActionInfo(long fkIndexConglomId, int[] fkColArray, String parentResultSetId, boolean dependentScan)

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

set the Information gathered from the parent table that is required to perform a referential action on dependent table.

Annotations
@Override