本文整理汇总了C++中CExpressionHandle类的典型用法代码示例。如果您正苦于以下问题:C++ CExpressionHandle类的具体用法?C++ CExpressionHandle怎么用?C++ CExpressionHandle使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CExpressionHandle类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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);
}
}
示例2:
//---------------------------------------------------------------------------
// @function:
// CPhysicalAgg::EpetDistribution
//
// @doc:
// Return the enforcing type for distribution property based on this operator
//
//---------------------------------------------------------------------------
CEnfdProp::EPropEnforcingType
CPhysicalAgg::EpetDistribution
(
CExpressionHandle &exprhdl,
const CEnfdDistribution *ped
)
const
{
GPOS_ASSERT(NULL != ped);
// get distribution delivered by the aggregate node
CDistributionSpec *pds = CDrvdPropPlan::Pdpplan(exprhdl.Pdp())->Pds();
if (ped->FCompatible(pds))
{
if (COperator::EgbaggtypeLocal != Egbaggtype())
{
return CEnfdProp::EpetUnnecessary;
}
// prohibit the plan if local aggregate already delivers the enforced distribution, since
// otherwise we would create two aggregates with no intermediate motion operators
return CEnfdProp::EpetProhibited;
}
// if there are outer refs, we cannot have a motion on top
if (exprhdl.FHasOuterRefs())
{
return CEnfdProp::EpetProhibited;
}
// required distribution will be enforced on Agg's output
return CEnfdProp::EpetRequired;
}
示例3:
//---------------------------------------------------------------------------
// @function:
// CPhysicalPartitionSelectorDML::EpetDistribution
//
// @doc:
// Return the enforcing type for distribution property based on this operator
//
//---------------------------------------------------------------------------
CEnfdProp::EPropEnforcingType
CPhysicalPartitionSelectorDML::EpetDistribution
(
CExpressionHandle &exprhdl,
const CEnfdDistribution *ped
)
const
{
GPOS_ASSERT(NULL != ped);
// get distribution delivered by the filter node
CDistributionSpec *pds = CDrvdPropPlan::Pdpplan(exprhdl.Pdp())->Pds();
if (ped->FCompatible(pds))
{
// required distribution is already provided
return CEnfdProp::EpetUnnecessary;
}
if (exprhdl.HasOuterRefs())
{
return CEnfdProp::EpetProhibited;
}
return CEnfdProp::EpetRequired;
}
示例4: 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;
}
示例5:
//---------------------------------------------------------------------------
// @function:
// CLogicalSequence::Maxcard
//
// @doc:
// Derive max card
//
//---------------------------------------------------------------------------
CMaxCard
CLogicalSequence::Maxcard
(
IMemoryPool *, // mp
CExpressionHandle &exprhdl
)
const
{
// pass on max card of last child
return exprhdl.GetRelationalProperties(exprhdl.Arity() - 1)->Maxcard();
}
示例6:
//---------------------------------------------------------------------------
// @function:
// CLogicalSequenceProject::FHasLocalOuterRefs
//
// @doc:
// Return true if outer references are included in Partition/Order,
// or window frame edges
//
//---------------------------------------------------------------------------
BOOL
CLogicalSequenceProject::FHasLocalOuterRefs
(
CExpressionHandle &exprhdl
)
const
{
GPOS_ASSERT(this == exprhdl.Pop());
CColRefSet *outer_refs = CDrvdPropRelational::GetRelationalProperties(exprhdl.Pdp())->PcrsOuter();
return !(outer_refs->IsDisjoint(m_pcrsLocalUsed));
}
示例7:
//---------------------------------------------------------------------------
// @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);
}
示例8:
//---------------------------------------------------------------------------
// @function:
// CXformSubqJoin2Apply::Exfp
//
// @doc:
// Compute xform promise for a given expression handle;
// if subqueries exist in the scalar predicate, we must have an
// equivalent logical Apply expression created during exploration;
// no need for generating a Join expression here
//
//---------------------------------------------------------------------------
CXform::EXformPromise
CXformSubqJoin2Apply::Exfp
(
CExpressionHandle &exprhdl
)
const
{
if (exprhdl.GetDrvdScalarProps(exprhdl.Arity() - 1)->FHasSubquery())
{
return CXform::ExfpHigh;
}
return CXform::ExfpNone;
}
示例9:
//---------------------------------------------------------------------------
// @function:
// CXformGbAgg2Apply::Exfp
//
// @doc:
// Compute xform promise for a given expression handle;
// scalar child must have subquery
//
//---------------------------------------------------------------------------
CXform::EXformPromise
CXformGbAgg2Apply::Exfp
(
CExpressionHandle &exprhdl
)
const
{
CLogicalGbAgg *popGbAgg = CLogicalGbAgg::PopConvert(exprhdl.Pop());
if (popGbAgg->FGlobal() && exprhdl.Pdpscalar(1)->FHasSubquery())
{
return CXform::ExfpHigh;
}
return CXform::ExfpNone;
}
示例10: 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;
}
示例11: CDistributionSpecHashedNoOp
void
CDistributionSpecHashedNoOp::AppendEnforcers
(
IMemoryPool *pmp,
CExpressionHandle &exprhdl,
CReqdPropPlan *,
DrgPexpr *pdrgpexpr,
CExpression *pexpr
)
{
CDrvdProp *pdp = exprhdl.Pdp();
CDistributionSpec *pdsChild = CDrvdPropPlan::Pdpplan(pdp)->Pds();
CDistributionSpecHashed *pdsChildHashed = dynamic_cast<CDistributionSpecHashed *>(pdsChild);
if (NULL == pdsChildHashed)
{
return;
}
DrgPexpr *pdrgpexprNoOpRedistributionColumns = pdsChildHashed->Pdrgpexpr();
pdrgpexprNoOpRedistributionColumns->AddRef();
CDistributionSpecHashedNoOp* pdsNoOp = GPOS_NEW(pmp) CDistributionSpecHashedNoOp(pdrgpexprNoOpRedistributionColumns);
pexpr->AddRef();
CExpression *pexprMotion = GPOS_NEW(pmp) CExpression
(
pmp,
GPOS_NEW(pmp) CPhysicalMotionHashDistribute(pmp, pdsNoOp),
pexpr
);
pdrgpexpr->Append(pexprMotion);
}
示例12: FUnaryUsesDefinedColumns
//---------------------------------------------------------------------------
// @function:
// CPhysicalComputeScalar::EpetOrder
//
// @doc:
// Return the enforcing type for order property based on this operator
//
//---------------------------------------------------------------------------
CEnfdProp::EPropEnforcingType
CPhysicalComputeScalar::EpetOrder
(
CExpressionHandle &exprhdl,
const CEnfdOrder *peo
)
const
{
GPOS_ASSERT(NULL != peo);
GPOS_ASSERT(!peo->PosRequired()->FEmpty());
COrderSpec *pos = CDrvdPropPlan::Pdpplan(exprhdl.Pdp())->Pos();
if (peo->FCompatible(pos))
{
return CEnfdProp::EpetUnnecessary;
}
// Sort has to go above ComputeScalar if sort columns use any column
// defined by ComputeScalar, otherwise, Sort can either go above or below ComputeScalar
CColRefSet *pcrsSort = peo->PosRequired()->PcrsUsed(m_pmp);
BOOL fUsesDefinedCols = FUnaryUsesDefinedColumns(pcrsSort, exprhdl);
pcrsSort->Release();
if (fUsesDefinedCols)
{
return CEnfdProp::EpetRequired;
}
return CEnfdProp::EpetOptional;
}
示例13:
//---------------------------------------------------------------------------
// @function:
// CXformInnerApplyWithOuterKey2InnerJoin::Exfp
//
// @doc:
// Compute xform promise for a given expression handle;
//
//---------------------------------------------------------------------------
CXform::EXformPromise
CXformInnerApplyWithOuterKey2InnerJoin::Exfp
(
CExpressionHandle &exprhdl
)
const
{
// check if outer child has key and inner child has outer references
if (NULL == exprhdl.Pdprel(0)->Pkc() ||
0 == exprhdl.Pdprel(1)->PcrsOuter()->CElements())
{
return ExfpNone;
}
return ExfpHigh;
}
示例14:
//---------------------------------------------------------------------------
// @function:
// CDrvdPropPlan::Derive
//
// @doc:
// Derive plan props
//
//---------------------------------------------------------------------------
void
CDrvdPropPlan::Derive
(
IMemoryPool *pmp,
CExpressionHandle &exprhdl,
CDrvdPropCtxt *pdpctxt
)
{
CPhysical *popPhysical = CPhysical::PopConvert(exprhdl.Pop());
if (NULL != pdpctxt && COperator::EopPhysicalCTEConsumer == popPhysical->Eopid())
{
CopyCTEProducerPlanProps(pmp, pdpctxt, popPhysical);
}
else
{
// call property derivation functions on the operator
m_pos = popPhysical->PosDerive(pmp, exprhdl);
m_pds = popPhysical->PdsDerive(pmp, exprhdl);
m_prs = popPhysical->PrsDerive(pmp, exprhdl);
m_ppim = popPhysical->PpimDerive(pmp, exprhdl, pdpctxt);
m_ppfm = popPhysical->PpfmDerive(pmp, exprhdl);
GPOS_ASSERT(NULL != m_ppim);
GPOS_ASSERT(CDistributionSpec::EdtAny != m_pds->Edt() && "CDistributionAny is a require-only, cannot be derived");
}
m_pcm = popPhysical->PcmDerive(pmp, exprhdl);
}
示例15: CMaxCard
//---------------------------------------------------------------------------
// @function:
// CLogicalDifferenceAll::Maxcard
//
// @doc:
// Derive max card
//
//---------------------------------------------------------------------------
CMaxCard
CLogicalDifferenceAll::Maxcard
(
IMemoryPool *, // pmp
CExpressionHandle &exprhdl
)
const
{
// contradictions produce no rows
if (CDrvdPropRelational::Pdprel(exprhdl.Pdp())->Ppc()->FContradiction())
{
return CMaxCard(0 /*ull*/);
}
return exprhdl.Pdprel(0)->Maxcard();
}