greenplumn CXformInlineCTEConsumer 代码
文件路径:/src/backend/gporca/libgpopt/src/xforms/CXformInlineCTEConsumer.cpp
/---------------------------------------------------------------------------
/ Greenplum Database
/ Copyright (C) 2012 EMC Corp.
/
/ @filename:
/ CXformInlineCTEConsumer.cpp
/
/ @doc:
/ Implementation of transform
/---------------------------------------------------------------------------
#include "gpopt/xforms/CXformInlineCTEConsumer.h"
#include "gpos/base.h"
#include "gpopt/base/COptCtxt.h"
#include "gpopt/operators/CLogicalCTEConsumer.h"
#include "gpopt/xforms/CXformUtils.h"
using namespace gpopt;
/---------------------------------------------------------------------------
/ @function:
/ CXformInlineCTEConsumer::CXformInlineCTEConsumer
/
/ @doc:
/ Ctor
/
/---------------------------------------------------------------------------
CXformInlineCTEConsumer::CXformInlineCTEConsumer(CMemoryPool *mp)
: CXformExploration(
/ pattern
GPOS_NEW(mp) CExpression(mp, GPOS_NEW(mp) CLogicalCTEConsumer(mp)))
{
}
/---------------------------------------------------------------------------
/ @function:
/ CXformInlineCTEConsumer::Exfp
/
/ @doc:
/ Compute promise of xform
/
/---------------------------------------------------------------------------
CXform::EXformPromise
CXformInlineCTEConsumer::Exfp(CExpressionHandle &exprhdl) const
{
const ULONG id = CLogicalCTEConsumer::PopConvert(exprhdl.Pop())->UlCTEId();
CCTEInfo *pcteinfo = COptCtxt::PoctxtFromTLS()->Pcteinfo();
if ((pcteinfo->FEnableInlining() || 1 == pcteinfo->UlConsumers(id)) &&
CXformUtils::FInlinableCTE(id))
{
return CXform::ExfpHigh;
}
return CXform::ExfpNone;
}
/---------------------------------------------------------------------------
/ @function:
/ CXformInlineCTEConsumer::Transform
/
/ @doc:
/ Actual transformation
/
/---------------------------------------------------------------------------
void
CXformInlineCTEConsumer::Transform(CXformContext *
#ifdef GPOS_DEBUG
pxfctxt
#endif
,
CXformResult *pxfres,
CExpression *pexpr) const
{
GPOS_ASSERT(nullptr != pxfctxt);
GPOS_ASSERT(FPromising(pxfctxt->Pmp(), this, pexpr));
GPOS_ASSERT(FCheckPattern(pexpr));
/ inline the consumer
CLogicalCTEConsumer *popConsumer =
CLogicalCTEConsumer::PopConvert(pexpr->Pop());
CExpression *pexprAlt = popConsumer->PexprInlined();
pexprAlt->AddRef();
/ add alternative to xform result
pxfres->Add(pexprAlt);
}
/ EOF
相关信息
相关文章
greenplumn CJoinOrderGreedy 源码
greenplumn CJoinOrderMinCard 源码
greenplumn CSubqueryHandler 源码