本文整理汇总了C++中CANodeIdSet类的典型用法代码示例。如果您正苦于以下问题:C++ CANodeIdSet类的具体用法?C++ CANodeIdSet怎么用?C++ CANodeIdSet使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CANodeIdSet类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getPotentialOutputs
ValueIdSet AppliedStatMan::getPotentialOutputs(
const CANodeIdSet & jbbcsNodeSet)
{
ValueIdSet potentialOutputs;
for (CANodeId jbbc = jbbcsNodeSet.init();
jbbcsNodeSet.next(jbbc);
jbbcsNodeSet.advance(jbbc))
{
if (NodeAnalysis * jbbcNodeAnalysis = jbbc.getNodeAnalysis())
{
ValueIdSet outputs;
const Join * jbbcParentJoin = jbbcNodeAnalysis->getJBBC()->
getOriginalParentJoin();
if((!jbbcParentJoin) ||
(jbbcParentJoin && jbbcParentJoin->isInnerNonSemiJoin()))
outputs = jbbcNodeAnalysis->getOriginalExpr()->\
getGroupAttr()->getCharacteristicOutputs();
else if (jbbcParentJoin->isLeftJoin())
outputs = jbbcParentJoin->nullInstantiatedOutput();
potentialOutputs.insert(outputs);
}
}
return potentialOutputs;
} // AppliedStatMan::getPotentialOutputs
示例2: RelExpr
MultiJoin::MultiJoin(const JBBSubset & jbbSubset,
CollHeap *oHeap)
: RelExpr(REL_MULTI_JOIN, NULL, NULL, oHeap)
, jbbSubset_(jbbSubset)
, childrenMap_(oHeap)
, scheduledLSRs_(oHeap)
{
// Need to initialize the childrenMap
// This will set all children to NULL
CANodeIdSet jbbcs = jbbSubset_.getJBBCs();
Lng32 index = 0;
for (CANodeId x= jbbcs.init();
jbbcs.next(x);
jbbcs.advance(x) )
{
JBBCExprGroupEntry* entry = new (oHeap)
JBBCExprGroupEntry(x, (RelExpr*)NULL, oHeap);
childrenMap_.insertAt(index, entry);
index++;
}
lsrC_ = new (oHeap) LSRConfidence(oHeap);
#pragma warning (disable : 4018) //warning elimination
CMPASSERT (getArity() == jbbcs.entries());
#pragma warning (default : 4018) //warning elimination
}
示例3: getStatsForCANodeIdSet
// this method assume jbbNodeSet contains nodes from the same JBB
EstLogPropSharedPtr AppliedStatMan::getStatsForCANodeIdSet(
const CANodeIdSet & jbbNodeSet)
{
EstLogPropSharedPtr outputEstLogProp;
CANodeIdSet combinedNodeSet = jbbNodeSet;
combinedNodeSet += *(jbbNodeSet.getJBBInput()->getNodeSet());
EstLogPropSharedPtr jBBInput = jbbNodeSet.getJBBInput();
if ((outputEstLogProp = getCachedStatistics(&combinedNodeSet)) == NULL)
outputEstLogProp = synthesizeLogProp(&jbbNodeSet, jBBInput);
return outputEstLogProp;
}
示例4: synthesizeLogProp
EstLogPropSharedPtr AppliedStatMan::synthesizeLogProp(
const CANodeIdSet * nodeSet,
EstLogPropSharedPtr &inLP)
{
EstLogPropSharedPtr outputEstLogProp;
CANodeIdSet combinedNodeSetWithInput = *nodeSet;
if (inLP->isCacheable())
{
CANodeIdSet * inNodeSet = inLP->getNodeSet();
// if inLP are cacheable these should have a nodeSet attached
// if not, assert in debug mode. In release mode, set the properties
// as not cacheable. These will then be looked into group attr cache
if (inNodeSet == NULL)
{
CCMPASSERT(inNodeSet != NULL);
inLP->setCacheableFlag(FALSE);
}
else
{
// check ASM cache for the estLogProps of nodeSet for the given
// inLP
combinedNodeSetWithInput.insert(*inNodeSet);
if ((outputEstLogProp =\
getCachedStatistics(&combinedNodeSetWithInput)) != NULL)
return outputEstLogProp;
}
}
if(nodeSet->entries() == 1)
return getStatsForCANodeId(nodeSet->getFirst(), inLP);
JBBSubset * jbbSubset = nodeSet->jbbcsToJBBSubset();
Join * preferredJoin = jbbSubset->getPreferredJoin();
//CMPASSERT(preferredJoin->isJoinFromMJSynthLogProp());
outputEstLogProp = preferredJoin->getGroupAttr()->outputLogProp(inLP);
return outputEstLogProp;
} // AppliedStatMan::synthesizeLogProp
示例5: setChildrenFromOrigExprs
// --------------------------------------------------------------------
// use origExprs from NodeAnalysis to set this MultiJoin childrenMap_
// --------------------------------------------------------------------
void MultiJoin::setChildrenFromOrigExprs(QueryAnalysis * qa)
{
CollHeap* outHeap = qa->outHeap();
CANodeIdSet jbbcs = jbbSubset_.getJBBCs();
CMPASSERT (qa->getJBBCs().contains(jbbcs));
Lng32 index = 0;
for (CANodeId x= jbbcs.init();
jbbcs.next(x);
jbbcs.advance(x) )
{
JBBCExprGroupEntry* entry = new (outHeap)
JBBCExprGroupEntry(x, qa->getNodeAnalysis(x)->getOriginalExpr(), outHeap);
childrenMap_.insertAt(index, entry);
index++;
}
return;
}
示例6: joinJBBChildren
EstLogPropSharedPtr AppliedStatMan::joinJBBChildren(
const CANodeIdSet & leftChildren,
const CANodeIdSet & rightChildren,
EstLogPropSharedPtr & inLP)
{
EstLogPropSharedPtr inputLP = inLP;
EstLogPropSharedPtr outputEstLogProp;
if(inputLP == (*GLOBAL_EMPTY_INPUT_LOGPROP))
inputLP = leftChildren.getJBBInput();
// Because there exist a nodeSet for the left, right and the outer
// child, hence these properties are cacheable. Check to see if the
// outputEstLogProp of the join for the given inLP exist in the cache
CANodeIdSet combinedNodeSet = leftChildren;
combinedNodeSet.insert(rightChildren);
CANodeIdSet * inNodeSet = NULL;
if (inputLP->isCacheable())
{
inNodeSet = inputLP->getNodeSet();
CANodeIdSet combinedWithInputNodeSet = combinedNodeSet;
combinedWithInputNodeSet.insert(*inNodeSet);
outputEstLogProp = getCachedStatistics(&combinedWithInputNodeSet);
}
if(outputEstLogProp == NULL)
outputEstLogProp = synthesizeLogProp(&combinedNodeSet, inputLP);
return outputEstLogProp;
} // AppliedStatMan::joinJBBChildren
示例7: setChildren
// --------------------------------------------------------------------
// use the input JBBCExprGroupMap to set this MultiJoin childrenMap_
// --------------------------------------------------------------------
void MultiJoin::setChildren(const JBBCExprGroupMap & map)
{
// everything here goes to statement heap
CollHeap* outHeap = CmpCommon::statementHeap();
CANodeIdSet jbbcs = jbbSubset_.getJBBCs();
CMPASSERT (map.getJBBCs().contains(jbbcs));
Lng32 index = 0;
for (CANodeId x= jbbcs.init();
jbbcs.next(x);
jbbcs.advance(x) )
{
JBBCExprGroupEntry* entry = new (outHeap)
JBBCExprGroupEntry(x, map.getExprGroupIdOfJBBC(x), outHeap);
childrenMap_.insertAt(index, entry);
index++;
}
return;
}
示例8: CCMPASSERT
Join * AppliedStatMan::formJoinExprWithCANodeSets(
const CANodeIdSet & leftNodeSet,
const CANodeIdSet & rightNodeSet,
EstLogPropSharedPtr& inLP,
const ValueIdSet * joinPreds,
const NABoolean cacheable)
{
EstLogPropSharedPtr leftEstLogProp = NULL;
EstLogPropSharedPtr rightEstLogProp = NULL;
CANodeIdSet * inputNodeSet = NULL;
if (inLP->isCacheable())
{
inputNodeSet = inLP->getNodeSet();
// if inLP are cacheable these should have a nodeSet attached
// if it is not for some reason, assert in debug mode. In release
// mode do not look for properties in ASM cache, instead get them
// from group attr cache.
if (inputNodeSet == NULL)
{
CCMPASSERT(inputNodeSet != NULL);
inLP->setCacheableFlag(FALSE);
}
}
CANodeIdSet commonNodeSet = leftNodeSet;
commonNodeSet.intersectSet(rightNodeSet);
// remove CANodeIds which are common to both left and the right children
// from the child, whose estLogProps are not cached. If the estLogProps
// of both children are not cached, then remove it from the child which
// has a larger CANodeIdSet associated with it.
CANodeIdSet tempLeftNodeSet = leftNodeSet;
CANodeIdSet tempRightNodeSet = rightNodeSet;
if (commonNodeSet.entries() > 0)
{
if (lookup(leftNodeSet))
tempRightNodeSet.subtractSet(commonNodeSet);
else
if (lookup(rightNodeSet))
tempLeftNodeSet.subtractSet(commonNodeSet);
else
if (leftNodeSet.entries() > rightNodeSet.entries())
tempLeftNodeSet.subtractSet(commonNodeSet);
else
tempRightNodeSet.subtractSet(commonNodeSet);
}
// get the estLogProps for the left and the right child.
// If these are not in the cache, then synthesize them incrementally
// starting from the left most JBBC in the JBBSubset
if (inputNodeSet)
{
// leftEstLogProp cached?
CANodeIdSet combinedNodeSetWithInput = tempLeftNodeSet;
combinedNodeSetWithInput.insert(*inputNodeSet);
leftEstLogProp = getCachedStatistics(&combinedNodeSetWithInput);
combinedNodeSetWithInput = tempRightNodeSet;
combinedNodeSetWithInput.insert(*inputNodeSet);
rightEstLogProp = getCachedStatistics(&combinedNodeSetWithInput);
}
if (leftEstLogProp == NULL)
leftEstLogProp = synthesizeLogProp(&tempLeftNodeSet, inLP);
// if the estimate logical properties have been computed for non-cacheable
// inLP, then these would not contain nodeSet. But we do need the nodeSet
// to compute potential output values. Hence we shall add this now
if (!leftEstLogProp->getNodeSet())
{
CANodeIdSet * copyLeftNodeSet = new (STMTHEAP) CANodeIdSet (tempLeftNodeSet);
leftEstLogProp->setNodeSet(copyLeftNodeSet);
}
if (rightEstLogProp == NULL)
rightEstLogProp = synthesizeLogProp(&tempRightNodeSet, inLP);
if (!rightEstLogProp->getNodeSet())
{
CANodeIdSet * copyRightNodeSet = new (STMTHEAP) CANodeIdSet (tempRightNodeSet);
rightEstLogProp->setNodeSet(copyRightNodeSet);
}
// Now form the join expressions with these EstLogProp,
// inLP and the joinPred will be same as those for which the
// estLogProp are to be synthesized. Cacheable flag would depend
// on whether left, right and the outer child are caheable, or
// if the join is on all columns or not
// Since the join expression consists of the left and the right
// JBBSubsets, the JBBSubset for this Join expression would be
//.........这里部分代码省略.........
示例9: hashASM
ULng32 AppliedStatMan::hashASM(const CANodeIdSet &key)
{
return key.hash();
} // AppliedStatMan::hashASM
示例10: Scan
// This method forms the join expression with the estLogProps.
Join * AppliedStatMan::formJoinExprWithEstLogProps(
const EstLogPropSharedPtr& leftEstLogProp,
const EstLogPropSharedPtr& rightEstLogProp,
const EstLogPropSharedPtr& inputEstLogProp,
const ValueIdSet * setOfPredicates,
const NABoolean cacheable,
JBBSubset * combinedJBBSubset)
{
// Form a join expression with these estLogProps.
// form the left child. Since the estLogProps of the left and the
// right children exist, these can be treated as Scan expressions
Scan * leftChildExpr = new STMTHEAP Scan();
GroupAttributes * galeft = new STMTHEAP GroupAttributes();
// set GroupAttr of the leftChild
galeft->inputLogPropList().insert(inputEstLogProp);
galeft->outputLogPropList().insert(leftEstLogProp);
CANodeIdSet * leftNodeSet = leftEstLogProp->getNodeSet();
CANodeId nodeId;
if (leftNodeSet)
{
if (leftNodeSet->entries() == 1)
{
nodeId = leftNodeSet->getFirst();
if(nodeId.getNodeAnalysis()->getTableAnalysis())
leftChildExpr->setTableAttributes(nodeId);
}
CostScalar minEstCard = leftNodeSet->getMinChildEstRowCount();
galeft->setMinChildEstRowCount(minEstCard);
}
leftChildExpr->setGroupAttr(galeft);
galeft->setLogExprForSynthesis(leftChildExpr);
// form the right child and set its groupAttr
Scan * rightChildExpr = new STMTHEAP Scan();
GroupAttributes * garight = new STMTHEAP GroupAttributes();
garight->inputLogPropList().insert(inputEstLogProp);
garight->outputLogPropList().insert(rightEstLogProp);
CANodeIdSet * rightNodeSet = rightEstLogProp->getNodeSet();
// xxx
JBBC * singleRightChild = NULL;
Join * singleRightChildParentJoin = NULL;
ValueIdSet leftOuterJoinFilterPreds;
if (rightNodeSet)
{
if (rightNodeSet->entries() == 1)
{
nodeId = rightNodeSet->getFirst();
if(nodeId.getNodeAnalysis()->getTableAnalysis())
rightChildExpr->setTableAttributes(nodeId);
if(nodeId.getNodeAnalysis()->getJBBC())
{
singleRightChild = nodeId.getNodeAnalysis()->getJBBC();
if(singleRightChild)
singleRightChildParentJoin = singleRightChild->getOriginalParentJoin();
}
}
CostScalar minEstCard = rightNodeSet->getMinChildEstRowCount();
garight->setMinChildEstRowCount(minEstCard);
}
rightChildExpr->setGroupAttr(garight);
garight->setLogExprForSynthesis(rightChildExpr);
Join * joinExpr = NULL;
if(singleRightChild &&
singleRightChildParentJoin)
{
if(singleRightChildParentJoin->isSemiJoin())
joinExpr = new STMTHEAP Join(leftChildExpr,
rightChildExpr,
REL_SEMIJOIN,
NULL);
if(singleRightChildParentJoin->isAntiSemiJoin())
joinExpr = new STMTHEAP Join(leftChildExpr,
rightChildExpr,
REL_ANTI_SEMIJOIN,
NULL);
if(singleRightChildParentJoin->isLeftJoin())
{
joinExpr = new STMTHEAP Join(leftChildExpr,
rightChildExpr,
REL_LEFT_JOIN,
NULL);
leftOuterJoinFilterPreds += singleRightChild->getLeftJoinFilterPreds();
}
//.........这里部分代码省略.........
示例11: getJBBSubset
Join* MultiJoin::createLeftLinearJoinTree
(const NAList<CANodeIdSet> * const leftDeepJoinSequence,
NAList<MJJoinDirective *> * joinDirectives) const
{
Join* result = NULL;
Join* currentJoin=NULL;
NABoolean reUseMultiJoins = FALSE;
//Set of all JBBCs in this multi-join.
//This set will be broken up to make the join tree
//representing the substitue.
//The loop below will construct the join tree,
//starting from the top join.
CANodeIdSet childSet = getJBBSubset().getJBBCs();
// variables used in loop below
MultiJoin * currentMJoin = (MultiJoin *) this;
// in an iteration this is the parent join
// e.g. when we are create JOIN3, this will
// be JOIN2
Join * parentJoin = NULL;
#ifdef _DEBUG
if ( CmpCommon::getDefault( NSK_DBG ) == DF_ON &&
CmpCommon::getDefault( NSK_DBG_MJRULES_TRACKING ) == DF_ON )
{
// LCOV_EXCL_START - dpm
CURRCONTEXT_OPTDEBUG->stream() << "Following is left deep join sequence: " << endl;
CURRCONTEXT_OPTDEBUG->stream() << endl;
// LCOV_EXCL_STOP
}
#endif
UInt32 numJoinChildren = leftDeepJoinSequence->entries();
CANodeId currentTable = NULL_CA_ID;
for (UInt32 i = 0; i < (numJoinChildren-1); i++)
{
//create JBBSubset representing a comprising component of the
//leftDeepJoinSequence.
JBBSubset * joinRightChild = ((*leftDeepJoinSequence)[i]).computeJBBSubset();
MJJoinDirective * joinDirective = (*joinDirectives)[i];
//remove all tables that will become right side of join
childSet.remove((*leftDeepJoinSequence)[i]);
#ifdef _DEBUG
//print the right child of the current join
if ( CmpCommon::getDefault( NSK_DBG ) == DF_ON &&
CmpCommon::getDefault( NSK_DBG_MJRULES_TRACKING ) == DF_ON )
{
CURRCONTEXT_OPTDEBUG->stream() << ((*leftDeepJoinSequence)[i]).getText() << endl; // LCOV_EXCL_LINE - dpm
}
#endif
//Get JBBSubset for left side of join
JBBSubset * joinLeftChild = childSet.computeJBBSubset();
//create the join by doing a split of the multi-join
currentJoin = currentMJoin->splitSubset(*joinLeftChild, *joinRightChild, reUseMultiJoins);
joinDirective->setupJoin(currentJoin);
if ( CmpCommon::getDefault(COMP_BOOL_120) == DF_OFF)
currentJoin->updatePotential(-3);
// if this is the first iteration
// set the result to be the top join
if (i == 0)
result = currentJoin;
//set the current multi-join to the left child of the
//join just created
//change getChild to child().getPointer
currentMJoin = (MultiJoin*) currentJoin->getChild(0);
//if there was a parent join, set the left child to
//point to the new join we just created i.e. currentJoin.
if (parentJoin)
parentJoin->setChild(0,currentJoin);
//set currentJoin to be the parent for the next iteration
parentJoin = currentJoin;
}
#ifdef _DEBUG
//print the left most child
if ( CmpCommon::getDefault( NSK_DBG ) == DF_ON &&
CmpCommon::getDefault( NSK_DBG_MJRULES_TRACKING ) == DF_ON )
{
// LCOV_EXCL_START - dpm
CURRCONTEXT_OPTDEBUG->stream() << ((*leftDeepJoinSequence)[(numJoinChildren-1)]).getText() << endl;
CURRCONTEXT_OPTDEBUG->stream() << endl;
// LCOV_EXCL_STOP
}
//.........这里部分代码省略.........
示例12: getStatsForCANodeId
// AppliedStatMan::setupASMCacheForJBB method will be called from
// Query::Analyze after connectivity analysis has been done and
// empty logical properties have been set.
void AppliedStatMan::setupASMCacheForJBB(JBB & jbb)
{
EstLogPropSharedPtr myEstLogProp;
// get all JBBCs of JBB
const CANodeIdSet jbbcNodeIdSet = jbb.getMainJBBSubset().getJBBCs();
CANodeId jbbcId;
// for all jbbcs
for (jbbcId = jbbcNodeIdSet.init();
jbbcNodeIdSet.next(jbbcId);
jbbcNodeIdSet.advance(jbbcId))
{
if (NodeAnalysis * jbbcNode = jbbcId.getNodeAnalysis())
{
// Evaluate local predicates only if it is a table.
RelExpr * jbbcExpr = jbbcNode->getOriginalExpr();
if ((jbbcNode->getTableAnalysis() != NULL) &&
(jbbcExpr->getOperatorType() == REL_SCAN))
{
// get the original expression of the jbbc
Scan * scanExpr = (Scan *) jbbcExpr;
ValueIdSet localPreds = scanExpr->getSelectionPredicates();
// if local predicates have already been computed, then skip
if ((localPreds.entries() > 0) || !(lookup(jbbcId)))
{
// check to see this GA has already been associated with
// a logExpr for synthesis. If not, then synthesize
// log. expression, and then apply local predicates to it
if (NOT scanExpr->getGroupAttr()->existsLogExprForSynthesis())
scanExpr->synthLogProp();
myEstLogProp = getStatsForCANodeId(jbbcId);
}
}
}
}
// Now do a second traversal of the JBB looking for join reducers
for (jbbcId = jbbcNodeIdSet.init();
jbbcNodeIdSet.next(jbbcId);
jbbcNodeIdSet.advance(jbbcId))
{
// now look for all two way joins for this child
if (jbbcId.getNodeAnalysis())
{
// get all JBBCs connected to this JBBC, and do a two-way
// join with all of them
CANodeIdSet connectedNodes = jbbcId.getNodeAnalysis()->\
getJBBC()->getJoinedJBBCs();
for (CANodeId connectedTable = connectedNodes.init();
connectedNodes.next(connectedTable);
connectedNodes.advance(connectedTable))
{
if (connectedTable.getNodeAnalysis())
{
// ASM does not concern itself with the order of the tables,
// hence it is possible that the join has already been computed
CANodeIdSet tableSet = jbbcId;
tableSet.insert(connectedTable);
if ((myEstLogProp = getCachedStatistics(&tableSet)) == NULL)
{
CANodeIdSet setForjbbcId(jbbcId);
CANodeIdSet setForConnectedTable(connectedTable);
myEstLogProp = joinJBBChildren(setForjbbcId, setForConnectedTable);
}
}
}
}
}
} // AppliedStatMan::setupASMCacheForJBB