greenplumn CEnfdPartitionPropagation 源码

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

greenplumn CEnfdPartitionPropagation 代码

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

//---------------------------------------------------------------------------
//	Greenplum Database
//	Copyright (C) 2012 EMC Corp.
//
//	@filename:
//		CEnfdPartitionPropagation.cpp
//
//	@doc:
//		Implementation of enforced partition propagation property
//---------------------------------------------------------------------------

#include "gpopt/base/CEnfdPartitionPropagation.h"

#include "gpos/base.h"

#include "gpopt/base/CReqdPropPlan.h"
#include "gpopt/base/CUtils.h"
#include "gpopt/operators/CPhysical.h"

using namespace gpopt;


//---------------------------------------------------------------------------
//	@function:
//		CEnfdPartitionPropagation::CEnfdPartitionPropagation
//
//	@doc:
//		Ctor
//
//---------------------------------------------------------------------------
CEnfdPartitionPropagation::CEnfdPartitionPropagation(
	CPartitionPropagationSpec *ppps, EPartitionPropagationMatching eppm)
	: m_ppps(ppps), m_eppm(eppm)

{
	GPOS_ASSERT(nullptr != ppps);
	GPOS_ASSERT(EppmSentinel > eppm);
}


//---------------------------------------------------------------------------
//	@function:
//		CEnfdPartitionPropagation::~CEnfdPartitionPropagation
//
//	@doc:
//		Dtor
//
//---------------------------------------------------------------------------
CEnfdPartitionPropagation::~CEnfdPartitionPropagation()
{
	m_ppps->Release();
}


//---------------------------------------------------------------------------
//	@function:
//		CEnfdPartitionPropagation::HashValue
//
//	@doc:
// 		Hash function
//
//---------------------------------------------------------------------------
ULONG
CEnfdPartitionPropagation::HashValue() const
{
	return m_ppps->HashValue();
}


//---------------------------------------------------------------------------
//	@function:
//		CEnfdPartitionPropagation::Epet
//
//	@doc:
// 		Get partition propagation enforcing type for the given operator
//
//---------------------------------------------------------------------------
CEnfdProp::EPropEnforcingType
CEnfdPartitionPropagation::Epet(CExpressionHandle &exprhdl,
								CPhysical *popPhysical,
								BOOL fPropagationReqd) const
{
	if (fPropagationReqd)
	{
		return popPhysical->EpetPartitionPropagation(exprhdl, this);
	}

	return EpetUnnecessary;
}


//---------------------------------------------------------------------------
//	@function:
//		CEnfdPartitionPropagation::OsPrint
//
//	@doc:
//		Print function
//
//---------------------------------------------------------------------------
IOstream &
CEnfdPartitionPropagation::OsPrint(IOstream &os) const
{
	return os << (*m_ppps) << " match: " << SzPropagationMatching(m_eppm)
			  << " ";
}


//---------------------------------------------------------------------------
//	@function:
//		CEnfdPartitionPropagation::SzPropagationMatching
//
//	@doc:
//		Propagation matching string
//
//---------------------------------------------------------------------------
const CHAR *
CEnfdPartitionPropagation::SzPropagationMatching(
	EPartitionPropagationMatching eppm)
{
	GPOS_ASSERT(EppmSentinel > eppm);
	const CHAR *rgszPropagationMatching[EppmSentinel] = {"satisfy"};

	return rgszPropagationMatching[eppm];
}

BOOL
CEnfdPartitionPropagation::Matches(CEnfdPartitionPropagation *pepp)
{
	GPOS_ASSERT(nullptr != pepp);

	return m_eppm == pepp->Eppm() && m_ppps->Equals(pepp->PppsRequired());
}

BOOL
CEnfdPartitionPropagation::FCompatible(
	CPartitionPropagationSpec *pps_drvd) const
{
	GPOS_ASSERT(nullptr != pps_drvd);

	switch (m_eppm)
	{
		case EppmSatisfy:
			return pps_drvd->FSatisfies(m_ppps);

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

	return false;
}

// EOF

相关信息

greenplumn 源码目录

相关文章

greenplumn CAutoOptCtxt 源码

greenplumn CCTEInfo 源码

greenplumn CCTEMap 源码

greenplumn CCTEReq 源码

greenplumn CCastUtils 源码

greenplumn CColConstraintsArrayMapper 源码

greenplumn CColConstraintsHashMapper 源码

greenplumn CColRef 源码

greenplumn CColRefComputed 源码

greenplumn CColRefSet 源码

0  赞