|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.derby.impl.sql.compile.QueryTreeNode
org.apache.derby.impl.sql.compile.ResultSetNode
org.apache.derby.impl.sql.compile.FromTable
org.apache.derby.impl.sql.compile.TableOperatorNode
org.apache.derby.impl.sql.compile.UnionNode
A UnionNode represents a UNION in a DML statement. It contains a boolean telling whether the union operation should eliminate duplicate rows.
Field Summary | |
private boolean |
addNewNodesCalled
|
(package private) boolean |
all
Tells whether to eliminate duplicate rows. |
private OrderByList |
orderByList
|
(package private) boolean |
tableConstructor
|
(package private) boolean |
topTableConstructor
|
Fields inherited from class org.apache.derby.impl.sql.compile.TableOperatorNode |
leftOptimizer, leftResultSet, nestedInParens, rightOptimizer, rightResultSet |
Fields inherited from class org.apache.derby.impl.sql.compile.FromTable |
bestAccessPath, bestCostEstimate, bestSortAvoidancePath, correlationName, corrTableName, currentAccessPath, hashKeyColumns, initialCapacity, level, loadFactor, maxCapacity, tableNumber, tableProperties, trulyTheBestAccessPath, userSpecifiedJoinStrategy |
Fields inherited from class org.apache.derby.impl.sql.compile.ResultSetNode |
costEstimate, cursorTargetTable, insertSource, optimizer, referencedTableMap, resultColumns, resultSetNumber, scratchCostEstimate, statementResultSet |
Fields inherited from class org.apache.derby.impl.sql.compile.QueryTreeNode |
AUTOINCREMENT_INC_INDEX, AUTOINCREMENT_IS_AUTOINCREMENT_INDEX, AUTOINCREMENT_START_INDEX, beginOffset, endOffset |
Constructor Summary | |
UnionNode()
|
Method Summary | |
private ResultSetNode |
addNewNodes()
Add any new ResultSetNodes that are necessary to the tree. |
void |
bindExpressions(FromList fromListParam)
Bind the expressions under this TableOperatorNode. |
void |
bindResultColumns(FromList fromListParam)
Bind the result columns of this ResultSetNode when there is no base table to bind them to. |
void |
bindResultColumns(TableDescriptor targetTableDescriptor,
FromVTI targetVTI,
ResultColumnList targetColumnList,
DMLStatementNode statement,
FromList fromListParam)
Bind the result columns for this ResultSetNode to a base table. |
void |
bindTargetExpressions(FromList fromListParam)
Bind the expressions in the target list. |
void |
bindUntypedNullsToResultColumns(ResultColumnList rcl)
Bind the result columns of a table constructor to the types in the given ResultColumnList. |
private void |
buildRCL()
Build the RCL for this node. |
ResultSetNode |
enhanceRCLForInsert(int numTargetColumns,
int[] colMap,
DataDictionary dataDictionary,
TableDescriptor targetTD,
FromVTI targetVTI)
This ResultSet is the source for an Insert. |
ResultSetNode |
ensurePredicateList(int numTables)
Ensure that the top of the RSN tree has a PredicateList. |
boolean |
flattenableInFromSubquery(FromList fromList)
Evaluate whether or not the subquery in a FromSubquery is flattenable. |
void |
generate(ActivationClassBuilder acb,
MethodBuilder mb)
Generate the code for this UnionNode. |
protected FromTable |
getFromTableByName(java.lang.String name,
java.lang.String schemaName,
boolean exactMatch)
Determine whether or not the specified name is an exposed name in the current query block. |
(package private) int |
getParamColumnTypes(DataTypeDescriptor[] types,
RowResultSetNode rrsn)
Get the parameter types from the given RowResultSetNode into the given array of types. |
void |
init(java.lang.Object leftResult,
java.lang.Object rightResult,
java.lang.Object all,
java.lang.Object tableConstructor,
java.lang.Object tableProperties)
Initializer for a UnionNode. |
void |
markTopTableConstructor()
Mark this as the top node of a table constructor. |
Optimizable |
modifyAccessPath(JBitSet outerTables)
Modify the access path for this Optimizable, as necessary. |
ResultSetNode |
modifyAccessPaths()
Modify the access paths according to the decisions the optimizer made. |
CostEstimate |
optimizeIt(Optimizer optimizer,
OptimizablePredicateList predList,
CostEstimate outerCost,
RowOrdering rowOrdering)
Choose the best access path for this Optimizable. |
boolean |
performMaterialization(JBitSet outerTables)
Return whether or not to materialize this ResultSet tree. |
ResultSetNode |
preprocess(int numTables,
GroupByList gbl,
FromList fromList)
Put a ProjectRestrictNode on top of each FromTable in the FromList. |
(package private) void |
pushOrderByList(OrderByList orderByList)
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. |
void |
rejectParameters()
Check for (and reject) ? |
(package private) void |
setParamColumnTypes(DataTypeDescriptor[] types,
RowResultSetNode rrsn)
Set the type of each ? |
void |
setResultToBooleanTrueNode(boolean onlyConvertAlls)
Set the result column for the subquery to a boolean true, Useful for transformations such as changing: where exists (select ... from ...) |
(package private) void |
setTableConstructorTypes(ResultColumnList typeColumns)
Set the type of column in the result column lists of each source of this union tree to the type in the given result column list (which represents the result columns for an insert). |
(package private) boolean |
tableConstructor()
Tell whether this is a UNION for a table constructor. |
java.lang.String |
toString()
Convert this object to a String. |
void |
verifySelectStarSubquery(FromList outerFromList,
int subqueryType)
Verify that a SELECT * is valid for this type of subquery. |
Methods inherited from class org.apache.derby.impl.sql.compile.TableOperatorNode |
accept, bindExpressionsWithTables, bindNonVTITables, bindVTITables, decrementLevel, getExposedName, getLeftmostResultSet, getLeftResultSet, getNestedInParens, getRightResultSet, init, markOrderingDependent, needsSpecialRCLBinding, optimize, optimizeSource, printSubNodes, projectResultColumns, referencesSessionSchema, referencesTarget, replaceDefaults, setLeftmostResultSet, setLevel, setNestedInParens, setReferencedColumns, verifyProperties |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.apache.derby.iapi.sql.compile.Optimizable |
getDataDictionary, getReferencedTableMap, getResultSetNumber |
Field Detail |
boolean all
boolean tableConstructor
boolean topTableConstructor
private boolean addNewNodesCalled
private OrderByList orderByList
Constructor Detail |
public UnionNode()
Method Detail |
public void init(java.lang.Object leftResult, java.lang.Object rightResult, java.lang.Object all, java.lang.Object tableConstructor, java.lang.Object tableProperties) throws StandardException
init
in class QueryTreeNode
leftResult
- The ResultSetNode on the left side of this unionrightResult
- The ResultSetNode on the right side of this unionall
- Whether or not this is a UNION ALL.tableConstructor
- Whether or not this is from a table constructor.tableProperties
- Properties list associated with the table
StandardException
- Thrown on errorpublic void markTopTableConstructor()
boolean tableConstructor()
public void rejectParameters() throws StandardException
rejectParameters
in class TableOperatorNode
StandardException
- Thrown if a ? parameter found
directly under a ResultColumnvoid setTableConstructorTypes(ResultColumnList typeColumns) throws StandardException
setTableConstructorTypes
in class ResultSetNode
typeColumns
- The ResultColumnList containing the desired result
types.
StandardException
- Thrown on errorpublic CostEstimate optimizeIt(Optimizer optimizer, OptimizablePredicateList predList, CostEstimate outerCost, RowOrdering rowOrdering) throws StandardException
Optimizable
optimizeIt
in interface Optimizable
optimizeIt
in class FromTable
StandardException
- Thrown on errorOptimizable.optimizeIt(org.apache.derby.iapi.sql.compile.Optimizer, org.apache.derby.iapi.sql.compile.OptimizablePredicateList, org.apache.derby.iapi.sql.compile.CostEstimate, org.apache.derby.iapi.sql.compile.RowOrdering)
public Optimizable modifyAccessPath(JBitSet outerTables) throws StandardException
Optimizable
modifyAccessPath
in interface Optimizable
modifyAccessPath
in class TableOperatorNode
StandardException
- Thrown on errorOptimizable.modifyAccessPath(org.apache.derby.iapi.util.JBitSet)
public ResultSetNode modifyAccessPaths() throws StandardException
ResultSetNode
modifyAccessPaths
in class TableOperatorNode
StandardException
- Thrown on errorResultSetNode.modifyAccessPaths()
private ResultSetNode addNewNodes() throws StandardException
StandardException
- Thrown on errorpublic java.lang.String toString()
toString
in class TableOperatorNode
public void bindExpressions(FromList fromListParam) throws StandardException
bindExpressions
in class TableOperatorNode
StandardException
- Thrown on errorpublic void bindResultColumns(FromList fromListParam) throws StandardException
bindResultColumns
in class TableOperatorNode
fromListParam
- FromList to use/append to.
StandardException
- Thrown on errorpublic void bindResultColumns(TableDescriptor targetTableDescriptor, FromVTI targetVTI, ResultColumnList targetColumnList, DMLStatementNode statement, FromList fromListParam) throws StandardException
bindResultColumns
in class TableOperatorNode
targetTableDescriptor
- The TableDescriptor for the table being
updated or inserted intotargetColumnList
- 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.statement
- Calling DMLStatementNode (Insert or Update)fromListParam
- FromList to use/append to.
StandardException
- Thrown on errorprivate void buildRCL() throws StandardException
StandardException
- Thrown on errorpublic void bindUntypedNullsToResultColumns(ResultColumnList rcl) throws StandardException
bindUntypedNullsToResultColumns
in class ResultSetNode
rcl
- The ResultColumnList with the types to bind to
StandardException
- Thrown on error.int getParamColumnTypes(DataTypeDescriptor[] types, RowResultSetNode rrsn)
types
- The array of types to fill inrrsn
- The RowResultSetNode from which to take the param types
void setParamColumnTypes(DataTypeDescriptor[] types, RowResultSetNode rrsn) throws StandardException
types
- An array of types containing the proper type for each
? parameter, by ordinal position.rrsn
- A RowResultSetNode that could contain ? parameters whose
types need to be set.
StandardException
- Thrown on errorpublic void bindTargetExpressions(FromList fromListParam) throws StandardException
bindTargetExpressions
in class ResultSetNode
StandardException
- Thrown on errorvoid pushOrderByList(OrderByList orderByList)
pushOrderByList
in class ResultSetNode
orderByList
- The order by list
public ResultSetNode preprocess(int numTables, GroupByList gbl, FromList fromList) throws StandardException
preprocess
in class TableOperatorNode
numTables
- Number of tables in the DML Statementgbl
- The group by list, if anyfromList
- The from list, if any
StandardException
- Thrown on errorpublic ResultSetNode ensurePredicateList(int numTables) throws StandardException
ensurePredicateList
in class ResultSetNode
numTables
- The number of tables in the query.
StandardException
- Thrown on errorpublic void verifySelectStarSubquery(FromList outerFromList, int subqueryType) throws StandardException
verifySelectStarSubquery
in class ResultSetNode
outerFromList
- The FromList from the outer query block(s)subqueryType
- The subquery type
StandardException
- Thrown on errorprotected FromTable getFromTableByName(java.lang.String name, java.lang.String schemaName, boolean exactMatch) throws StandardException
getFromTableByName
in class TableOperatorNode
name
- The specified name to search for as an exposed name.schemaName
- Schema name, if non-null.exactMatch
- Whether or not we need an exact match on specified schema and table
names or match on table id.
StandardException
- Thrown on errorpublic void setResultToBooleanTrueNode(boolean onlyConvertAlls) throws StandardException
setResultToBooleanTrueNode
in class ResultSetNode
onlyConvertAlls
- Boolean, whether or not to just convert *'s
StandardException
- Thrown on errorpublic ResultSetNode enhanceRCLForInsert(int numTargetColumns, int[] colMap, DataDictionary dataDictionary, TableDescriptor targetTD, FromVTI targetVTI) throws StandardException
enhanceRCLForInsert
in class ResultSetNode
numTargetColumns
- # of columns in target RCLdataDictionary
- DataDictionary to usetargetTD
- TableDescriptor for target if the target is not a VTI, null if a VTItargetVTI
- Target description if it is a VTI, null if not a VTI
StandardException
- Thrown on errorpublic boolean flattenableInFromSubquery(FromList fromList)
flattenableInFromSubquery
in class ResultSetNode
fromList
- The outer from list
public boolean performMaterialization(JBitSet outerTables) throws StandardException
performMaterialization
in class ResultSetNode
StandardException
- Thrown on errorpublic void generate(ActivationClassBuilder acb, MethodBuilder mb) throws StandardException
generate
in class QueryTreeNode
acb
- The ActivationClassBuilder for the class being builtmb
- The method for the generated code to go into
StandardException
- Thrown on error
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |