greenplumn CXformMaxOneRow2Assert 源码

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

greenplumn CXformMaxOneRow2Assert 代码

文件路径:/src/backend/gporca/libgpopt/src/xforms/CXformMaxOneRow2Assert.cpp

//---------------------------------------------------------------------------
//	Greenplum Database
//	Copyright (C) 2014 VMware, Inc. or its affiliates.
//
//	@filename:
//		CXformMaxOneRow2Assert.cpp
//
//	@doc:
//		Implementation of transform
//---------------------------------------------------------------------------

#include "gpopt/xforms/CXformMaxOneRow2Assert.h"

#include "gpos/base.h"

#include "gpopt/operators/CLogicalMaxOneRow.h"
#include "gpopt/operators/CPatternLeaf.h"
#include "gpopt/xforms/CXformUtils.h"


using namespace gpopt;


//---------------------------------------------------------------------------
//	@function:
//		CXformMaxOneRow2Assert::CXformMaxOneRow2Assert
//
//	@doc:
//		Ctor
//
//---------------------------------------------------------------------------
CXformMaxOneRow2Assert::CXformMaxOneRow2Assert(CMemoryPool *mp)
	: CXformExploration(
		  // pattern
		  GPOS_NEW(mp) CExpression(
			  mp, GPOS_NEW(mp) CLogicalMaxOneRow(mp),
			  GPOS_NEW(mp) CExpression(mp, GPOS_NEW(mp) CPatternLeaf(mp))))
{
}

//---------------------------------------------------------------------------
//	@function:
//		CXformMaxOneRow2Assert::Exfp
//
//	@doc:
//		Compute promise of xform
//
//---------------------------------------------------------------------------
CXform::EXformPromise
CXformMaxOneRow2Assert::Exfp(CExpressionHandle &  // exprhdl
) const
{
	return CXform::ExfpHigh;
}

//---------------------------------------------------------------------------
//	@function:
//		CXformMaxOneRow2Assert::Transform
//
//	@doc:
//		Actual transformation
//
//---------------------------------------------------------------------------
void
CXformMaxOneRow2Assert::Transform(CXformContext *pxfctxt, CXformResult *pxfres,
								  CExpression *pexpr) const
{
	GPOS_ASSERT(nullptr != pxfctxt);
	GPOS_ASSERT(FPromising(pxfctxt->Pmp(), this, pexpr));
	GPOS_ASSERT(FCheckPattern(pexpr));

	CMemoryPool *mp = pxfctxt->Pmp();

	// create Logical Assert that checks if more than one rows are generated by child
	CExpression *pexprAlt = CXformUtils::PexprAssertOneRow(mp, (*pexpr)[0]);

	// add alternative to transformation result
	pxfres->Add(pexprAlt);
}

// EOF

相关信息

greenplumn 源码目录

相关文章

greenplumn CDecorrelator 源码

greenplumn CJoinOrder 源码

greenplumn CJoinOrderDP 源码

greenplumn CJoinOrderDPv2 源码

greenplumn CJoinOrderGreedy 源码

greenplumn CJoinOrderMinCard 源码

greenplumn CSubqueryHandler 源码

greenplumn CXform 源码

greenplumn CXformCTEAnchor2Sequence 源码

greenplumn CXformCTEAnchor2TrivialSelect 源码

0  赞