//--------------------------------------------------------------------------- // @function: // CMDAccessorTest::PvLookupMultipleObj // // @doc: // A task that looks up multiple objects from the MD cache // //--------------------------------------------------------------------------- void * CMDAccessorTest::PvLookupMultipleObj ( void * pv ) { GPOS_CHECK_ABORT; GPOS_ASSERT(NULL != pv); SMDCacheTaskParams *pmdtaskparams = (SMDCacheTaskParams *) pv; CMDAccessor *md_accessor = pmdtaskparams->m_pmda; GPOS_ASSERT(NULL != md_accessor); // lookup cache objects const ULONG ulNumberOfObjects = 10; for (ULONG ul = 0; ul < ulNumberOfObjects; ul++) { GPOS_CHECK_ABORT; // lookup relation CMDIdGPDB *mdid = GPOS_NEW(pmdtaskparams->m_mp) CMDIdGPDB(GPOPT_MDCACHE_TEST_OID /*OID*/, 1 /*major*/, ul + 1 /*minor*/); (void) md_accessor->RetrieveRel(mdid); mdid->Release(); } return NULL; }
//--------------------------------------------------------------------------- // @function: // CMDAccessorTest::PvLookupSingleObj // // @doc: // A task that looks up a single object from the MD cache // //--------------------------------------------------------------------------- void * CMDAccessorTest::PvLookupSingleObj ( void * pv ) { GPOS_CHECK_ABORT; GPOS_ASSERT(NULL != pv); SMDCacheTaskParams *pmdtaskparams = (SMDCacheTaskParams *) pv; CMDAccessor *md_accessor = pmdtaskparams->m_pmda; IMemoryPool *mp = pmdtaskparams->m_mp; GPOS_ASSERT(NULL != mp); GPOS_ASSERT(NULL != md_accessor); // lookup a cache object CMDIdGPDB *mdid = GPOS_NEW(mp) CMDIdGPDB(GPOPT_MDCACHE_TEST_OID /* OID */, 1 /* major version */, 1 /* minor version */); // lookup object (void) md_accessor->RetrieveRel(mdid); mdid->Release(); return NULL; }
// test cardinality for predicates of the form: a + c = b // for such predicates, NDV based cardinality estimation is not applicable GPOS_RESULT CJoinCardinalityNDVBasedEqPredTest::EresUnittest_NDVCardEstimationNotApplicableMultipleIdents() { // cartesian product / 2.5 // 2.5 = 1/.4 -- where .4 is default selectivity CDouble dRowsExpected(76004000); Fixture f(file_name); IMemoryPool *mp = f.Pmp(); IStatisticsArray *statistics_array = f.PdrgPstat(); CExpression *pexprLgGet = CTestUtils::PexprLogicalGet(mp); CLogicalGet *popGet = CLogicalGet::PopConvert(pexprLgGet->Pop()); CColRefArray *colref_array = popGet->PdrgpcrOutput(); // use the colid available in the input xml file CColRef *pcrLeft1 = (*colref_array)[2]; CColRef *pcrLeft2 = (*colref_array)[1]; CColRef *pcrRight = (*colref_array)[0]; // create a scalar ident // CScalarIdent "column_0000" (0) CExpression *pexprScalarIdentRight = CUtils::PexprScalarIdent(mp, pcrRight); CExpression *pexprScalarIdentLeft2 = CUtils::PexprScalarIdent(mp, pcrLeft2); // create a scalar op expression column_0002 + column_0001 // CScalarOp (+) // |--CScalarIdent "column_0002" (2) // +--CScalarIdent "column_0001" (1) CExpression *pexprScOp = CUtils::PexprScalarOp(mp, pcrLeft1, pexprScalarIdentLeft2, CWStringConst(GPOS_WSZ_LIT("+")), GPOS_NEW(mp) CMDIdGPDB(GPDB_INT4_ADD_OP)); // create a scalar comparision operator // +--CScalarCmp (=) // |--CScalarOp (+) // | |--CScalarIdent "column_0002" (2) // | +--CScalarIdent "column_0001" (1) // +--CScalarIdent "column_0000" (0) CExpression *pScalarCmp = CUtils::PexprScalarEqCmp(mp, pexprScOp, pexprScalarIdentRight); IStatistics *join_stats = CJoinStatsProcessor::CalcAllJoinStats(mp, statistics_array, pScalarCmp, IStatistics::EsjtInnerJoin); GPOS_ASSERT(NULL != join_stats); CDouble dRowsActual(join_stats->Rows()); GPOS_RESULT eres = GPOS_OK; if (floor(dRowsActual.Get()) != dRowsExpected) { eres = GPOS_FAILED; } join_stats->Release(); pexprLgGet->Release(); pScalarCmp->Release(); return eres; }
// test cardinality for predicates of the form: a + 1 = b // for such predicates, NDV based cardinality estimation is applicable GPOS_RESULT CJoinCardinalityNDVBasedEqPredTest::EresUnittest_NDVEqCardEstimation() { CDouble dRowsExpected(10000); // the minimum cardinality is min(NDV a, NDV b) Fixture f(file_name); IMemoryPool *mp = f.Pmp(); IStatisticsArray *statistics_array = f.PdrgPstat(); CExpression *pexprLgGet = CTestUtils::PexprLogicalGet(mp); CLogicalGet *popGet = CLogicalGet::PopConvert(pexprLgGet->Pop()); CColRefArray *colref_array = popGet->PdrgpcrOutput(); // use the colid available in the input xml file CColRef *pcrLeft = (*colref_array)[2]; CColRef *pcrRight = (*colref_array)[0]; // create a scalar ident // CScalarIdent "column_0000" (0) CExpression *pexprScalarIdentRight = CUtils::PexprScalarIdent(mp, pcrRight); // create a scalar op expression column_0002 + 10 // CScalarOp (+) // |--CScalarIdent "column_0002" (2) // +--CScalarConst (10) CExpression *pexprScConst = CUtils::PexprScalarConstInt4(mp, 10 /* val */); CExpression *pexprScOp = CUtils::PexprScalarOp(mp, pcrLeft, pexprScConst, CWStringConst(GPOS_WSZ_LIT("+")), GPOS_NEW(mp) CMDIdGPDB(GPDB_INT4_ADD_OP)); // create a scalar comparision operator // +--CScalarCmp (=) // |--CScalarOp (+) // | |--CScalarIdent "column_0002" (2) // | +--CScalarConst (10) // +--CScalarIdent "column_0000" (0) CExpression *pScalarCmp = CUtils::PexprScalarEqCmp(mp, pexprScOp, pexprScalarIdentRight); IStatistics *join_stats = CJoinStatsProcessor::CalcAllJoinStats(mp, statistics_array, pScalarCmp, IStatistics::EsjtInnerJoin); GPOS_ASSERT(NULL != join_stats); CDouble dRowsActual(join_stats->Rows()); GPOS_RESULT eres = GPOS_OK; if (std::floor(dRowsActual.Get()) != dRowsExpected) { eres = GPOS_FAILED; } join_stats->Release(); pexprLgGet->Release(); pScalarCmp->Release(); return eres; }
//--------------------------------------------------------------------------- // @function: // CMDAccessorTest::EresUnittest_Navigate // // @doc: // Test fetching a MD object from the cache and navigating its dependent // objects // //--------------------------------------------------------------------------- GPOS_RESULT CMDAccessorTest::EresUnittest_Navigate() { CAutoMemoryPool amp; IMemoryPool *mp = amp.Pmp(); // setup a file-based provider CMDProviderMemory *pmdp = CTestUtils::m_pmdpf; pmdp->AddRef(); CMDAccessor mda(mp, CMDCache::Pcache(), CTestUtils::m_sysidDefault, pmdp); // lookup a function in the MD cache CMDIdGPDB *mdid_func = GPOS_NEW(mp) CMDIdGPDB(GPDB_FUNC_TIMEOFDAY /* OID */, 1 /* major version */, 0 /* minor version */); const IMDFunction *pmdfunc = mda.RetrieveFunc(mdid_func); // lookup function return type IMDId *pmdidFuncReturnType = pmdfunc->GetResultTypeMdid(); const IMDType *pimdtype = mda.RetrieveType(pmdidFuncReturnType); // lookup equality operator for function return type IMDId *pmdidEqOp = pimdtype->GetMdidForCmpType(IMDType::EcmptEq); #ifdef GPOS_DEBUG const IMDScalarOp *md_scalar_op = #endif mda.RetrieveScOp(pmdidEqOp); #ifdef GPOS_DEBUG // print objects CWStringDynamic str(mp); COstreamString oss(&str); oss << std::endl; oss << std::endl; pmdfunc->DebugPrint(oss); oss << std::endl; pimdtype->DebugPrint(oss); oss << std::endl; md_scalar_op->DebugPrint(oss); oss << std::endl; GPOS_TRACE(str.GetBuffer()); #endif mdid_func->Release(); return GPOS_OK; }
//--------------------------------------------------------------------------- // @function: // CMDAccessorTest::EresUnittest_Negative // // @doc: // Test fetching non-existing metadata objects from the MD cache // //--------------------------------------------------------------------------- GPOS_RESULT CMDAccessorTest::EresUnittest_Negative() { CAutoMemoryPool amp(CAutoMemoryPool::ElcNone); IMemoryPool *mp = amp.Pmp(); // 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); // lookup a non-existing objects CMDIdGPDB *pmdidNonExistingObject = GPOS_NEW(mp) CMDIdGPDB(GPOPT_MDCACHE_TEST_OID /* OID */, 15 /* version */, 1 /* minor version */); // call should result in an exception (void) mda.RetrieveRel(pmdidNonExistingObject); pmdidNonExistingObject->Release(); return GPOS_OK; }
//--------------------------------------------------------------------------- // @function: // CTableDescriptorTest::EresUnittest_Basic // // @doc: // basic naming, assignment thru copy constructors // //--------------------------------------------------------------------------- GPOS_RESULT CTableDescriptorTest::EresUnittest_Basic() { CAutoMemoryPool amp; IMemoryPool *pmp = amp.Pmp(); // Setup an MD cache with a file-based provider CMDProviderMemory *pmdp = CTestUtils::m_pmdpf; pmdp->AddRef(); CMDAccessor mda(pmp, CMDCache::Pcache(), CTestUtils::m_sysidDefault, pmdp); // install opt context in TLS CAutoOptCtxt aoc ( pmp, &mda, NULL, /* pceeval */ CTestUtils::Pcm(pmp) ); CWStringConst strName(GPOS_WSZ_LIT("MyTable")); CMDIdGPDB *pmdid = GPOS_NEW(pmp) CMDIdGPDB(GPOPT_MDCACHE_TEST_OID, 1, 1); CTableDescriptor *ptabdesc = CTestUtils::PtabdescCreate(pmp, 10, pmdid, CName(&strName)); #ifdef GPOS_DEBUG CWStringDynamic str(pmp); COstreamString oss(&str); ptabdesc->OsPrint(oss); GPOS_TRACE(str.Wsz()); #endif // GPOS_DEBUG ptabdesc->Release(); return GPOS_OK; }
//--------------------------------------------------------------------------- // @function: // CPredicateUtilsTest::EresUnittest_Implication // // @doc: // Test removal of implied predicates // //--------------------------------------------------------------------------- GPOS_RESULT CPredicateUtilsTest::EresUnittest_Implication() { CAutoMemoryPool amp; IMemoryPool *mp = amp.Pmp(); // setup 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) ); // generate a two cascaded joins CWStringConst strName1(GPOS_WSZ_LIT("Rel1")); CMDIdGPDB *pmdid1 = GPOS_NEW(mp) CMDIdGPDB(GPOPT_TEST_REL_OID1, 1, 1); CTableDescriptor *ptabdesc1 = CTestUtils::PtabdescCreate(mp, 3, pmdid1, CName(&strName1)); CWStringConst strAlias1(GPOS_WSZ_LIT("Rel1")); CExpression *pexprRel1 = CTestUtils::PexprLogicalGet(mp, ptabdesc1, &strAlias1); CWStringConst strName2(GPOS_WSZ_LIT("Rel2")); CMDIdGPDB *pmdid2 = GPOS_NEW(mp) CMDIdGPDB(GPOPT_TEST_REL_OID2, 1, 1); CTableDescriptor *ptabdesc2 = CTestUtils::PtabdescCreate(mp, 3, pmdid2, CName(&strName2)); CWStringConst strAlias2(GPOS_WSZ_LIT("Rel2")); CExpression *pexprRel2 = CTestUtils::PexprLogicalGet(mp, ptabdesc2, &strAlias2); CWStringConst strName3(GPOS_WSZ_LIT("Rel3")); CMDIdGPDB *pmdid3 = GPOS_NEW(mp) CMDIdGPDB(GPOPT_TEST_REL_OID3, 1, 1); CTableDescriptor *ptabdesc3 = CTestUtils::PtabdescCreate(mp, 3, pmdid3, CName(&strName3)); CWStringConst strAlias3(GPOS_WSZ_LIT("Rel3")); CExpression *pexprRel3 = CTestUtils::PexprLogicalGet(mp, ptabdesc3, &strAlias3); CExpression *pexprJoin1 = CTestUtils::PexprLogicalJoin<CLogicalInnerJoin>(mp, pexprRel1, pexprRel2); CExpression *pexprJoin2 = CTestUtils::PexprLogicalJoin<CLogicalInnerJoin>(mp, pexprJoin1, pexprRel3); { CAutoTrace at(mp); at.Os() << "Original expression:" << std::endl << *pexprJoin2 <<std::endl; } // imply new predicates by deriving constraints CExpression *pexprConstraints = CExpressionPreprocessor::PexprAddPredicatesFromConstraints(mp, pexprJoin2); { CAutoTrace at(mp); at.Os() << "Expression with implied predicates:" << std::endl << *pexprConstraints <<std::endl;; } // minimize join predicates by removing implied conjuncts CExpressionHandle exprhdl(mp); exprhdl.Attach(pexprConstraints); CExpression *pexprMinimizedPred = CPredicateUtils::PexprRemoveImpliedConjuncts(mp, (*pexprConstraints)[2], exprhdl); { CAutoTrace at(mp); at.Os() << "Minimized join predicate:" << std::endl << *pexprMinimizedPred <<std::endl; } CExpressionArray *pdrgpexprOriginalConjuncts = CPredicateUtils::PdrgpexprConjuncts(mp, (*pexprConstraints)[2]); CExpressionArray *pdrgpexprNewConjuncts = CPredicateUtils::PdrgpexprConjuncts(mp, pexprMinimizedPred); GPOS_ASSERT(pdrgpexprNewConjuncts->Size() < pdrgpexprOriginalConjuncts->Size()); // clean up pdrgpexprOriginalConjuncts->Release(); pdrgpexprNewConjuncts->Release(); pexprJoin2->Release(); pexprConstraints->Release(); pexprMinimizedPred->Release(); return GPOS_OK; }
//--------------------------------------------------------------------------- // @function: // CPredicateUtilsTest::EresUnittest_PlainEqualities // // @doc: // Test the extraction of equality predicates between scalar identifiers // //--------------------------------------------------------------------------- GPOS_RESULT CPredicateUtilsTest::EresUnittest_PlainEqualities() { CAutoMemoryPool amp; IMemoryPool *mp = amp.Pmp(); // setup 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) ); CExpression *pexprLeft = CTestUtils::PexprLogicalGet(mp); CExpression *pexprRight = CTestUtils::PexprLogicalGet(mp); CExpressionArray *pdrgpexprOriginal = GPOS_NEW(mp) CExpressionArray(mp); CColRefSet *pcrsLeft = CDrvdPropRelational::GetRelationalProperties(pexprLeft->PdpDerive())->PcrsOutput(); CColRefSet *pcrsRight = CDrvdPropRelational::GetRelationalProperties(pexprRight->PdpDerive())->PcrsOutput(); CColRef *pcrLeft = pcrsLeft->PcrAny(); CColRef *pcrRight = pcrsRight->PcrAny(); // generate an equality predicate between two column reference CExpression *pexprScIdentEquality = CUtils::PexprScalarEqCmp(mp, pcrLeft, pcrRight); pexprScIdentEquality->AddRef(); pdrgpexprOriginal->Append(pexprScIdentEquality); // generate a non-equality predicate between two column reference CExpression *pexprScIdentInequality = CUtils::PexprScalarCmp(mp, pcrLeft, pcrRight, CWStringConst(GPOS_WSZ_LIT("<")), GPOS_NEW(mp) CMDIdGPDB(GPDB_INT4_LT_OP)); pexprScIdentInequality->AddRef(); pdrgpexprOriginal->Append(pexprScIdentInequality); // generate an equality predicate between a column reference and a constant value CExpression *pexprScalarConstInt4 = CUtils::PexprScalarConstInt4(mp, 10 /*fValue*/); CExpression *pexprScIdentConstEquality = CUtils::PexprScalarEqCmp(mp, pexprScalarConstInt4, pcrRight); pdrgpexprOriginal->Append(pexprScIdentConstEquality); GPOS_ASSERT(3 == pdrgpexprOriginal->Size()); CExpressionArray *pdrgpexprResult = CPredicateUtils::PdrgpexprPlainEqualities(mp, pdrgpexprOriginal); GPOS_ASSERT(1 == pdrgpexprResult->Size()); // clean up pdrgpexprOriginal->Release(); pdrgpexprResult->Release(); pexprLeft->Release(); pexprRight->Release(); pexprScIdentEquality->Release(); pexprScIdentInequality->Release(); return GPOS_OK; }
//--------------------------------------------------------------------------- // @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; }
//--------------------------------------------------------------------------- // @function: // CMDAccessorTest::EresUnittest_Indexes // // @doc: // Test fetching indexes from the cache // //--------------------------------------------------------------------------- GPOS_RESULT CMDAccessorTest::EresUnittest_Indexes() { CAutoMemoryPool amp; IMemoryPool *mp = amp.Pmp(); CAutoTrace at(mp); #ifdef GPOS_DEBUG IOstream &os(at.Os()); #endif // GPOS_DEBUG // 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) ); // lookup a relation in the MD cache CMDIdGPDB *rel_mdid = GPOS_NEW(mp) CMDIdGPDB(GPOPT_MDCACHE_TEST_OID, 1 /* major */, 1 /* minor version */); const IMDRelation *pmdrel = mda.RetrieveRel(rel_mdid); GPOS_ASSERT(0 < pmdrel->IndexCount()); IMDId *pmdidIndex = pmdrel->IndexMDidAt(0); const IMDIndex *pmdindex = mda.RetrieveIndex(pmdidIndex); ULONG ulKeys = pmdindex->Keys(); #ifdef GPOS_DEBUG // print index pmdindex->DebugPrint(os); os << std::endl; os << "Index columns: " << std::endl; #endif // GPOS_DEBUG for (ULONG ul = 0; ul < ulKeys; ul++) { ULONG ulKeyColumn = pmdindex->KeyAt(ul); #ifdef GPOS_DEBUG const IMDColumn *pmdcol = #endif // GPOS_DEBUG pmdrel->GetMdCol(ulKeyColumn); #ifdef GPOS_DEBUG pmdcol->DebugPrint(os); #endif // GPOS_DEBUG } rel_mdid->Release(); return GPOS_OK; }
//--------------------------------------------------------------------------- // @function: // CMDAccessorTest::EresUnittest_Basic // // @doc: // Test fetching metadata objects from a metadata cache // //--------------------------------------------------------------------------- GPOS_RESULT CMDAccessorTest::EresUnittest_Basic() { CAutoMemoryPool amp; IMemoryPool *mp = amp.Pmp(); // setup 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) ); // lookup different objects CMDIdGPDB *pmdidObject1 = GPOS_NEW(mp) CMDIdGPDB(GPOPT_MDCACHE_TEST_OID /* OID */, 1 /* major version */, 1 /* minor version */); CMDIdGPDB *pmdidObject2 = GPOS_NEW(mp) CMDIdGPDB(GPOPT_MDCACHE_TEST_OID /* OID */, 12 /* version */, 1 /* minor version */); #ifdef GPOS_DEBUG const IMDRelation *pimdrel1 = #endif mda.RetrieveRel(pmdidObject1); #ifdef GPOS_DEBUG const IMDRelation *pimdrel2 = #endif mda.RetrieveRel(pmdidObject2); GPOS_ASSERT(pimdrel1->MDId()->Equals(pmdidObject1) && pimdrel2->MDId()->Equals(pmdidObject2)); // access an object again #ifdef GPOS_DEBUG const IMDRelation *pimdrel3 = #endif mda.RetrieveRel(pmdidObject1); GPOS_ASSERT(pimdrel1 == pimdrel3); // access GPDB types, operators and aggregates CMDIdGPDB *mdid_type = GPOS_NEW(mp) CMDIdGPDB(GPDB_INT4, 1, 0); CMDIdGPDB *mdid_op = GPOS_NEW(mp) CMDIdGPDB(GPDB_OP_INT4_LT, 1, 0); CMDIdGPDB *agg_mdid = GPOS_NEW(mp) CMDIdGPDB(GPDB_AGG_AVG, 1, 0); #ifdef GPOS_DEBUG const IMDType *pimdtype = #endif mda.RetrieveType(mdid_type); #ifdef GPOS_DEBUG const IMDScalarOp *md_scalar_op = #endif mda.RetrieveScOp(mdid_op); GPOS_ASSERT(IMDType::EcmptL == md_scalar_op->ParseCmpType()); #ifdef GPOS_DEBUG const IMDAggregate *pmdagg = #endif mda.RetrieveAgg(agg_mdid); // access types by type info #ifdef GPOS_DEBUG const IMDTypeInt4 *pmdtypeint4 = #endif mda.PtMDType<IMDTypeInt4>(CTestUtils::m_sysidDefault); #ifdef GPOS_DEBUG const IMDTypeBool *pmdtypebool = #endif mda.PtMDType<IMDTypeBool>(CTestUtils::m_sysidDefault); #ifdef GPOS_DEBUG // for debug traces CAutoTrace at(mp); IOstream &os(at.Os()); // print objects os << std::endl; pimdrel1->DebugPrint(os); os << std::endl; pimdrel2->DebugPrint(os); os << std::endl; pimdtype->DebugPrint(os); os << std::endl; md_scalar_op->DebugPrint(os); os << std::endl; pmdagg->DebugPrint(os); os << std::endl; pmdtypeint4->DebugPrint(os); os << std::endl; pmdtypebool->DebugPrint(os); os << std::endl; #endif pmdidObject1->Release(); pmdidObject2->Release(); agg_mdid->Release(); mdid_op->Release(); mdid_type->Release(); return GPOS_OK; }