Class ProjectRestrictNode
java.lang.Object
org.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.SingleChildResultSetNode
org.apache.derby.impl.sql.compile.ProjectRestrictNode
- All Implemented Interfaces:
Optimizable, Visitable
A ProjectRestrictNode represents a result set for any of the basic DML
operations: SELECT, INSERT, UPDATE, and DELETE. For INSERT with
a VALUES clause, restriction will be null. For both INSERT and UPDATE,
the resultColumns in the selectList will contain the names of the columns
being inserted into or updated.
NOTE: A ProjectRestrictNode extends FromTable since it can exist in a FromList.
-
Nested Class Summary
Nested classes/interfaces inherited from class ResultSetNode
ResultSetNode.QueryExpressionClauses -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate boolean(package private) ValueNodeConstant expressions to be evaluated here.private boolean(package private) SubqueryListList of subqueries in projection(package private) ValueNodeThe ValueNode for the restriction to be evaluated here.(package private) PredicateListRestriction as a PredicateList(package private) SubqueryListList of subqueries in restrictionprivate Stringprivate booleanUsed withvalidatingBaseTableCIDto validating deferred check constraints.Fields inherited from class SingleChildResultSetNode
childResult, hasTrulyTheBestAccessPathFields inherited from class FromTable
ADD_PLAN, bestAccessPath, bestCostEstimate, bestSortAvoidancePath, correlationName, corrTableName, currentAccessPath, hashKeyColumns, initialCapacity, level, LOAD_PLAN, loadFactor, maxCapacity, origTableName, REMOVE_PLAN, tableNumber, tableProperties, trulyTheBestAccessPath, userSpecifiedJoinStrategyFields inherited from class QueryTreeNode
AUTOINCREMENT_CREATE_MODIFY, AUTOINCREMENT_CYCLE, AUTOINCREMENT_INC_INDEX, AUTOINCREMENT_IS_AUTOINCREMENT_INDEX, AUTOINCREMENT_START_INDEX -
Constructor Summary
ConstructorsConstructorDescriptionProjectRestrictNode(ResultSetNode childResult, ResultColumnList projection, ValueNode restriction, PredicateList restrictionList, SubqueryList projectSubquerys, SubqueryList restrictSubquerys, Properties tableProperties, ContextManager cm) Constructor for a ProjectRestrictNode. -
Method Summary
Modifier and TypeMethodDescription(package private) voidAccept the visitor for all visitable children of this node.(package private) ResultSetNodeaddNewPredicate(Predicate predicate) Add a new predicate to the list.(package private) ResultSetNodeconsiderMaterialization(JBitSet outerTables) Consider materialization for this ResultSet tree if it is valid and cost effective (It is not valid if incorrect results would be returned.)booleanCheck whether this optimizable's sort avoidance path should be considered.(package private) ResultSetNodeensurePredicateList(int numTables) Ensure that the top of the RSN tree has a PredicateList.booleanfeasibleJoinStrategy(OptimizablePredicateList predList, Optimizer optimizer) Is the current proposed join strategy for this optimizable feasible given the predicate list?(package private) booleanflattenableInFromSubquery(FromList fromList) Evaluate whether or not the subquery in a FromSubquery is flattenable.(package private) voidgenerate(ActivationClassBuilder acb, MethodBuilder mb) For joins, the tree will be (nodes are left out if the clauses are empty): ProjectRestrictResultSet -- for the having and the select list SortResultSet -- for the group by list ProjectRestrictResultSet -- for the where and the select list (if no group or having) the result set for the fromListprivate voidgenerateMinion(ExpressionClassBuilder acb, MethodBuilder mb, boolean genChildResultSet) Logic shared by generate() and generateResultSet().(package private) voidBypass the generation of this No-Op ProjectRestrict, and just generate its child result set.(package private) voidGeneral logic shared by Core compilation.Get the best access path for this Optimizable.Get the best sort-avoidance path for this Optimizable.(package private) CostEstimateGet the CostEstimate for this ProjectRestrictNode.Get the current access path under consideration for this Optimizable(package private) CostEstimateGet the final CostEstimate for this ProjectRestrictNode.(package private) FromTablegetFromTableByName(String name, String schemaName, boolean exactMatch) Determine whether or not the specified name is an exposed name in the current query block.(package private) PredicateListReturn the restriction list from this node.intGet this Optimizable's table numberGet the best access path overall for this Optimizable.(package private) StringReturn the user specified join strategy, if any for this table.(package private) booleanisPossibleDistinctScan(Set<BaseColumnNode> distinctColumns) Is it possible to do a distinct scan on this ResultSet tree.booleanlegalJoinOrder(JBitSet assignedTableMap) Can this Optimizable appear at the current location in the join order.(package private) voidMark the underlying scan as a distinct scan.modifyAccessPath(JBitSet outerTables) Modify the access path for this Optimizable, as necessary.booleannextAccessPath(Optimizer optimizer, OptimizablePredicateList predList, RowOrdering rowOrdering) Choose the next access path to evaluate for this Optimizable.(package private) booleanDetermine whether this ProjectRestrict does anything.(package private) ResultSetNodeoptimize(DataDictionary dataDictionary, PredicateList predicates, double outerRows) Optimize this ProjectRestrictNode.optimizeIt(Optimizer optimizer, OptimizablePredicateList predList, CostEstimate outerCost, RowOrdering rowOrdering) Choose the best access path for this Optimizable.(package private) ResultSetNodepreprocess(int numTables, GroupByList gbl, FromList fromList) Put a ProjectRestrictNode on top of each FromTable in the FromList.(package private) voidprintSubNodes(int depth) Prints the sub-nodes of this object.voidpullOptPredicates(OptimizablePredicateList optimizablePredicates) Pull all the OptimizablePredicates from this Optimizable and put them in the given OptimizablePredicateList.(package private) voidpushExpressions(PredicateList predicateList) Push expressions down to the first ResultSetNode which can do expression evaluation and has the same referenced table map.(package private) voidpushOffsetFetchFirst(ValueNode offset, ValueNode fetchFirst, boolean hasJDBClimitClause) Push down the offset and fetch first parameters, if any, to the underlying child result set.booleanpushOptPredicate(OptimizablePredicate optimizablePredicate) Push an OptimizablePredicate down, if this node accepts it.(package private) voidpushOrderByList(OrderByList orderByList) 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.voidSet up a new level for order by and fetch/offset clauses.voidrememberAsBest(int planType, Optimizer optimizer) Remember the current access path as the best one (so far).voidMark this optimizable so that its sort avoidance path will be considered.private OptimizableThis method creates a HashTableNode between the PRN and it's child when the optimizer chooses hash join on an arbitrary (non-FBT) result set tree.(package private) voidsetRefActionInfo(long fkIndexConglomId, int[] fkColArray, String parentResultSetId, boolean dependentScan) set the Information gathered from the parent table that is required to perform a referential action on dependent table.(package private) voidsetRestriction(ValueNode restriction) (package private) voidsetValidatingCheckConstraints(String baseTableUUIDString) voidstartOptimizing(Optimizer optimizer, RowOrdering rowOrdering) Begin the optimization process for this Optimizable.doubleuniqueJoin(OptimizablePredicateList predList) Does this optimizable have a uniqueness condition on the given predicate list, and if so, how many unique keys will be returned per scan.(package private) intGet the lock mode for the target of an update statement (a delete or update).voidverifyProperties(DataDictionary dDictionary) Verify that the Properties list with optimizer overrides, if specified, is validMethods inherited from class SingleChildResultSetNode
adjustForSortElimination, adjustForSortElimination, changeAccessPath, decrementLevel, forUpdate, getChildResult, initAccessPaths, isNotExists, isOneRowResultSet, isOrderedOn, modifyAccessPaths, referencesSessionSchema, referencesTarget, reflectionNeededForProjection, setChildResult, setLevel, subqueryReferencesTarget, updateBestPlanMapMethods inherited from class FromTable
assignCostEstimate, canBeOrdered, columnsAreUpdatable, convertAbsoluteToRelativeColumnPosition, cursorTargetTable, estimateCost, fillInReferencedTableMap, flatten, getBaseTableName, getCorrelationName, getCostEstimate, getExposedName, getLevel, getMergeTableID, getName, getNumColumnsReturned, getOrigTableName, getProperties, getResultColumnsForList, getSchemaDescriptor, getSchemaDescriptor, getScratchCostEstimate, getTableDescriptor, getTableName, hashKeyColumns, hasLargeObjectColumns, hasTableNumber, initialCapacity, isBaseTable, isCoveringIndex, isFlattenableJoinNode, isJoinColumnForRightOuterJoin, isMaterializable, isOneRowScan, isTargetTable, loadFactor, LOJ_reorderable, markUpdatableByCursor, maxCapacity, memoryUsageOK, needsSpecialRCLBinding, optimizeSubqueries, rememberJoinStrategyAsBest, resetJoinStrategies, setCostEstimateCost, setHashKeyColumns, setMergeTableID, setOrigTableName, setProperties, setTableNumber, supportsMultipleInstantiations, tellRowOrderingAboutConstantColumns, toString, transformOuterJoinsMethods inherited from class ResultSetNode
assignResultSetNumber, bindExpressions, bindExpressionsWithTables, bindNonVTITables, bindResultColumns, bindResultColumns, bindTargetExpressions, bindUntypedNullsToResultColumns, bindVTITables, columnTypesAndLengthsMatch, enhanceRCLForInsert, generateNormalizationResultSet, genProjectRestrict, genProjectRestrict, genProjectRestrictForReordering, getAllResultColumns, getCandidateFinalCostEstimate, getCursorTargetTable, getFromList, getMatchingColumn, getNewCostEstimate, getOptimizer, getOptimizerImpl, getRCLForInsert, getReferencedTableMap, getResultColumns, getResultSetNumber, getScratchCostEstimate, isCursorTargetTable, isInsertSource, isStatementResultSet, isUpdatableCursor, LOJgetReferencedTables, makeResultDescription, makeResultDescriptors, markAsCursorTargetTable, markStatementResultSet, modifyAccessPaths, notCursorTargetTable, notFlattenableJoin, numDistinctAggregates, parseDefault, performMaterialization, printQueryExpressionSuffixClauses, projectResultColumns, rejectParameters, rejectXMLValues, renameGeneratedResultNames, replaceOrForbidDefaults, returnsAtMostOneRow, setCandidateFinalCostEstimate, setCostEstimate, setCursorTargetTable, setInsertSource, setOptimizer, setReferencedTableMap, setResultColumns, setResultSetNumber, setResultToBooleanTrueNode, setScratchCostEstimate, setTableConstructorTypes, verifySelectStarSubqueryMethods inherited from class QueryTreeNode
accept, addTag, addUDTUsagePriv, addUDTUsagePriv, bindOffsetFetch, bindRowMultiSet, bindUserCatalogType, bindUserType, checkReliability, checkReliability, convertDefaultNode, copyTagsFrom, createTypeDependency, debugFlush, debugPrint, disablePrivilegeCollection, formatNodeString, generateAuthorizeCheck, getBeginOffset, getClassFactory, getCompilerContext, getContext, getContextManager, getDataDictionary, getDependencyManager, getEndOffset, getExecutionFactory, getGenericConstantActionFactory, getIntProperty, getLanguageConnectionContext, getLongProperty, getNullNode, getOffsetOrderedNodes, getOptimizerFactory, getOptimizerTracer, getParameterTypes, getSchemaDescriptor, getSchemaDescriptor, getStatementType, getTableDescriptor, getTypeCompiler, getUDTDesc, isAtomic, isPrivilegeCollectionRequired, isSessionSchema, isSessionSchema, makeConstantAction, makeTableName, makeTableName, nodeHeader, optimizerTracingIsOn, orReliability, parseSearchCondition, parseStatement, printLabel, resolveTableToSynonym, setBeginOffset, setEndOffset, stackPrint, taggedWith, treePrint, treePrint, verifyClassExistMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface Optimizable
getDataDictionary, getOptimizerTracer, getReferencedTableMap, getResultSetNumber, optimizerTracingIsOnMethods inherited from interface Visitable
accept, addTag, taggedWith
-
Field Details
-
restriction
ValueNode restrictionThe ValueNode for the restriction to be evaluated here. -
constantRestriction
ValueNode constantRestrictionConstant expressions to be evaluated here. -
restrictionList
PredicateList restrictionListRestriction as a PredicateList -
projectSubquerys
SubqueryList projectSubquerysList of subqueries in projection -
restrictSubquerys
SubqueryList restrictSubquerysList of subqueries in restriction -
accessPathModified
private boolean accessPathModified -
getTableNumberHere
private boolean getTableNumberHere -
validatingCheckConstraints
private boolean validatingCheckConstraintsUsed withvalidatingBaseTableCIDto validating deferred check constraints. -
validatingBaseTableUUIDString
-
-
Constructor Details
-
ProjectRestrictNode
ProjectRestrictNode(ResultSetNode childResult, ResultColumnList projection, ValueNode restriction, PredicateList restrictionList, SubqueryList projectSubquerys, SubqueryList restrictSubquerys, Properties tableProperties, ContextManager cm) Constructor for a ProjectRestrictNode.- Parameters:
childResult- The child ResultSetNodeprojection- The result column list for the projectionrestriction- An expression representing the restriction to be evaluated here.restrictionList- Restriction as a PredicateListprojectSubquerys- List of subqueries in the projectionrestrictSubquerys- List of subqueries in the restrictiontableProperties- Properties list associated with the tablecm- The context manager
-
-
Method Details
-
nextAccessPath
public boolean nextAccessPath(Optimizer optimizer, OptimizablePredicateList predList, RowOrdering rowOrdering) throws StandardException Description copied from interface:OptimizableChoose the next access path to evaluate for this Optimizable.- Specified by:
nextAccessPathin interfaceOptimizable- Overrides:
nextAccessPathin classFromTable- Parameters:
optimizer- Optimizer to use.predList- The predicate list for this optimizable. The optimizer always passes null, and it is up to the optimizable object to pass along its own predicate list, if appropriate, when delegating this method.rowOrdering- The row ordering for all the outer tables in the join order. This method will add the ordering of the next access path to the given RowOrdering.- Returns:
- true means another access path was chosen, false means no more access paths to evaluate.
- Throws:
StandardException- Thrown on error- See Also:
-
rememberAsBest
Description copied from interface:OptimizableRemember the current access path as the best one (so far).- Specified by:
rememberAsBestin interfaceOptimizable- Overrides:
rememberAsBestin classFromTable- Parameters:
planType- The type of plan (one of Optimizer.NORMAL_PLAN or Optimizer.SORT_AVOIDANCE_PLAN)optimizer- The OptimizerImpl that is telling this Optimizable to remember its current path as "truly the best".- Throws:
StandardException- Thrown on error- See Also:
-
startOptimizing
Description copied from interface:OptimizableBegin the optimization process for this Optimizable. This can be called many times for an Optimizable while optimizing a query - it will typically be called every time the Optimizable is placed in a potential join order.- Specified by:
startOptimizingin interfaceOptimizable- Overrides:
startOptimizingin classFromTable- See Also:
-
getTableNumber
public int getTableNumber()Description copied from interface:OptimizableGet this Optimizable's table number- Specified by:
getTableNumberin interfaceOptimizable- Overrides:
getTableNumberin classFromTable- See Also:
-
optimizeIt
public CostEstimate optimizeIt(Optimizer optimizer, OptimizablePredicateList predList, CostEstimate outerCost, RowOrdering rowOrdering) throws StandardException Description copied from interface:OptimizableChoose the best access path for this Optimizable.- Specified by:
optimizeItin interfaceOptimizable- Overrides:
optimizeItin classFromTable- Parameters:
optimizer- Optimizer to use.predList- The predicate list to optimize againstouterCost- The CostEstimate for the outer tables in the join order, telling how many times this Optimizable will be scanned.rowOrdering- The row ordering for all the tables in the join order, including this one.- Returns:
- The optimizer's estimated cost of the best access path.
- Throws:
StandardException- Thrown on error- See Also:
-
feasibleJoinStrategy
public boolean feasibleJoinStrategy(OptimizablePredicateList predList, Optimizer optimizer) throws StandardException Description copied from interface:OptimizableIs the current proposed join strategy for this optimizable feasible given the predicate list?- Specified by:
feasibleJoinStrategyin interfaceOptimizable- Overrides:
feasibleJoinStrategyin classFromTable- Parameters:
predList- The predicate list that has been pushed down to this optimizableoptimizer- The optimizer to use.- Returns:
- true means feasible
- Throws:
StandardException- Thrown on error- See Also:
-
getCurrentAccessPath
Description copied from interface:OptimizableGet the current access path under consideration for this Optimizable- Specified by:
getCurrentAccessPathin interfaceOptimizable- Overrides:
getCurrentAccessPathin classFromTable- See Also:
-
getBestAccessPath
Description copied from interface:OptimizableGet the best access path for this Optimizable.- Specified by:
getBestAccessPathin interfaceOptimizable- Overrides:
getBestAccessPathin classFromTable- See Also:
-
getBestSortAvoidancePath
Description copied from interface:OptimizableGet the best sort-avoidance path for this Optimizable.- Specified by:
getBestSortAvoidancePathin interfaceOptimizable- Overrides:
getBestSortAvoidancePathin classFromTable- See Also:
-
getTrulyTheBestAccessPath
Description copied from interface:OptimizableGet the best access path overall for this Optimizable.- Specified by:
getTrulyTheBestAccessPathin interfaceOptimizable- Overrides:
getTrulyTheBestAccessPathin classSingleChildResultSetNode- See Also:
-
rememberSortAvoidancePath
public void rememberSortAvoidancePath()Description copied from interface:OptimizableMark this optimizable so that its sort avoidance path will be considered.- Specified by:
rememberSortAvoidancePathin interfaceOptimizable- Overrides:
rememberSortAvoidancePathin classFromTable- See Also:
-
considerSortAvoidancePath
public boolean considerSortAvoidancePath()Description copied from interface:OptimizableCheck whether this optimizable's sort avoidance path should be considered.- Specified by:
considerSortAvoidancePathin interfaceOptimizable- Overrides:
considerSortAvoidancePathin classFromTable- See Also:
-
pushOptPredicate
Description copied from interface:OptimizablePush an OptimizablePredicate down, if this node accepts it.- Specified by:
pushOptPredicatein interfaceOptimizable- Overrides:
pushOptPredicatein classFromTable- Parameters:
optimizablePredicate- OptimizablePredicate to push down.- Returns:
- Whether or not the predicate was pushed down.
- Throws:
StandardException- Thrown on error- See Also:
-
pullOptPredicates
public void pullOptPredicates(OptimizablePredicateList optimizablePredicates) throws StandardException Description copied from interface:OptimizablePull all the OptimizablePredicates from this Optimizable and put them in the given OptimizablePredicateList.- Specified by:
pullOptPredicatesin interfaceOptimizable- Overrides:
pullOptPredicatesin classSingleChildResultSetNode- Parameters:
optimizablePredicates- The list to put the pulled predicates in.- Throws:
StandardException- Thrown on error- See Also:
-
modifyAccessPath
Description copied from interface:OptimizableModify the access path for this Optimizable, as necessary. This includes things like adding a result set to translate from index rows to base rows- Specified by:
modifyAccessPathin interfaceOptimizable- Overrides:
modifyAccessPathin classFromTable- Parameters:
outerTables- Bit map of the tables that are outer to this one in the join order.- Returns:
- The (potentially new) Optimizable at the top of the tree.
- Throws:
StandardException- Thrown on error- See Also:
-
replaceWithHashTableNode
This method creates a HashTableNode between the PRN and it's child when the optimizer chooses hash join on an arbitrary (non-FBT) result set tree. We divide up the restriction list into 3 parts and distribute those parts as described below.- Returns:
- The new (same) top of our result set tree.
- Throws:
StandardException- Thrown on error
-
verifyProperties
Description copied from interface:OptimizableVerify that the Properties list with optimizer overrides, if specified, is valid- Specified by:
verifyPropertiesin interfaceOptimizable- Overrides:
verifyPropertiesin classFromTable- Parameters:
dDictionary- The DataDictionary to use.- Throws:
StandardException- Thrown on error- See Also:
-
legalJoinOrder
Description copied from interface:OptimizableCan this Optimizable appear at the current location in the join order. In other words, have the Optimizable's dependencies been satisfied?- Specified by:
legalJoinOrderin interfaceOptimizable- Overrides:
legalJoinOrderin classFromTable- Parameters:
assignedTableMap- The tables that have been placed so far in the join order.- Returns:
- Where or not this Optimizable can appear at the current location in the join order.
- See Also:
-
uniqueJoin
Description copied from interface:OptimizableDoes this optimizable have a uniqueness condition on the given predicate list, and if so, how many unique keys will be returned per scan.- Specified by:
uniqueJoinin interfaceOptimizable- Overrides:
uniqueJoinin classFromTable- Parameters:
predList- The predicate list to check- Returns:
- <= 0 means there is no uniqueness condition > 0 means there is a uniqueness condition, and the return value is the number of rows per scan.
- Throws:
StandardException- Thrown on error- See Also:
-
getRestrictionList
PredicateList getRestrictionList()Return the restriction list from this node.- Returns:
- The restriction list from this node.
-
getUserSpecifiedJoinStrategy
String getUserSpecifiedJoinStrategy()Return the user specified join strategy, if any for this table.- Overrides:
getUserSpecifiedJoinStrategyin classFromTable- Returns:
- The user specified join strategy, if any for this table.
-
printSubNodes
void printSubNodes(int depth) Prints the sub-nodes of this object. See QueryTreeNode.java for how tree printing is supposed to work.- Overrides:
printSubNodesin classSingleChildResultSetNode- Parameters:
depth- The depth of this node in the tree
-
preprocess
ResultSetNode preprocess(int numTables, GroupByList gbl, FromList fromList) throws StandardException 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.- Overrides:
preprocessin classSingleChildResultSetNode- Parameters:
numTables- Number of tables in the DML Statementgbl- The group by list, if anyfromList- The from list, if any- Returns:
- The generated ProjectRestrictNode atop the original FromTable.
- Throws:
StandardException- Thrown on error
-
pushExpressions
Push expressions down to the first ResultSetNode which can do expression evaluation and has the same referenced table map. RESOLVE - This means only pushing down single table expressions to ProjectRestrictNodes today. Once we have a better understanding of how the optimizer will work, we can push down join clauses.- Overrides:
pushExpressionsin classSingleChildResultSetNode- Parameters:
predicateList- The PredicateList.- Throws:
StandardException- Thrown on error
-
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.- Overrides:
addNewPredicatein classSingleChildResultSetNode- Parameters:
predicate- The predicate to add- Returns:
- ResultSetNode The new top of the tree.
- Throws:
StandardException- Thrown on error
-
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. 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.- Overrides:
flattenableInFromSubqueryin classSingleChildResultSetNode- Parameters:
fromList- The outer from list- Returns:
- boolean Whether or not the FromSubquery is flattenable.
-
ensurePredicateList
Ensure that the top of the RSN tree has a PredicateList.- Overrides:
ensurePredicateListin classSingleChildResultSetNode- Parameters:
numTables- The number of tables in the query.- Returns:
- ResultSetNode A RSN tree with a node which has a PredicateList on top.
- Throws:
StandardException- Thrown on error
-
optimize
ResultSetNode optimize(DataDictionary dataDictionary, PredicateList predicates, double outerRows) throws StandardException Optimize this ProjectRestrictNode.- Overrides:
optimizein classSingleChildResultSetNode- Parameters:
dataDictionary- The DataDictionary to use for optimizationpredicates- The PredicateList to optimize. This should be a join predicate.outerRows- The number of outer joining rows- Returns:
- ResultSetNode The top of the optimized subtree
- Throws:
StandardException- Thrown on error
-
getCostEstimate
CostEstimate getCostEstimate()Get the CostEstimate for this ProjectRestrictNode.- Overrides:
getCostEstimatein classResultSetNode- Returns:
- The CostEstimate for this ProjectRestrictNode, which is the cost estimate for the child node.
-
getFinalCostEstimate
Get the final CostEstimate for this ProjectRestrictNode.- Overrides:
getFinalCostEstimatein classSingleChildResultSetNode- Returns:
- The final CostEstimate for this ProjectRestrictNode, which is the final cost estimate for the child node.
- Throws:
StandardException
-
generate
For joins, the tree will be (nodes are left out if the clauses are empty): ProjectRestrictResultSet -- for the having and the select list SortResultSet -- for the group by list ProjectRestrictResultSet -- for the where and the select list (if no group or having) the result set for the fromList- Overrides:
generatein classQueryTreeNode- Parameters:
acb- The ActivationClassBuilder for the class being builtmb- The method for the generated code to go into- Throws:
StandardException- Thrown on error
-
generateResultSet
General logic shared by Core compilation.- Overrides:
generateResultSetin classResultSetNode- Parameters:
acb- The ExpressionClassBuilder for the class being builtmb- The method the expression will go into- Throws:
StandardException- Thrown on error
-
generateMinion
private void generateMinion(ExpressionClassBuilder acb, MethodBuilder mb, boolean genChildResultSet) throws StandardException Logic shared by generate() and generateResultSet().- Parameters:
acb- The ExpressionClassBuilder for the class being builtmb- The method the expression will go into- Throws:
StandardException- Thrown on error
-
nopProjectRestrict
boolean nopProjectRestrict()Determine whether this ProjectRestrict does anything. If it doesn't filter out any rows or columns, it's a No-Op.- Returns:
- true if this ProjectRestrict is a No-Op.
-
generateNOPProjectRestrict
Bypass the generation of this No-Op ProjectRestrict, and just generate its child result set.- Throws:
StandardException- Thrown on error
-
considerMaterialization
Consider materialization for this ResultSet tree if it is valid and cost effective (It is not valid if incorrect results would be returned.)- Overrides:
considerMaterializationin classResultSetNode- Returns:
- Top of the new/same ResultSet tree.
- Throws:
StandardException- Thrown on error
-
getFromTableByName
FromTable getFromTableByName(String name, String schemaName, boolean exactMatch) throws StandardException Determine whether or not the specified name is an exposed name in the current query block.- Overrides:
getFromTableByNamein classSingleChildResultSetNode- Parameters:
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.- Returns:
- The FromTable, if any, with the exposed name.
- Throws:
StandardException- Thrown on error
-
updateTargetLockMode
int updateTargetLockMode()Get the lock mode for the target of an update statement (a delete or update). The update mode will always be row for CurrentOfNodes. It will be table if there is no where clause.- Overrides:
updateTargetLockModein classSingleChildResultSetNode- Returns:
- The lock mode
- See Also:
-
isPossibleDistinctScan
Is it possible to do a distinct scan on this ResultSet tree. (See SelectNode for the criteria.)- Overrides:
isPossibleDistinctScanin classResultSetNode- Parameters:
distinctColumns- the set of distinct columns- Returns:
- Whether or not it is possible to do a distinct scan on this ResultSet tree.
-
markForDistinctScan
void markForDistinctScan()Mark the underlying scan as a distinct scan.- Overrides:
markForDistinctScanin classResultSetNode
-
acceptChildren
Accept the visitor for all visitable children of this node.- Overrides:
acceptChildrenin classSingleChildResultSetNode- Parameters:
v- the visitor- Throws:
StandardException- on error
-
setRefActionInfo
void setRefActionInfo(long fkIndexConglomId, int[] fkColArray, String parentResultSetId, boolean dependentScan) set the Information gathered from the parent table that is required to perform a referential action on dependent table.- Overrides:
setRefActionInfoin classQueryTreeNode
-
setRestriction
-
pushQueryExpressionSuffix
public void pushQueryExpressionSuffix()Description copied from class:ResultSetNodeSet up a new level for order by and fetch/offset clauses. See Javadoc forResultSetNode.QueryExpressionClauses. Overridden by implementors of pushOrderByNode, pushOffsetFetchFirst.- Overrides:
pushQueryExpressionSuffixin classResultSetNode
-
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.- Overrides:
pushOrderByListin classResultSetNode- Parameters:
orderByList- The order by list
-
pushOffsetFetchFirst
Push down the offset and fetch first parameters, if any, to the underlying child result set.- Overrides:
pushOffsetFetchFirstin classResultSetNode- Parameters:
offset- the OFFSET, if anyfetchFirst- the OFFSET FIRST, if anyhasJDBClimitClause- true if the clauses were added by (and have the semantics of) a JDBC limit clause
-
setValidatingCheckConstraints
-