本文整理汇总了C++中Join::setSelectionPredicates方法的典型用法代码示例。如果您正苦于以下问题:C++ Join::setSelectionPredicates方法的具体用法?C++ Join::setSelectionPredicates怎么用?C++ Join::setSelectionPredicates使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Join
的用法示例。
在下文中一共展示了Join::setSelectionPredicates方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CCMPASSERT
// This method forms the join expression for join on JBBC specified by jbbcId
// inputEstLogProp should not be cacheable
Join * AppliedStatMan::formJoinExprForJoinOnJBBC(
CANodeIdSet jbbSubset,
CANodeId jbbcId,
const ValueIdSet * jbbcLocalPreds,
const ValueIdSet * joinPreds,
const EstLogPropSharedPtr& inputEstLogProp,
const NABoolean cacheable)
{
NABoolean origInputIsCacheable = inputEstLogProp->isCacheable();
if(origInputIsCacheable)
{
inputEstLogProp->setCacheableFlag(FALSE);
CCMPASSERT("Expecting Non Cacheable Input");
}
RelExpr * jbbcExpr = getExprForCANodeId(jbbcId, inputEstLogProp, jbbcLocalPreds);
jbbcExpr->getGroupAttr()->outputLogProp(inputEstLogProp);
RelExpr * jbbSubsetExpr = jbbSubset.jbbcsToJBBSubset()->getPreferredJoin();
if(!jbbSubsetExpr)
if(jbbSubset.entries()==1)
if(!inputEstLogProp->isCacheable())
{
inputEstLogProp->setCacheableFlag(TRUE);
jbbSubsetExpr = getExprForCANodeId(jbbSubset.getFirst(), inputEstLogProp);
inputEstLogProp->setCacheableFlag(FALSE);
}
else
jbbSubsetExpr = getExprForCANodeId(jbbSubset.getFirst(), inputEstLogProp);
else
{
CCMPASSERT("No Subset expression, need at least one entry in set");
}
RelExpr * leftChildExpr = jbbSubsetExpr;
RelExpr * rightChildExpr = jbbcExpr;
GroupAttributes * galeft = jbbSubsetExpr->getGroupAttr();
GroupAttributes * garight = jbbcExpr->getGroupAttr();
// xxx
JBBC * jbbc = jbbcId.getNodeAnalysis()->getJBBC();
Join * jbbcParentJoin = jbbc->getOriginalParentJoin();
ValueIdSet leftOuterJoinFilterPreds;
Join * joinExpr = NULL;
if(jbbcParentJoin)
{
if(jbbcParentJoin->isSemiJoin())
joinExpr = new STMTHEAP Join(leftChildExpr, rightChildExpr, REL_SEMIJOIN, NULL);
if(jbbcParentJoin->isAntiSemiJoin())
joinExpr = new STMTHEAP Join(leftChildExpr, rightChildExpr, REL_ANTI_SEMIJOIN, NULL);
if(jbbcParentJoin->isLeftJoin())
{
joinExpr = new STMTHEAP Join(leftChildExpr, rightChildExpr, REL_LEFT_JOIN, NULL);
leftOuterJoinFilterPreds += jbbc->getLeftJoinFilterPreds();
}
if(joinExpr)
{
joinExpr->setJoinPred(jbbc->getPredsWithPredecessors());
joinExpr->nullInstantiatedOutput().insert(jbbc->nullInstantiatedOutput());
}
}
if(!joinExpr)
{
// now form a JoinExpr with these left and right children.
joinExpr = new STMTHEAP Join(leftChildExpr, rightChildExpr, REL_JOIN, NULL);
}
ValueIdSet selPredsAndLOJFilter = leftOuterJoinFilterPreds;
selPredsAndLOJFilter += (*joinPreds);
joinExpr->setSelectionPredicates(selPredsAndLOJFilter);
// set groupAttr of this Join expression
GroupAttributes * gaJoin = new STMTHEAP GroupAttributes();
// set required outputs of Join as sum of characteristic
// outputs of the left and the right children
ValueIdSet requiredOutputs;
requiredOutputs.addSet(getPotentialOutputs(jbbSubset));
requiredOutputs.addSet(getPotentialOutputs(jbbcId));
gaJoin->setCharacteristicOutputs(requiredOutputs);
// set JBBSubset for this group, if all estLogProps are cacheable.
// Else JBBSubset is NULL
//.........这里部分代码省略.........
示例2: splitSubset
Join* MultiJoin::splitSubset(const JBBSubset & leftSet,
const JBBSubset & rightSet,
NABoolean reUseMJ) const
{
// At this point assert that none of the subsets has a group by member
CMPASSERT ( (jbbSubset_.getGB() == NULL_CA_ID) &&
(leftSet.getGB() == NULL_CA_ID) &&
(rightSet.getGB() == NULL_CA_ID) );
#ifndef NDEBUG
// assert that left + right == subSet_
// and left intersect right = phi
CANodeIdSet unionSet(leftSet.getJBBCs());
CANodeIdSet intersectSet(leftSet.getJBBCs());
unionSet += rightSet.getJBBCs();
intersectSet.intersectSet(rightSet.getJBBCs());
CMPASSERT ( (unionSet == jbbSubset_.getJBBCs()) &&
(intersectSet.entries() == 0 ));
#endif
// Note: Joins including left, semi, anti semi are only created when
// a single jbbc connected via one of them is split as a single right
// child. InnerNonSemi joins can be created for any split i.e. any
// number of jbbcs on the left and the right of the join, but special
// joins (i.e. left, semi and anti semi joins) are only created when
// there is a single right child i.e. the rightSet contains only one
// jbbc that is connected via a special join. This is enforced as follows
//
// * The leftSet should be legal: This means that for every jbbc in the
// leftSet any predecessor jbbcs should be present in the leftSet.
// * The rightSet is either a single jbbc or if the rightSet has more
// than one jbbc then it should be legal, note that a jbbc connected
// via a special join is not a legal set by itself but we allow
// creation of special joins assuming the predecessors are present
// in the leftSet.
//
// An implicit assumption here is that 'this' MultiJoin is legal, which
// is fair since apart from the top level multijoin, rest of the multijoins
// are produced by splitting the top level multijoin. This method should
// not produce illegal multijoins, since we check both leftSet and rightSet
// for legality. Only time we don't check for legality is when the rightChild
// is a single jbbc, and a single jbbc does not result in a multijoin.
if(!leftSet.legal())
return NULL;
if((rightSet.getJBBCs().entries() > 1) && (!rightSet.legal()))
return NULL;
// everything here goes to statement heap
CollHeap* outHeap = CmpCommon::statementHeap();
RelExpr* child0 = generateSubsetExpr(leftSet, reUseMJ);
RelExpr* child1 = generateSubsetExpr(rightSet, reUseMJ);
// Flag to remember to pass on the derivedFromRoutineJoin flag if needed.
NABoolean derivedFromRoutineJoin(FALSE);
// now form a JoinExpr with these left and right children.
Join * result = NULL;
// if the rightSet is a single jbbc, then it could be connected via
// a special join. In such a case we have to create the appropriate
// join operator
if(rightSet.getJBBCs().entries() == 1){
JBBC * rightChild = rightSet.getJBBCs().getFirst().getNodeAnalysis()
->getJBBC();
Join * rightChildParentJoin = rightChild->getOriginalParentJoin();
// If rightChildParentJoin is NULL, then the child is the left
// child of the left most join and is considered to be connected
// via a InnerNonSemi join.
if(rightChildParentJoin)
{
if(rightChildParentJoin->derivedFromRoutineJoin())
derivedFromRoutineJoin = TRUE;
if(rightChildParentJoin->isSemiJoin())
result = new (outHeap) Join(child0, child1, REL_SEMIJOIN, NULL);
if(rightChildParentJoin->isAntiSemiJoin())
result = new (outHeap) Join(child0, child1, REL_ANTI_SEMIJOIN, NULL);
if(rightChildParentJoin->isLeftJoin())
{
// left joins can have filter preds, i.e. predicates that
// are applied as filters after applying the join predicate.
// We need to set them here.
result = new (outHeap) Join(child0, child1, REL_LEFT_JOIN, NULL);
result->setSelectionPredicates(rightChild->getLeftJoinFilterPreds());
}
if(rightChildParentJoin->isRoutineJoin())
{
derivedFromRoutineJoin = TRUE;
//.........这里部分代码省略.........
示例3: Scan
//.........这里部分代码省略.........
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();
}
if(joinExpr)
{
joinExpr->setJoinPred(singleRightChild->getPredsWithPredecessors());
joinExpr->nullInstantiatedOutput().insert(singleRightChild->
nullInstantiatedOutput());
}
}
if(!joinExpr)
{
// now form a JoinExpr with these left and right children.
joinExpr = new STMTHEAP Join(leftChildExpr, // left child
rightChildExpr, // right child
REL_JOIN, // join type
NULL); // join predicates
}
ValueIdSet selPredsAndLOJFilter = leftOuterJoinFilterPreds;
selPredsAndLOJFilter += (*setOfPredicates);
joinExpr->setSelectionPredicates(selPredsAndLOJFilter);
// set groupAttr of this Join expression
GroupAttributes * gaJoin = new STMTHEAP GroupAttributes();
// set required outputs of Join as sum of characteristic
// outputs of the left and the right children
ValueIdSet requiredOutputs;
if (leftNodeSet)
requiredOutputs.addSet(getPotentialOutputs(*(leftNodeSet)));
if (rightNodeSet)
requiredOutputs.addSet(getPotentialOutputs(*(rightNodeSet)));
gaJoin->setCharacteristicOutputs(requiredOutputs);
// set JBBSubset for this group, if all estLogProps are cacheable.
// Else JBBSubset is NULL
if (cacheable)
gaJoin->getGroupAnalysis()->setLocalJBBView(combinedJBBSubset);
gaJoin->setMinChildEstRowCount(MINOF(garight->getMinChildEstRowCount(), galeft->getMinChildEstRowCount() ) );
joinExpr->setGroupAttr(gaJoin);
// if there are some probes coming into the join
// then join type = tsj.
if ((inputEstLogProp->getResultCardinality() > 1) ||
(inputEstLogProp->getColStats().entries() > 1))
{
if (cacheable)
{
CANodeIdSet inputNodeSet = *(inputEstLogProp->getNodeSet());
gaJoin->setCharacteristicInputs(getPotentialOutputs(inputNodeSet));
}
}
joinExpr->setGroupAttr(gaJoin);
gaJoin->setLogExprForSynthesis(joinExpr);
return joinExpr;
} // AppliedStatMan::formJoinExprWithEstLogProps