本文整理汇总了C++中CColRefSet::Exclude方法的典型用法代码示例。如果您正苦于以下问题:C++ CColRefSet::Exclude方法的具体用法?C++ CColRefSet::Exclude怎么用?C++ CColRefSet::Exclude使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CColRefSet
的用法示例。
在下文中一共展示了CColRefSet::Exclude方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CColRefSet
//---------------------------------------------------------------------------
// @function:
// CLogical::PcrsDeriveOuterIndexGet
//
// @doc:
// Derive outer references for index get and dynamic index get operators
//
//---------------------------------------------------------------------------
CColRefSet *
CLogical::PcrsDeriveOuterIndexGet
(
IMemoryPool *pmp,
CExpressionHandle &exprhdl
)
{
ULONG ulArity = exprhdl.UlArity();
CColRefSet *pcrsOuter = GPOS_NEW(pmp) CColRefSet(pmp);
CColRefSet *pcrsOutput = PcrsDeriveOutput(pmp, exprhdl);
CColRefSet *pcrsUsed = GPOS_NEW(pmp) CColRefSet(pmp);
for (ULONG i = 0; i < ulArity; i++)
{
GPOS_ASSERT(exprhdl.FScalarChild(i));
CDrvdPropScalar *pdpscalar = exprhdl.Pdpscalar(i);
pcrsUsed->Union(pdpscalar->PcrsUsed());
}
// outer references are columns used by scalar children
// but are not included in the output columns of relational children
pcrsOuter->Union(pcrsUsed);
pcrsOuter->Exclude(pcrsOutput);
pcrsOutput->Release();
pcrsUsed->Release();
return pcrsOuter;
}
示例2: crsi
//---------------------------------------------------------------------------
// @function:
// CLogicalGet::PcrsDeriveNotNull
//
// @doc:
// Derive not null output columns
//
//---------------------------------------------------------------------------
CColRefSet *
CLogicalGet::PcrsDeriveNotNull
(
IMemoryPool *mp,
CExpressionHandle &exprhdl
)
const
{
// get all output columns
CColRefSet *pcrs = GPOS_NEW(mp) CColRefSet(mp);
pcrs->Include(CDrvdPropRelational::GetRelationalProperties(exprhdl.Pdp())->PcrsOutput());
// filters out nullable columns
CColRefSetIter crsi(*CDrvdPropRelational::GetRelationalProperties(exprhdl.Pdp())->PcrsOutput());
while (crsi.Advance())
{
CColRefTable *pcrtable = CColRefTable::PcrConvert(const_cast<CColRef*>(crsi.Pcr()));
if (pcrtable->IsNullable())
{
pcrs->Exclude(pcrtable);
}
}
return pcrs;
}
示例3: am
//---------------------------------------------------------------------------
// @function:
// CPhysical::PcrsChildReqd
//
// @doc:
// Helper for computing required output columns of the n-th child;
// the caller must be an operator whose ulScalarIndex-th child is a
// scalar
//
//---------------------------------------------------------------------------
CColRefSet *
CPhysical::PcrsChildReqd
(
IMemoryPool *mp,
CExpressionHandle &exprhdl,
CColRefSet *pcrsRequired,
ULONG child_index,
ULONG ulScalarIndex
)
{
pcrsRequired->AddRef();
CReqdColsRequest *prcr = GPOS_NEW(mp) CReqdColsRequest(pcrsRequired, child_index, ulScalarIndex);
CColRefSet *pcrs = NULL;
{
// scope of AutoMutex
CAutoMutex am(m_mutex);
am.Lock();
// lookup required columns map first
pcrs = m_phmrcr->Find(prcr);
if (NULL != pcrs)
{
prcr->Release();
pcrs->AddRef();
return pcrs;
}
}
// request was not found in map -- we need to compute it
pcrs = GPOS_NEW(mp) CColRefSet(mp, *pcrsRequired);
if (gpos::ulong_max != ulScalarIndex)
{
// include used columns and exclude defined columns of scalar child
pcrs->Union(exprhdl.GetDrvdScalarProps(ulScalarIndex)->PcrsUsed());
pcrs->Exclude(exprhdl.GetDrvdScalarProps(ulScalarIndex)->PcrsDefined());
}
// intersect computed column set with child's output columns
pcrs->Intersection(exprhdl.GetRelationalProperties(child_index)->PcrsOutput());
// lookup map again to handle concurrent map lookup/insertion
{
// scope of AutoMutex
CAutoMutex am(m_mutex);
am.Lock();
CColRefSet *pcrsFound = m_phmrcr->Find(prcr);
if (NULL != pcrsFound)
{
// request was found now -- release computed request and use the found request
prcr->Release();
pcrs->Release();
pcrsFound->AddRef();
pcrs = pcrsFound;
}
else
{
// new request -- insert request in map
pcrs->AddRef();
#ifdef GPOS_DEBUG
BOOL fSuccess =
#endif // GPOS_DEBUG
m_phmrcr->Insert(prcr, pcrs);
GPOS_ASSERT(fSuccess);
}
}
return pcrs;
}
示例4: exprhdl
//---------------------------------------------------------------------------
// @function:
// CNormalizer::FLocalColsSubsetOfInputCols
//
// @doc:
// Check if the columns used by the operator are a subset of its input columns
//
//---------------------------------------------------------------------------
BOOL
CNormalizer::FLocalColsSubsetOfInputCols
(
IMemoryPool *pmp,
CExpression *pexpr
)
{
GPOS_ASSERT(NULL != pexpr);
GPOS_CHECK_STACK_SIZE;
CExpressionHandle exprhdl(pmp);
if (NULL != pexpr->Pgexpr())
{
exprhdl.Attach(pexpr->Pgexpr());
}
else
{
exprhdl.Attach(pexpr);
}
exprhdl.DeriveProps(NULL /*pdpctxt*/);
BOOL fValid = true;
if (pexpr->Pop()->FLogical())
{
if (0 == exprhdl.UlNonScalarChildren())
{
return true;
}
CColRefSet *pcrsInput = GPOS_NEW(pmp) CColRefSet(pmp);
const ULONG ulArity = exprhdl.UlArity();
for (ULONG ul = 0; ul < ulArity; ul++)
{
if (!exprhdl.FScalarChild(ul))
{
CDrvdPropRelational *pdprelChild = exprhdl.Pdprel(ul);
pcrsInput->Include(pdprelChild->PcrsOutput());
}
}
// check if the operator's locally used columns are a subset of the input columns
CColRefSet *pcrsUsedOp = exprhdl.PcrsUsedColumns(pmp);
pcrsUsedOp->Exclude(exprhdl.Pdprel()->PcrsOuter());
fValid = pcrsInput->FSubset(pcrsUsedOp);
// release
pcrsInput->Release();
pcrsUsedOp->Release();
}
// check if its children are valid
const ULONG ulExprArity = pexpr->UlArity();
for (ULONG ulChildIdx = 0; ulChildIdx < ulExprArity && fValid; ulChildIdx++)
{
CExpression *pexprChild = (*pexpr)[ulChildIdx];
fValid = FLocalColsSubsetOfInputCols(pmp, pexprChild);
}
return fValid;
}