本文整理汇总了C++中CExpression::DbgPrint方法的典型用法代码示例。如果您正苦于以下问题:C++ CExpression::DbgPrint方法的具体用法?C++ CExpression::DbgPrint怎么用?C++ CExpression::DbgPrint使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CExpression
的用法示例。
在下文中一共展示了CExpression::DbgPrint方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: at
//---------------------------------------------------------------------------
// @function:
// CMDAccessorTest::EresUnittest_IndexPartConstraint
//
// @doc:
// Test fetching part constraints for indexes on partitioned tables
//
//---------------------------------------------------------------------------
GPOS_RESULT
CMDAccessorTest::EresUnittest_IndexPartConstraint()
{
CAutoMemoryPool amp;
IMemoryPool *mp = amp.Pmp();
CAutoTrace at(mp);
// Setup an MD cache with a file-based provider
CMDProviderMemory *pmdp = CTestUtils::m_pmdpf;
pmdp->AddRef();
CMDAccessor mda(mp, CMDCache::Pcache(), CTestUtils::m_sysidDefault, pmdp);
// install opt context in TLS
CAutoOptCtxt aoc
(
mp,
&mda,
NULL, /* pceeval */
CTestUtils::GetCostModel(mp)
);
CColumnFactory *col_factory = COptCtxt::PoctxtFromTLS()->Pcf();
// lookup a relation in the MD cache
CMDIdGPDB *rel_mdid = GPOS_NEW(mp) CMDIdGPDB(GPOPT_TEST_REL_OID22);
const IMDRelation *pmdrel = mda.RetrieveRel(rel_mdid);
GPOS_ASSERT(0 < pmdrel->IndexCount());
// create the array of column reference for the table columns
// for the DXL to Expr translation
CColRefArray *colref_array = GPOS_NEW(mp) CColRefArray(mp);
const ULONG num_cols = pmdrel->ColumnCount() - pmdrel->SystemColumnsCount();
for (ULONG ul = 0; ul < num_cols; ul++)
{
const IMDColumn *pmdcol = pmdrel->GetMdCol(ul);
const IMDType *pmdtype = mda.RetrieveType(pmdcol->MdidType());
CColRef *colref = col_factory->PcrCreate(pmdtype, pmdcol->TypeModifier());
colref_array->Append(colref);
}
// get one of its indexes
GPOS_ASSERT(0 < pmdrel->IndexCount());
IMDId *pmdidIndex = pmdrel->IndexMDidAt(0);
const IMDIndex *pmdindex = mda.RetrieveIndex(pmdidIndex);
// extract and then print the part constraint expression
IMDPartConstraint *mdpart_constraint = pmdindex->MDPartConstraint();
GPOS_ASSERT(NULL != mdpart_constraint);
CExpression *pexpr = mdpart_constraint->GetPartConstraintExpr(mp, &mda, colref_array);
#ifdef GPOS_DEBUG
IOstream &os(at.Os());
pexpr->DbgPrint();
os << std::endl;
#endif // GPOS_DEBUG
// clean up
pexpr->Release();
colref_array->Release();
rel_mdid->Release();
return GPOS_OK;
}
示例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;
}