greenplumn ICostModel 源码

  • 2022-08-18
  • 浏览 (488)

greenplumn ICostModel 代码

文件路径:/src/backend/gporca/libgpdbcost/src/ICostModel.cpp

//---------------------------------------------------------------------------
//	Greenplum Database
//	Copyright (C) 2014 VMware, Inc. or its affiliates.
//
//	@filename:
//		ICostModel.cpp
//
//	@doc:
//		Cost model implementation
//---------------------------------------------------------------------------

#include "gpos/base.h"
#include "gpos/string/CWStringConst.h"

#include "gpdbcost/CCostModelGPDB.h"

using namespace gpopt;
using namespace gpdbcost;

// default number segments for the cost model
#define GPOPT_DEFAULT_SEGMENT_COUNT 2

//---------------------------------------------------------------------------
//	@function:
//		ICostModel::PcmDefault
//
//	@doc:
//		Create default cost model
//
//---------------------------------------------------------------------------
ICostModel *
ICostModel::PcmDefault(CMemoryPool *mp)
{
	return GPOS_NEW(mp) CCostModelGPDB(mp, GPOPT_DEFAULT_SEGMENT_COUNT);
}


//---------------------------------------------------------------------------
//	@function:
//		ICostModel::SetParams
//
//	@doc:
//		Set cost model params
//
//---------------------------------------------------------------------------
void
ICostModel::SetParams(ICostModelParamsArray *pdrgpcp) const
{
	if (nullptr == pdrgpcp)
	{
		return;
	}

	// overwrite default values of cost model parameters
	const ULONG size = pdrgpcp->Size();
	for (ULONG ul = 0; ul < size; ul++)
	{
		ICostModelParams::SCostParam *pcp = (*pdrgpcp)[ul];
		GetCostModelParams()->SetParam(pcp->Id(), pcp->Get(),
									   pcp->GetLowerBoundVal(),
									   pcp->GetUpperBoundVal());
	}
}


// EOF

相关信息

greenplumn 源码目录

相关文章

greenplumn CCostModelGPDB 源码

greenplumn CCostModelParamsGPDB 源码

0  赞