本文整理汇总了C++中CColRefSet::ExtractColIds方法的典型用法代码示例。如果您正苦于以下问题:C++ CColRefSet::ExtractColIds方法的具体用法?C++ CColRefSet::ExtractColIds怎么用?C++ CColRefSet::ExtractColIds使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CColRefSet
的用法示例。
在下文中一共展示了CColRefSet::ExtractColIds方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DrgPul
//---------------------------------------------------------------------------
// @function:
// CLogicalConstTableGet::PstatsDerive
//
// @doc:
// Derive statistics
//
//---------------------------------------------------------------------------
IStatistics *
CLogicalConstTableGet::PstatsDerive
(
IMemoryPool *pmp,
CExpressionHandle &exprhdl,
DrgPstat * // not used
)
const
{
GPOS_ASSERT(Esp(exprhdl) > EspNone);
CReqdPropRelational *prprel = CReqdPropRelational::Prprel(exprhdl.Prp());
CColRefSet *pcrs = prprel->PcrsStat();
DrgPul *pdrgpulColIds = GPOS_NEW(pmp) DrgPul(pmp);
pcrs->ExtractColIds(pmp, pdrgpulColIds);
DrgPul *pdrgpulColWidth = CUtils::Pdrgpul(pmp, m_pdrgpcrOutput);
IStatistics *pstats = CStatistics::PstatsDummy
(
pmp,
pdrgpulColIds,
pdrgpulColWidth,
m_pdrgpdrgpdatum->UlLength()
);
// clean up
pdrgpulColIds->Release();
pdrgpulColWidth->Release();
return pstats;
}
示例2: DrgPul
//---------------------------------------------------------------------------
// @function:
// CLogical::PstatsDeriveDummy
//
// @doc:
// Derive dummy statistics
//
//---------------------------------------------------------------------------
IStatistics *
CLogical::PstatsDeriveDummy
(
IMemoryPool *pmp,
CExpressionHandle &exprhdl,
CDouble dRows
)
const
{
GPOS_CHECK_ABORT;
// return a dummy stats object that has a histogram for every
// required-stats column
GPOS_ASSERT(Esp(exprhdl) > EspNone);
CReqdPropRelational *prprel = CReqdPropRelational::Prprel(exprhdl.Prp());
CColRefSet *pcrs = prprel->PcrsStat();
DrgPul *pdrgpulColIds = GPOS_NEW(pmp) DrgPul(pmp);
pcrs->ExtractColIds(pmp, pdrgpulColIds);
IStatistics *pstats = CStatistics::PstatsDummy(pmp, pdrgpulColIds, dRows);
// clean up
pdrgpulColIds->Release();
return pstats;
}
示例3: CDouble
//---------------------------------------------------------------------------
// @function:
// CCostContext::DRowsPerHost
//
// @doc:
// Return the number of rows per host
//
//---------------------------------------------------------------------------
CDouble
CCostContext::DRowsPerHost() const
{
DOUBLE dRows = Pstats()->DRows().DVal();
COptCtxt *poptctxt = COptCtxt::PoctxtFromTLS();
const ULONG ulHosts = poptctxt->Pcm()->UlHosts();
CDistributionSpec *pds = Pdpplan()->Pds();
if (CDistributionSpec::EdtHashed == pds->Edt())
{
CDistributionSpecHashed *pdshashed = CDistributionSpecHashed::PdsConvert(pds);
DrgPexpr *pdrgpexpr = pdshashed->Pdrgpexpr();
CColRefSet *pcrsUsed = CUtils::PcrsExtractColumns(m_pmp, pdrgpexpr);
const CColRefSet *pcrsReqdStats = this->Poc()->Prprel()->PcrsStat();
if (!pcrsReqdStats->FSubset(pcrsUsed))
{
// statistics not available for distribution columns, therefore
// assume uniform distribution across hosts
// clean up
pcrsUsed->Release();
return CDouble(dRows / ulHosts);
}
DrgPul *pdrgpul = GPOS_NEW(m_pmp) DrgPul(m_pmp);
pcrsUsed->ExtractColIds(m_pmp, pdrgpul);
pcrsUsed->Release();
CStatisticsConfig *pstatsconf = poptctxt->Poconf()->Pstatsconf();
CDouble dNDVs = CStatisticsUtils::DGroups(m_pmp, Pstats(), pstatsconf, pdrgpul, NULL /*pbsKeys*/);
pdrgpul->Release();
if (dNDVs < ulHosts)
{
// estimated number of distinct values of distribution columns is smaller than number of hosts.
// We assume data is distributed across a subset of hosts in this case. This results in a larger
// number of rows per host compared to the uniform case, allowing us to capture data skew in
// cost computation
return CDouble(dRows / dNDVs.DVal());
}
}
return CDouble(dRows / ulHosts);
}