本文整理汇总了C++中CConstraint::Pcnstr方法的典型用法代码示例。如果您正苦于以下问题:C++ CConstraint::Pcnstr方法的具体用法?C++ CConstraint::Pcnstr怎么用?C++ CConstraint::Pcnstr使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CConstraint
的用法示例。
在下文中一共展示了CConstraint::Pcnstr方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
//---------------------------------------------------------------------------
// @function:
// CLogicalSetOp::PcnstrColumn
//
// @doc:
// Get constraint for a given output column from a given children
//
//---------------------------------------------------------------------------
CConstraint *
CLogicalSetOp::PcnstrColumn
(
IMemoryPool *pmp,
CExpressionHandle &exprhdl,
ULONG ulColIndex,
ULONG ulChild
)
const
{
GPOS_ASSERT(ulChild < exprhdl.UlArity());
// constraint from child
CConstraint *pcnstrChild = exprhdl.Pdprel(ulChild)->Ppc()->Pcnstr();
if (NULL == pcnstrChild)
{
return NULL;
}
// part of constraint on the current input column
CConstraint *pcnstrCol = pcnstrChild->Pcnstr(pmp, (*(*m_pdrgpdrgpcrInput)[ulChild])[ulColIndex]);
if (NULL == pcnstrCol)
{
return NULL;
}
// make a copy of this constraint but for the output column instead
CConstraint *pcnstrOutput = pcnstrCol->PcnstrRemapForColumn(pmp, (*m_pdrgpcrOutput)[ulColIndex]);
pcnstrCol->Release();
return pcnstrOutput;
}
示例2: GPOS_NEW
//---------------------------------------------------------------------------
// @function:
// CConstraintConjunction::Pcnstr
//
// @doc:
// Return constraint on a given column set
//
//---------------------------------------------------------------------------
CConstraint *
CConstraintConjunction::Pcnstr
(
IMemoryPool *mp,
CColRefSet *pcrs
)
{
const ULONG length = m_pdrgpcnstr->Size();
CConstraintArray *pdrgpcnstr = GPOS_NEW(mp) CConstraintArray(mp);
for (ULONG ul = 0; ul < length; ul++)
{
CConstraint *pcnstr = (*m_pdrgpcnstr)[ul];
if (pcnstr->PcrsUsed()->IsDisjoint(pcrs))
{
continue;
}
// the part of the child that references these columns
CConstraint *pcnstrCol = pcnstr->Pcnstr(mp, pcrs);
if (NULL != pcnstrCol)
{
pdrgpcnstr->Append(pcnstrCol);
}
}
return CConstraint::PcnstrConjunction(mp, pdrgpcnstr);
}
示例3: GPOS_NEW
//---------------------------------------------------------------------------
// @function:
// CLogical::PpcDeriveConstraintRestrict
//
// @doc:
// Derive constraint property only on the given columns
//
//---------------------------------------------------------------------------
CPropConstraint *
CLogical::PpcDeriveConstraintRestrict
(
IMemoryPool *pmp,
CExpressionHandle &exprhdl,
CColRefSet *pcrsOutput
)
{
// constraint property from relational child
CPropConstraint *ppc = exprhdl.Pdprel(0)->Ppc();
DrgPcrs *pdrgpcrs = ppc->PdrgpcrsEquivClasses();
// construct new array of equivalence classes
DrgPcrs *pdrgpcrsNew = GPOS_NEW(pmp) DrgPcrs(pmp);
const ULONG ulLen = pdrgpcrs->UlLength();
for (ULONG ul = 0; ul < ulLen; ul++)
{
CColRefSet *pcrsEquiv = GPOS_NEW(pmp) CColRefSet(pmp);
pcrsEquiv->Include((*pdrgpcrs)[ul]);
pcrsEquiv->Intersection(pcrsOutput);
if (0 < pcrsEquiv->CElements())
{
pdrgpcrsNew->Append(pcrsEquiv);
}
else
{
pcrsEquiv->Release();
}
}
CConstraint *pcnstrChild = ppc->Pcnstr();
if (NULL == pcnstrChild)
{
return GPOS_NEW(pmp) CPropConstraint(pmp, pdrgpcrsNew, NULL);
}
DrgPcnstr *pdrgpcnstr = GPOS_NEW(pmp) DrgPcnstr(pmp);
// include only constraints on given columns
CColRefSetIter crsi(*pcrsOutput);
while (crsi.FAdvance())
{
CColRef *pcr = crsi.Pcr();
CConstraint *pcnstrCol = pcnstrChild->Pcnstr(pmp, pcr);
if (NULL == pcnstrCol)
{
continue;
}
if (pcnstrCol->FUnbounded())
{
pcnstrCol->Release();
continue;
}
pdrgpcnstr->Append(pcnstrCol);
}
CConstraint *pcnstr = CConstraint::PcnstrConjunction(pmp, pdrgpcnstr);
return GPOS_NEW(pmp) CPropConstraint(pmp, pdrgpcrsNew, pcnstr);
}