本文整理汇总了C++中IStatistics::UlStatsEstimationRisk方法的典型用法代码示例。如果您正苦于以下问题:C++ IStatistics::UlStatsEstimationRisk方法的具体用法?C++ IStatistics::UlStatsEstimationRisk怎么用?C++ IStatistics::UlStatsEstimationRisk使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IStatistics
的用法示例。
在下文中一共展示了IStatistics::UlStatsEstimationRisk方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DrgPstat
//---------------------------------------------------------------------------
// @function:
// CExpressionHandle::DeriveStats
//
// @doc:
// Recursive stat derivation
//
//---------------------------------------------------------------------------
void
CExpressionHandle::DeriveStats
(
DrgPstat *pdrgpstatCtxt,
BOOL fComputeRootStats
)
{
GPOS_ASSERT(NULL != pdrgpstatCtxt);
GPOS_ASSERT(NULL == m_pdrgpstat);
GPOS_ASSERT(NULL == m_pstats);
GPOS_ASSERT(NULL != m_pdrgprp);
// copy input context
DrgPstat *pdrgpstatCurrentCtxt = GPOS_NEW(m_pmp) DrgPstat(m_pmp);
CUtils::AddRefAppend<IStatistics, CleanupStats>(pdrgpstatCurrentCtxt, pdrgpstatCtxt);
// create array of children stats
m_pdrgpstat = GPOS_NEW(m_pmp) DrgPstat(m_pmp);
ULONG ulMaxChildRisk = 1;
const ULONG ulArity = UlArity();
for (ULONG ul = 0; ul < ulArity; ul++)
{
// create a new context for outer references used by current child
DrgPstat *pdrgpstatChildCtxt = PdrgpstatOuterRefs(pdrgpstatCurrentCtxt, ul);
IStatistics *pstats = NULL;
if (NULL != Pexpr())
{
// derive stats recursively on child expression
pstats = (*Pexpr())[ul]->PstatsDerive(Prprel(ul), pdrgpstatChildCtxt);
}
else
{
// derive stats recursively on child group
pstats = (*Pgexpr())[ul]->PstatsRecursiveDerive(m_pmp, m_pmp, Prprel(ul), pdrgpstatChildCtxt);
}
GPOS_ASSERT(NULL != pstats);
// add child stat to current context
pstats->AddRef();
pdrgpstatCurrentCtxt->Append(pstats);
pdrgpstatChildCtxt->Release();
// add child stat to children stat array
pstats->AddRef();
m_pdrgpstat->Append(pstats);
if (pstats->UlStatsEstimationRisk() > ulMaxChildRisk)
{
ulMaxChildRisk = pstats->UlStatsEstimationRisk();
}
}
if (fComputeRootStats)
{
// call stat derivation on operator to compute local stats
GPOS_ASSERT(NULL == m_pstats);
DeriveRootStats(pdrgpstatCtxt);
GPOS_ASSERT(NULL != m_pstats);
CLogical *popLogical = CLogical::PopConvert(Pop());
ULONG ulRisk = ulMaxChildRisk;
if (CStatisticsUtils::FIncreasesRisk(popLogical))
{
++ulRisk;
}
m_pstats->SetStatsEstimationRisk(ulRisk);
}
// clean up current stat context
pdrgpstatCurrentCtxt->Release();
}