本文整理汇总了C++中CExpressionHandle::UlArity方法的典型用法代码示例。如果您正苦于以下问题:C++ CExpressionHandle::UlArity方法的具体用法?C++ CExpressionHandle::UlArity怎么用?C++ CExpressionHandle::UlArity使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CExpressionHandle
的用法示例。
在下文中一共展示了CExpressionHandle::UlArity方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CColRefSet
//---------------------------------------------------------------------------
// @function:
// CPhysicalJoin::FProvidesReqdCols
//
// @doc:
// Helper for checking if required columns are included in output columns
//
//---------------------------------------------------------------------------
BOOL
CPhysicalJoin::FProvidesReqdCols
(
CExpressionHandle &exprhdl,
CColRefSet *pcrsRequired,
ULONG // ulOptReq
)
const
{
GPOS_ASSERT(NULL != pcrsRequired);
GPOS_ASSERT(3 == exprhdl.UlArity());
// union columns from relational children
CColRefSet *pcrs = GPOS_NEW(m_pmp) CColRefSet(m_pmp);
ULONG ulArity = exprhdl.UlArity();
for (ULONG i = 0; i < ulArity - 1; i++)
{
CColRefSet *pcrsChild = exprhdl.Pdprel(i)->PcrsOutput();
pcrs->Union(pcrsChild);
}
BOOL fProvidesCols = pcrs->FSubset(pcrsRequired);
pcrs->Release();
return fProvidesCols;
}
示例2: at
//---------------------------------------------------------------------------
// @function:
// CPhysicalUnionAll::AssertValidChildDistributions
//
// @doc:
// Helper to validate child distributions
//
//---------------------------------------------------------------------------
void
CPhysicalUnionAll::AssertValidChildDistributions
(
IMemoryPool *pmp,
CExpressionHandle &exprhdl,
CDistributionSpec::EDistributionType *pedt, // array of distribution types to check
ULONG ulDistrs, // number of distribution types to check
const CHAR *szAssertMsg
)
{
const ULONG ulArity = exprhdl.UlArity();
for (ULONG ulChild = 0; ulChild < ulArity; ulChild++)
{
CDistributionSpec *pdsChild = exprhdl.Pdpplan(ulChild)->Pds();
CDistributionSpec::EDistributionType edtChild = pdsChild->Edt();
BOOL fMatch = false;
for (ULONG ulDistr = 0; !fMatch && ulDistr < ulDistrs; ulDistr++)
{
fMatch = (pedt[ulDistr] == edtChild);
}
if (!fMatch)
{
CAutoTrace at(pmp);
at.Os() << szAssertMsg;
}
GPOS_ASSERT(fMatch);
}
}
示例3: CColRefSet
//---------------------------------------------------------------------------
// @function:
// CPhysicalUnionAll::FProvidesReqdCols
//
// @doc:
// Check if required columns are included in output columns
//
//---------------------------------------------------------------------------
BOOL
CPhysicalUnionAll::FProvidesReqdCols
(
CExpressionHandle &
#ifdef GPOS_DEBUG
exprhdl
#endif // GPOS_DEBUG
,
CColRefSet *pcrsRequired,
ULONG // ulOptReq
)
const
{
GPOS_ASSERT(NULL != pcrsRequired);
GPOS_ASSERT(m_pdrgpdrgpcrInput->UlLength() == exprhdl.UlArity());
CColRefSet *pcrs = GPOS_NEW(m_pmp) CColRefSet(m_pmp);
// include output columns
pcrs->Include(m_pdrgpcrOutput);
BOOL fProvidesCols = pcrs->FSubset(pcrsRequired);
pcrs->Release();
return fProvidesCols;
}
示例4:
//---------------------------------------------------------------------------
// @function:
// CPhysicalJoin::FOuterProvidesReqdCols
//
// @doc:
// Helper for checking if the outer input of a binary join operator
// includes the required columns
//
//---------------------------------------------------------------------------
BOOL
CPhysicalJoin::FOuterProvidesReqdCols
(
CExpressionHandle &exprhdl,
CColRefSet *pcrsRequired
)
{
GPOS_ASSERT(NULL != pcrsRequired);
GPOS_ASSERT(3 == exprhdl.UlArity() && "expected binary join");
CColRefSet *pcrsOutput = exprhdl.Pdprel(0 /*ulChildIndex*/)->PcrsOutput();
return pcrsOutput->FSubset(pcrsRequired);
}
示例5:
//---------------------------------------------------------------------------
// @function:
// CLogicalUnion::Maxcard
//
// @doc:
// Derive max card
//
//---------------------------------------------------------------------------
CMaxCard
CLogicalUnion::Maxcard
(
IMemoryPool *, // pmp
CExpressionHandle &exprhdl
)
const
{
const ULONG ulArity = exprhdl.UlArity();
CMaxCard maxcard = exprhdl.Pdprel(0)->Maxcard();
for (ULONG ul = 1; ul < ulArity; ul++)
{
maxcard += exprhdl.Pdprel(ul)->Maxcard();
}
return maxcard;
}
示例6:
//---------------------------------------------------------------------------
// @function:
// CLogical::MaxcardDef
//
// @doc:
// Default max card for join and apply operators
//
//---------------------------------------------------------------------------
CMaxCard
CLogical::MaxcardDef
(
CExpressionHandle &exprhdl
)
{
const ULONG ulArity = exprhdl.UlArity();
CMaxCard maxcard = exprhdl.Pdprel(0)->Maxcard();
for (ULONG ul = 1; ul < ulArity - 1; ul++)
{
if (!exprhdl.FScalarChild(ul))
{
maxcard *= exprhdl.Pdprel(ul)->Maxcard();
}
}
return maxcard;
}
示例7:
//---------------------------------------------------------------------------
// @function:
// CPhysicalSequence::FProvidesReqdCols
//
// @doc:
// Helper for checking if required columns are included in output columns
//
//---------------------------------------------------------------------------
BOOL
CPhysicalSequence::FProvidesReqdCols
(
CExpressionHandle &exprhdl,
CColRefSet *pcrsRequired,
ULONG // ulOptReq
)
const
{
GPOS_ASSERT(NULL != pcrsRequired);
// last child must provide required columns
ULONG ulArity = exprhdl.UlArity();
GPOS_ASSERT(0 < ulArity);
CColRefSet *pcrsChild = exprhdl.Pdprel(ulArity - 1)->PcrsOutput();
return pcrsChild->FSubset(pcrsRequired);
}
示例8:
//---------------------------------------------------------------------------
// @function:
// CXformExpandNAryJoin::Exfp
//
// @doc:
// Compute xform promise for a given expression handle
//
//---------------------------------------------------------------------------
CXform::EXformPromise
CXformExpandNAryJoin::Exfp
(
CExpressionHandle &exprhdl
)
const
{
if (exprhdl.Pdpscalar(exprhdl.UlArity() - 1)->FHasSubquery())
{
// subqueries must be unnested before applying xform
return CXform::ExfpNone;
}
#ifdef GPOS_DEBUG
CAutoMemoryPool amp;
GPOS_ASSERT(!CXformUtils::FJoinPredOnSingleChild(amp.Pmp(), exprhdl) &&
"join predicates are not pushed down");
#endif // GPOS_DEBUG
return CXform::ExfpHigh;
}
示例9:
//---------------------------------------------------------------------------
// @function:
// COperator::EfdaDeriveFromChildren
//
// @doc:
// Derive data access function property from child expressions
//
//---------------------------------------------------------------------------
IMDFunction::EFuncDataAcc
COperator::EfdaDeriveFromChildren
(
CExpressionHandle &exprhdl,
IMDFunction::EFuncDataAcc efdaDefault
)
{
IMDFunction::EFuncDataAcc efda = efdaDefault;
const ULONG ulArity = exprhdl.UlArity();
for (ULONG ul = 0; ul < ulArity; ul++)
{
IMDFunction::EFuncDataAcc efdaChild = exprhdl.PfpChild(ul)->Efda();
if (efdaChild > efda)
{
efda = efdaChild;
}
}
return efda;
}
示例10: CColRefSet
//---------------------------------------------------------------------------
// @function:
// CPhysicalComputeScalar::FProvidesReqdCols
//
// @doc:
// Check if required columns are included in output columns
//
//---------------------------------------------------------------------------
BOOL
CPhysicalComputeScalar::FProvidesReqdCols
(
CExpressionHandle &exprhdl,
CColRefSet *pcrsRequired,
ULONG // ulOptReq
)
const
{
GPOS_ASSERT(NULL != pcrsRequired);
GPOS_ASSERT(2 == exprhdl.UlArity());
CColRefSet *pcrs = GPOS_NEW(m_pmp) CColRefSet(m_pmp);
// include defined columns by scalar project list
pcrs->Union(exprhdl.Pdpscalar(1 /*ulChildIndex*/)->PcrsDefined());
// include output columns of the relational child
pcrs->Union(exprhdl.Pdprel(0 /*ulChildIndex*/)->PcrsOutput());
BOOL fProvidesCols = pcrs->FSubset(pcrsRequired);
pcrs->Release();
return fProvidesCols;
}
示例11: CColRefSet
//---------------------------------------------------------------------------
// @function:
// CPhysicalAgg::FProvidesReqdCols
//
// @doc:
// Check if required columns are included in output columns
//
//---------------------------------------------------------------------------
BOOL
CPhysicalAgg::FProvidesReqdCols
(
CExpressionHandle &exprhdl,
CColRefSet *pcrsRequired,
ULONG // ulOptReq
)
const
{
GPOS_ASSERT(NULL != pcrsRequired);
GPOS_ASSERT(2 == exprhdl.UlArity());
CColRefSet *pcrs = GPOS_NEW(m_pmp) CColRefSet(m_pmp);
// include grouping columns
pcrs->Include(PdrgpcrGroupingCols());
// include defined columns by scalar child
pcrs->Union(exprhdl.Pdpscalar(1 /*ulChildIndex*/)->PcrsDefined());
BOOL fProvidesCols = pcrs->FSubset(pcrsRequired);
pcrs->Release();
return fProvidesCols;
}
示例12: CPartInfo
//---------------------------------------------------------------------------
// @function:
// CDrvdPropScalar::Derive
//
// @doc:
// Derive scalar props
//
//---------------------------------------------------------------------------
void
CDrvdPropScalar::Derive
(
IMemoryPool *pmp,
CExpressionHandle &exprhdl,
CDrvdPropCtxt * // pdpctxt
)
{
CScalar *popScalar = CScalar::PopConvert(exprhdl.Pop());
// call derivation functions on the operator
GPOS_ASSERT(NULL == m_pcrsDefined);
m_pcrsDefined = popScalar->PcrsDefined(pmp, exprhdl);
GPOS_ASSERT(NULL == m_pcrsSetReturningFunction);
m_pcrsSetReturningFunction = popScalar->PcrsSetReturningFunction(pmp, exprhdl);
GPOS_ASSERT(NULL == m_pcrsUsed);
m_pcrsUsed = popScalar->PcrsUsed(pmp, exprhdl);
// derive function properties
m_pfp = popScalar->PfpDerive(pmp, exprhdl);
// add defined and used columns of children
const ULONG ulArity = exprhdl.UlArity();
for (ULONG i = 0; i < ulArity; i++)
{
// only propagate properties from scalar children
if (exprhdl.FScalarChild(i))
{
m_pcrsDefined->Union(exprhdl.Pdpscalar(i)->PcrsDefined());
m_pcrsUsed->Union(exprhdl.Pdpscalar(i)->PcrsUsed());
m_pcrsSetReturningFunction->Union(exprhdl.Pdpscalar(i)->PcrsSetReturningFunction());
}
else
{
GPOS_ASSERT(CUtils::FSubquery(popScalar));
// parent operator is a subquery, add outer references
// from its relational child as used columns
m_pcrsUsed->Union(exprhdl.Pdprel(0)->PcrsOuter());
}
}
// derive existence of subqueries
GPOS_ASSERT(!m_fHasSubquery);
m_fHasSubquery = popScalar->FHasSubquery(exprhdl);
if (m_fHasSubquery)
{
m_ppartinfo = popScalar->PpartinfoDerive(pmp, exprhdl);
}
else
{
m_ppartinfo = GPOS_NEW(pmp) CPartInfo(pmp);
}
m_fHasNonScalarFunction = popScalar->FHasNonScalarFunction(exprhdl);
if (COperator::EopScalarProjectList == exprhdl.Pop()->Eopid())
{
m_ulDistinctAggs = CScalarProjectList::UlDistinctAggs(exprhdl);
m_fHasMultipleDistinctAggs = CScalarProjectList::FHasMultipleDistinctAggs(exprhdl);
}
if (COperator::EopScalarProjectElement == exprhdl.Pop()->Eopid())
{
if (m_fHasNonScalarFunction)
{
CScalarProjectElement *pspeProject = (CScalarProjectElement *)(exprhdl.Pop());
m_pcrsSetReturningFunction->Include(pspeProject->Pcr());
}
}
}