本文整理汇总了C++中CExpression::FMatchDebug方法的典型用法代码示例。如果您正苦于以下问题:C++ CExpression::FMatchDebug方法的具体用法?C++ CExpression::FMatchDebug怎么用?C++ CExpression::FMatchDebug使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CExpression
的用法示例。
在下文中一共展示了CExpression::FMatchDebug方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: exprhdl
//---------------------------------------------------------------------------
// @function:
// CXformTest::ApplyExprXforms
//
// @doc:
// Apply different xforms for the given expression
//
//---------------------------------------------------------------------------
void
CXformTest::ApplyExprXforms
(
IMemoryPool *pmp,
IOstream &os,
CExpression *pexpr
)
{
os << std::endl << "EXPR:" << std::endl;
(void) pexpr->OsPrint(os);
for (ULONG ulXformId = 0; ulXformId < CXform::ExfSentinel; ulXformId++)
{
CXform *pxform = CXformFactory::Pxff()->Pxf((CXform::EXformId) ulXformId);
os << std::endl <<"XFORM " << pxform->SzId() << ":" << std::endl;
CXformContext *pxfctxt = GPOS_NEW(pmp) CXformContext(pmp);
CXformResult *pxfres = GPOS_NEW(pmp) CXformResult(pmp);
#ifdef GPOS_DEBUG
if (pxform->FCheckPattern(pexpr) && CXform::FPromising(pmp, pxform, pexpr))
{
if (CXform::ExfExpandNAryJoinMinCard == pxform->Exfid())
{
GPOS_ASSERT(COperator::EopLogicalNAryJoin == pexpr->Pop()->Eopid());
// derive stats on NAry join expression
CExpressionHandle exprhdl(pmp);
exprhdl.Attach(pexpr);
exprhdl.DeriveStats(pmp, pmp, NULL /*prprel*/, NULL /*pdrgpstatCtxt*/);
}
pxform->Transform(pxfctxt, pxfres, pexpr);
CExpression *pexprResult = pxfres->PexprNext();
while (NULL != pexprResult)
{
GPOS_ASSERT(pexprResult->FMatchDebug(pexprResult));
pexprResult = pxfres->PexprNext();
}
(void) pxfres->OsPrint(os);
}
#endif // GPOS_DEBUG
pxfres->Release();
pxfctxt->Release();
}
}
示例2: mda
//---------------------------------------------------------------------------
// @function:
// CContradictionTest::EresUnittest_Constraint
//
// @doc:
// Tests for constraint property derivation and constraint push down
//
//---------------------------------------------------------------------------
GPOS_RESULT
CContradictionTest::EresUnittest_Constraint()
{
CAutoMemoryPool amp;
IMemoryPool *pmp = amp.Pmp();
// setup a file-based provider
CMDProviderMemory *pmdp = CTestUtils::m_pmdpf;
pmdp->AddRef();
CMDAccessor mda(pmp, CMDCache::Pcache(), CTestUtils::m_sysidDefault, pmdp);
typedef CExpression *(*Pfpexpr)(IMemoryPool*);
Pfpexpr rgpf[] =
{
CTestUtils::PexprLogicalApplyWithOuterRef<CLogicalInnerApply>,
CTestUtils::PexprLogicalApply<CLogicalLeftSemiApply>,
CTestUtils::PexprLogicalApply<CLogicalLeftAntiSemiApply>,
CTestUtils::PexprLogicalApplyWithOuterRef<CLogicalLeftOuterApply>,
CTestUtils::PexprLogicalGet,
CTestUtils::PexprLogicalGetPartitioned,
CTestUtils::PexprLogicalSelect,
CTestUtils::PexprLogicalSelectCmpToConst,
CTestUtils::PexprLogicalSelectPartitioned,
CTestUtils::PexprLogicalSelectWithContradiction,
CTestUtils::PexprLogicalJoin<CLogicalInnerJoin>,
CTestUtils::PexprLogicalJoin<CLogicalLeftOuterJoin>,
CTestUtils::PexprLogicalJoin<CLogicalLeftSemiJoin>,
CTestUtils::PexprLogicalJoin<CLogicalLeftAntiSemiJoin>,
CTestUtils::PexprLogicalGbAgg,
CTestUtils::PexprLogicalGbAggOverJoin,
CTestUtils::PexprLogicalGbAggWithSum,
CTestUtils::PexprLogicalLimit,
CTestUtils::PexprLogicalNAryJoin,
CTestUtils::PexprLogicalProject,
CTestUtils::PexprConstTableGet5,
CTestUtils::PexprLogicalDynamicGet,
CTestUtils::PexprLogicalSequence,
CTestUtils::PexprLogicalTVFTwoArgs,
};
for (ULONG i = 0; i < GPOS_ARRAY_SIZE(rgpf); i++)
{
// install opt context in TLS
CAutoOptCtxt aoc
(
pmp,
&mda,
NULL, /* pceeval */
CTestUtils::Pcm(pmp)
);
// generate simple expression
CExpression *pexpr = rgpf[i](pmp);
// self-match
GPOS_ASSERT(pexpr->FMatchDebug(pexpr));
// debug print
CWStringDynamic str(pmp, GPOS_WSZ_LIT("\n"));
COstreamString oss(&str);
oss << "EXPR:" << std::endl << *pexpr << std::endl;
GPOS_TRACE(str.Wsz());
str.Reset();
#ifdef GPOS_DEBUG
// derive properties on expression
(void) pexpr->PdpDerive();
oss << std::endl << "DERIVED PROPS:" << std::endl;
GPOS_TRACE(str.Wsz());
str.Reset();
pexpr->DbgPrint();
#endif // GPOS_DEBUG
CExpression *pexprPreprocessed = CExpressionPreprocessor::PexprPreprocess(pmp, pexpr);
oss << std::endl << "PREPROCESSED EXPR:" << std::endl << *pexprPreprocessed << std::endl;
GPOS_TRACE(str.Wsz());
str.Reset();
// cleanup
pexprPreprocessed->Release();
pexpr->Release();
}
return GPOS_OK;
}