|
|||||||||
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.RowResultSetNode
public class RowResultSetNode
A RowResultSetNode represents the result set for a VALUES clause.
Field Summary | |
---|---|
(package private) java.util.Vector |
aggregateVector
|
(package private) ValueNode |
fetchFirst
|
(package private) ValueNode |
offset
|
(package private) OrderByList |
orderByList
|
(package private) SubqueryList |
subquerys
|
Fields inherited from class org.apache.derby.impl.sql.compile.FromTable |
---|
ADD_PLAN, bestAccessPath, bestCostEstimate, bestSortAvoidancePath, correlationName, corrTableName, currentAccessPath, hashKeyColumns, initialCapacity, level, LOAD_PLAN, loadFactor, maxCapacity, origTableName, REMOVE_PLAN, tableNumber, tableProperties, trulyTheBestAccessPath, userSpecifiedJoinStrategy |
Fields inherited from class org.apache.derby.impl.sql.compile.ResultSetNode |
---|
costEstimate, cursorTargetTable, finalCostEstimate, insertSource, optimizer, referencedTableMap, resultColumns, resultSetNumber, scratchCostEstimate, statementResultSet |
Fields inherited from class org.apache.derby.impl.sql.compile.QueryTreeNode |
---|
AUTOINCREMENT_CREATE_MODIFY, AUTOINCREMENT_INC_INDEX, AUTOINCREMENT_IS_AUTOINCREMENT_INDEX, AUTOINCREMENT_START_INDEX, isPrivilegeCollectionRequired |
Constructor Summary | |
---|---|
RowResultSetNode()
|
Method Summary | |
---|---|
ResultSetNode |
addNewPredicate(Predicate predicate)
Add a new predicate to the list. |
(package private) void |
adjustForSortElimination()
Notify the underlying result set tree that the optimizer has chosen to "eliminate" a sort. |
void |
bindExpressions(FromList fromListParam)
Bind the expressions in this RowResultSetNode. |
void |
bindExpressionsWithTables(FromList fromListParam)
Bind the expressions in this ResultSetNode if it has tables. |
ResultSetNode |
bindNonVTITables(DataDictionary dataDictionary,
FromList fromListParam)
Bind the non VTI tables in this ResultSetNode. |
void |
bindTargetExpressions(FromList fromListParam)
Bind the expressions in the target list. |
void |
bindUntypedNullsToResultColumns(ResultColumnList bindingRCL)
Bind any untyped null nodes to the types in the given ResultColumnList. |
private boolean |
canWeCacheResults()
|
(package private) ResultSetNode |
enhanceRCLForInsert(InsertNode target,
boolean inOrder,
int[] colMap)
Modify the RCL of this node to match the target of the insert. |
ResultSetNode |
ensurePredicateList(int numTables)
Ensure that the top of the RSN tree has a PredicateList. |
CostEstimate |
estimateCost(OptimizablePredicateList predList,
ConglomerateDescriptor cd,
CostEstimate outerCost,
Optimizer optimizer,
RowOrdering rowOrdering)
Estimate the cost of scanning this Optimizable using the given predicate list with the given conglomerate. |
boolean |
flattenableInFromSubquery(FromList fromList)
Evaluate whether or not the subquery in a FromSubquery is flattenable. |
void |
generate(ActivationClassBuilder acb,
MethodBuilder mb)
The generated ResultSet will be: RowResultSet -- for the VALUES clause |
java.lang.String |
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. |
ResultColumn |
getMatchingColumn(ColumnReference columnReference)
Try to find a ResultColumn in the table represented by this FromTable that matches the name in the given ColumnReference. |
void |
init(java.lang.Object valuesClause,
java.lang.Object tableProperties)
Initializer for a RowResultSetNode. |
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. |
ResultSetNode |
optimize(DataDictionary dataDictionary,
PredicateList predicateList,
double outerRows)
Optimize this SelectNode. |
(package private) void |
optimizeSubqueries(DataDictionary dd,
double rowCount)
Optimize any subqueries that haven't been optimized any where else. |
ResultSetNode |
preprocess(int numTables,
GroupByList gbl,
FromList fromList)
Put a ProjectRestrictNode on top of each FromTable in the FromList. |
void |
printSubNodes(int depth)
Prints the sub-nodes of this object. |
(package private) void |
pushOffsetFetchFirst(ValueNode offset,
ValueNode fetchFirst)
Push down the offset and fetch first parameters, if any, to this node. |
(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. |
(package private) void |
replaceOrForbidDefaults(TableDescriptor ttd,
ResultColumnList tcl,
boolean allowDefaults)
Replace any DEFAULTs with the associated tree for the default if allowed, or flag (when inside top level set operator nodes). |
(package private) boolean |
returnsAtMostOneRow()
Return whether or not this ResultSet tree is guaranteed to return at most 1 row based on heuristics. |
(package private) void |
setTableConstructorTypes(ResultColumnList typeColumns)
Set the type of each parameter in the result column list for this table constructor. |
java.lang.String |
statementToString()
|
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 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 |
---|
SubqueryList subquerys
java.util.Vector aggregateVector
OrderByList orderByList
ValueNode offset
ValueNode fetchFirst
Constructor Detail |
---|
public RowResultSetNode()
Method Detail |
---|
public void init(java.lang.Object valuesClause, java.lang.Object tableProperties)
init
in class FromTable
valuesClause
- The result column list for the VALUES clause.tableProperties
- Properties list associated with the tablepublic java.lang.String toString()
toString
in class FromTable
public java.lang.String statementToString()
public void printSubNodes(int depth)
printSubNodes
in class ResultSetNode
depth
- The depth of this node in the treeResultSetNode enhanceRCLForInsert(InsertNode target, boolean inOrder, int[] colMap) throws StandardException
enhanceRCLForInsert
in class ResultSetNode
target
- the target node for the insertinOrder
- are source cols in same order as target cols?colMap
- int array representation of correspondence between
RCLs - colmap[i] = -1 -> missing in current RCL
colmap[i] = j -> targetRCL(i) <-> thisRCL(j+1)
StandardException
- Thrown on errorpublic CostEstimate estimateCost(OptimizablePredicateList predList, ConglomerateDescriptor cd, CostEstimate outerCost, Optimizer optimizer, RowOrdering rowOrdering) throws StandardException
Optimizable
estimateCost
in interface Optimizable
estimateCost
in class FromTable
predList
- The predicate list to optimize againstcd
- The conglomerate descriptor to get the cost ofouterCost
- The estimated cost of the part of the plan outer
to this optimizable.optimizer
- The optimizer to use to help estimate the costrowOrdering
- The row ordering for all the tables in the
join order, including this one.
StandardException
- Thrown on errorOptimizable.estimateCost(org.apache.derby.iapi.sql.compile.OptimizablePredicateList, org.apache.derby.iapi.sql.dictionary.ConglomerateDescriptor, org.apache.derby.iapi.sql.compile.CostEstimate, org.apache.derby.iapi.sql.compile.Optimizer, org.apache.derby.iapi.sql.compile.RowOrdering)
public ResultSetNode bindNonVTITables(DataDictionary dataDictionary, FromList fromListParam) throws StandardException
bindNonVTITables
in class ResultSetNode
dataDictionary
- The DataDictionary to use for bindingfromListParam
- FromList to use/append to.
StandardException
- Thrown on errorpublic void bindExpressions(FromList fromListParam) throws StandardException
bindExpressions
in class ResultSetNode
fromListParam
- FromList to use/append to.
StandardException
- Thrown on errorpublic void bindExpressionsWithTables(FromList fromListParam) throws StandardException
bindExpressionsWithTables
in class ResultSetNode
fromListParam
- FromList to use/append to.
StandardException
- Thrown on errorpublic void bindTargetExpressions(FromList fromListParam) throws StandardException
bindTargetExpressions
in class ResultSetNode
StandardException
- Thrown on errorpublic void bindUntypedNullsToResultColumns(ResultColumnList bindingRCL) throws StandardException
bindUntypedNullsToResultColumns
in class ResultSetNode
bindingRCL
- The ResultColumnList with the types to bind to.
StandardException
- Thrown on errorpublic ResultColumn getMatchingColumn(ColumnReference columnReference) throws StandardException
getMatchingColumn
in class ResultSetNode
columnReference
- The columnReference whose name we're looking
for in the given table.
StandardException
- Thrown on errorpublic java.lang.String getExposedName() throws StandardException
getExposedName
in class FromTable
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 errorvoid pushOrderByList(OrderByList orderByList)
pushOrderByList
in class ResultSetNode
orderByList
- The order by listvoid pushOffsetFetchFirst(ValueNode offset, ValueNode fetchFirst)
pushOffsetFetchFirst
in class ResultSetNode
offset
- the OFFSET, if anyfetchFirst
- the OFFSET FIRST, if anypublic ResultSetNode preprocess(int numTables, GroupByList gbl, FromList fromList) throws StandardException
preprocess
in class ResultSetNode
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 ResultSetNode addNewPredicate(Predicate predicate) throws StandardException
addNewPredicate
in class ResultSetNode
predicate
- The predicate to add
StandardException
- Thrown on errorpublic boolean flattenableInFromSubquery(FromList fromList)
flattenableInFromSubquery
in class ResultSetNode
fromList
- The outer from list
public ResultSetNode optimize(DataDictionary dataDictionary, PredicateList predicateList, double outerRows) throws StandardException
optimize
in class ResultSetNode
dataDictionary
- The DataDictionary to use for optimizationpredicateList
- The predicate list to optimize againstouterRows
- The number of outer joining rows
StandardException
- Thrown on errorpublic Optimizable modifyAccessPath(JBitSet outerTables) throws StandardException
Optimizable
modifyAccessPath
in interface Optimizable
modifyAccessPath
in class FromTable
outerTables
- Bit map of the tables that are outer to this one
in the join order.
StandardException
- Thrown on errorOptimizable.modifyAccessPath(org.apache.derby.iapi.util.JBitSet)
public ResultSetNode modifyAccessPaths() throws StandardException
ResultSetNode
modifyAccessPaths
in class ResultSetNode
StandardException
- Thrown on errorResultSetNode.modifyAccessPaths()
boolean returnsAtMostOneRow()
returnsAtMostOneRow
in class ResultSetNode
void setTableConstructorTypes(ResultColumnList typeColumns) throws StandardException
setTableConstructorTypes
in class ResultSetNode
typeColumns
- The ResultColumnList containing the desired result
types.
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 errorvoid replaceOrForbidDefaults(TableDescriptor ttd, ResultColumnList tcl, boolean allowDefaults) throws StandardException
replaceOrForbidDefaults
in class ResultSetNode
ttd
- The TableDescriptor for the target table.tcl
- The RCL for the target table.allowDefaults
- true if allowed
StandardException
- Thrown on errorvoid optimizeSubqueries(DataDictionary dd, double rowCount) throws StandardException
optimizeSubqueries
in class FromTable
StandardException
- Thrown on errorvoid adjustForSortElimination()
ResultSetNode
adjustForSortElimination
in class ResultSetNode
ResultSetNode.adjustForSortElimination()
private boolean canWeCacheResults() throws StandardException
StandardException
|
Built on Thu 2011-03-10 11:54:14+0000, from revision ??? | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |