greenplumn CEnfdRewindability 源码

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

greenplumn CEnfdRewindability 代码

文件路径:/src/backend/gporca/libgpopt/src/base/CEnfdRewindability.cpp

//---------------------------------------------------------------------------
//	Greenplum Database
//	Copyright (C) 2011 Greenplum, Inc.
//
//	@filename:
//		CEnfdRewindability.cpp
//
//	@doc:
//		Implementation of rewindability property
//---------------------------------------------------------------------------

#include "gpopt/base/CEnfdRewindability.h"

#include "gpos/base.h"

#include "gpopt/base/CReqdPropPlan.h"
#include "gpopt/operators/CPhysicalSpool.h"


using namespace gpopt;


// initialization of static variables
const CHAR *CEnfdRewindability::m_szRewindabilityMatching[ErmSentinel] = {
	"satisfy"};


//---------------------------------------------------------------------------
//	@function:
//		CEnfdRewindability::CEnfdRewindability
//
//	@doc:
//		Ctor
//
//---------------------------------------------------------------------------
CEnfdRewindability::CEnfdRewindability(CRewindabilitySpec *prs,
									   ERewindabilityMatching erm)
	: m_prs(prs), m_erm(erm)
{
	GPOS_ASSERT(nullptr != prs);
	GPOS_ASSERT(ErmSentinel > erm);
}


//---------------------------------------------------------------------------
//	@function:
//		CEnfdRewindability::~CEnfdRewindability
//
//	@doc:
//		Dtor
//
//---------------------------------------------------------------------------
CEnfdRewindability::~CEnfdRewindability()
{
	CRefCount::SafeRelease(m_prs);
}


//---------------------------------------------------------------------------
//	@function:
//		CEnfdRewindability::FCompatible
//
//	@doc:
//		Check if the given rewindability specification is compatible
//		with the rewindability specification of this object for the
//		specified matching type
//
//---------------------------------------------------------------------------
BOOL
CEnfdRewindability::FCompatible(CRewindabilitySpec *prs) const
{
	GPOS_ASSERT(nullptr != prs);

	switch (m_erm)
	{
		case ErmSatisfy:
			return prs->FSatisfies(m_prs);

		case ErmSentinel:
			GPOS_ASSERT("invalid matching type");
	}

	return false;
}


//---------------------------------------------------------------------------
//	@function:
//		CEnfdRewindability::HashValue
//
//	@doc:
// 		Hash function
//
//---------------------------------------------------------------------------
ULONG
CEnfdRewindability::HashValue() const
{
	return gpos::CombineHashes(m_erm + 1, m_prs->HashValue());
}


//---------------------------------------------------------------------------
//	@function:
//		CEnfdRewindability::Epet
//
//	@doc:
// 		Get rewindability enforcing type for the given operator
//
//---------------------------------------------------------------------------
CEnfdProp::EPropEnforcingType
CEnfdRewindability::Epet(CExpressionHandle &exprhdl, CPhysical *popPhysical,
						 BOOL fRewindabilityReqd) const
{
	if (fRewindabilityReqd)
	{
		return popPhysical->EpetRewindability(exprhdl, this);
	}

	return EpetUnnecessary;
}


//---------------------------------------------------------------------------
//	@function:
//		CEnfdRewindability::OsPrint
//
//	@doc:
//		Print function
//
//---------------------------------------------------------------------------
IOstream &
CEnfdRewindability::OsPrint(IOstream &os) const
{
	(void) m_prs->OsPrint(os);

	return os << " match: " << m_szRewindabilityMatching[m_erm];
}


// EOF

相关信息

greenplumn 源码目录

相关文章

greenplumn CAutoOptCtxt 源码

greenplumn CCTEInfo 源码

greenplumn CCTEMap 源码

greenplumn CCTEReq 源码

greenplumn CCastUtils 源码

greenplumn CColConstraintsArrayMapper 源码

greenplumn CColConstraintsHashMapper 源码

greenplumn CColRef 源码

greenplumn CColRefComputed 源码

greenplumn CColRefSet 源码

0  赞