本文整理汇总了C++中CExpression::Pstats方法的典型用法代码示例。如果您正苦于以下问题:C++ CExpression::Pstats方法的具体用法?C++ CExpression::Pstats怎么用?C++ CExpression::Pstats使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CExpression
的用法示例。
在下文中一共展示了CExpression::Pstats方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: dCost
//---------------------------------------------------------------------------
// @function:
// CJoinOrderDP::DCost
//
// @doc:
// Primitive costing of join expressions;
// cost of a join expression is the summation of the costs of its
// children plus its local cost;
// cost of a leaf expression is the estimated number of rows
//
//---------------------------------------------------------------------------
CDouble
CJoinOrderDP::DCost
(
CExpression *pexpr
)
{
GPOS_CHECK_STACK_SIZE;
GPOS_ASSERT(NULL != pexpr);
CDouble *pd = m_phmexprcost->Find(pexpr);
if (NULL != pd)
{
// stop recursion if cost was already cashed
return *pd;
}
CDouble dCost(0.0);
const ULONG arity = pexpr->Arity();
if (0 == arity)
{
// leaf operator, use its estimated number of rows as cost
dCost = CDouble(pexpr->Pstats()->Rows());
}
else
{
// inner join operator, sum-up cost of its children
DOUBLE rgdRows[2] = {0.0, 0.0};
for (ULONG ul = 0; ul < arity - 1; ul++)
{
CExpression *pexprChild = (*pexpr)[ul];
// call function recursively to find child cost
dCost = dCost + DCost(pexprChild);
DeriveStats(pexprChild);
rgdRows[ul] = pexprChild->Pstats()->Rows().Get();
}
// add inner join local cost
dCost = dCost + (rgdRows[0] + rgdRows[1]);
}
return dCost;
}