本文整理汇总了C++中CColRefSet::Difference方法的典型用法代码示例。如果您正苦于以下问题:C++ CColRefSet::Difference方法的具体用法?C++ CColRefSet::Difference怎么用?C++ CColRefSet::Difference使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CColRefSet
的用法示例。
在下文中一共展示了CColRefSet::Difference方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CColRefSet
//---------------------------------------------------------------------------
// @function:
// CXformLeftSemiJoin2InnerJoin::Transform
//
// @doc:
// actual transformation
//
//---------------------------------------------------------------------------
void
CXformLeftSemiJoin2InnerJoin::Transform
(
CXformContext *pxfctxt,
CXformResult *pxfres,
CExpression *pexpr
)
const
{
GPOS_ASSERT(NULL != pxfctxt);
GPOS_ASSERT(FPromising(pxfctxt->Pmp(), this, pexpr));
GPOS_ASSERT(FCheckPattern(pexpr));
IMemoryPool *mp = pxfctxt->Pmp();
// extract components
CExpression *pexprOuter = (*pexpr)[0];
CExpression *pexprInner = (*pexpr)[1];
CExpression *pexprScalar = (*pexpr)[2];
pexprOuter->AddRef();
pexprInner->AddRef();
pexprScalar->AddRef();
// construct grouping columns by collecting used columns in the join predicate
// that come from join's inner child
CColRefSet *pcrsOuterOutput = CDrvdPropRelational::GetRelationalProperties(pexprOuter->PdpDerive())->PcrsOutput();
CColRefSet *pcrsUsed = CDrvdPropScalar::GetDrvdScalarProps(pexprScalar->PdpDerive())->PcrsUsed();
CColRefSet *pcrsGb = GPOS_NEW(mp) CColRefSet(mp);
pcrsGb->Include(pcrsUsed);
pcrsGb->Difference(pcrsOuterOutput);
GPOS_ASSERT(0 < pcrsGb->Size());
CKeyCollection *pkc = CDrvdPropRelational::GetRelationalProperties(pexprInner->PdpDerive())->Pkc();
if (NULL == pkc ||
(NULL != pkc && !pkc->FKey(pcrsGb, false /*fExactMatch*/)))
{
// grouping columns do not cover a key on the inner side,
// we need to create a group by on inner side
CColRefArray *colref_array = pcrsGb->Pdrgpcr(mp);
CExpression *pexprGb =
GPOS_NEW(mp) CExpression
(
mp,
GPOS_NEW(mp) CLogicalGbAgg(mp, colref_array, COperator::EgbaggtypeGlobal /*egbaggtype*/),
pexprInner,
GPOS_NEW(mp) CExpression(mp, GPOS_NEW(mp) CScalarProjectList(mp))
);
pexprInner = pexprGb;
}
CExpression *pexprInnerJoin =
CUtils::PexprLogicalJoin<CLogicalInnerJoin>(mp, pexprOuter, pexprInner, pexprScalar);
pcrsGb->Release();
pxfres->Add(pexprInnerJoin);
}