greenplumn CAutoOptCtxt 源码
greenplumn CAutoOptCtxt 代码
文件路径:/src/backend/gporca/libgpopt/src/base/CAutoOptCtxt.cpp
//---------------------------------------------------------------------------
// Greenplum Database
// Copyright (C) 2009 Greenplum, Inc.
//
// @filename:
// CAutoOptCtxt.cpp
//
// @doc:
// Implementation of auto opt context
//---------------------------------------------------------------------------
#include "gpopt/base/CAutoOptCtxt.h"
#include "gpos/base.h"
#include "gpopt/cost/ICostModel.h"
#include "gpopt/eval/CConstExprEvaluatorDefault.h"
#include "gpopt/optimizer/COptimizerConfig.h"
using namespace gpopt;
//---------------------------------------------------------------------------
// @function:
// CAutoOptCtxt::CAutoOptCtxt
//
// @doc:
// ctor
// Create and install default optimizer context
//
//---------------------------------------------------------------------------
CAutoOptCtxt::CAutoOptCtxt(CMemoryPool *mp, CMDAccessor *md_accessor,
IConstExprEvaluator *pceeval,
COptimizerConfig *optimizer_config)
{
if (nullptr == optimizer_config)
{
// create default statistics configuration
optimizer_config = COptimizerConfig::PoconfDefault(mp);
}
if (nullptr == pceeval)
{
// use the default constant expression evaluator which cannot evaluate any expression
pceeval = GPOS_NEW(mp) CConstExprEvaluatorDefault();
}
COptCtxt *poctxt =
COptCtxt::PoctxtCreate(mp, md_accessor, pceeval, optimizer_config);
ITask::Self()->GetTls().Store(poctxt);
}
//---------------------------------------------------------------------------
// @function:
// CAutoOptCtxt::CAutoOptCtxt
//
// @doc:
// ctor
// Create and install default optimizer context with the given cost model
//
//---------------------------------------------------------------------------
CAutoOptCtxt::CAutoOptCtxt(CMemoryPool *mp, CMDAccessor *md_accessor,
IConstExprEvaluator *pceeval, ICostModel *pcm)
{
GPOS_ASSERT(nullptr != pcm);
// create default statistics configuration
COptimizerConfig *optimizer_config =
COptimizerConfig::PoconfDefault(mp, pcm);
if (nullptr == pceeval)
{
// use the default constant expression evaluator which cannot evaluate any expression
pceeval = GPOS_NEW(mp) CConstExprEvaluatorDefault();
}
COptCtxt *poctxt =
COptCtxt::PoctxtCreate(mp, md_accessor, pceeval, optimizer_config);
ITask::Self()->GetTls().Store(poctxt);
}
//---------------------------------------------------------------------------
// @function:
// CAutoOptCtxt::~CAutoOptCtxt
//
// @doc:
// dtor
// uninstall optimizer context and destroy
//
//---------------------------------------------------------------------------
CAutoOptCtxt::~CAutoOptCtxt()
{
CTaskLocalStorageObject *ptlsobj =
ITask::Self()->GetTls().Get(CTaskLocalStorage::EtlsidxOptCtxt);
ITask::Self()->GetTls().Remove(ptlsobj);
GPOS_DELETE(ptlsobj);
}
// EOF
相关信息
相关文章
greenplumn CColConstraintsArrayMapper 源码
0
赞
热门推荐
-
2、 - 优质文章
-
3、 gate.io
-
8、 golang
-
9、 openharmony
-
10、 Vue中input框自动聚焦