greenplumn CDistributionSpecReplicated 源码

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

greenplumn CDistributionSpecReplicated 代码

文件路径:/src/backend/gporca/libgpopt/include/gpopt/base/CDistributionSpecReplicated.h

//---------------------------------------------------------------------------
//	Greenplum Database
//	Copyright (C) 2011 EMC Corp.
//
//	@filename:
//		CDistributionSpecReplicated.h
//
//	@doc:
//		Description of a replicated distribution;
//		Can be used as required or derived property;
//---------------------------------------------------------------------------
#ifndef GPOPT_CDistributionSpecReplicated_H
#define GPOPT_CDistributionSpecReplicated_H

#include "gpos/base.h"

#include "gpopt/base/CDistributionSpec.h"

namespace gpopt
{
using namespace gpos;

class CDistributionSpecReplicated : public CDistributionSpec
{
private:
	// replicated support
	CDistributionSpec::EDistributionType m_replicated;

public:
	CDistributionSpecReplicated(const CDistributionSpecReplicated &) = delete;

	// ctor
	CDistributionSpecReplicated(
		CDistributionSpec::EDistributionType replicated_type)
		: m_replicated(replicated_type)
	{
		GPOS_ASSERT(replicated_type == CDistributionSpec::EdtReplicated ||
					replicated_type ==
						CDistributionSpec::EdtTaintedReplicated ||
					replicated_type == CDistributionSpec::EdtStrictReplicated);
	}

	// accessor
	EDistributionType
	Edt() const override
	{
		return m_replicated;
	}

	// does this distribution satisfy the given one
	BOOL FSatisfies(const CDistributionSpec *pds) const override;

	// append enforcers to dynamic array for the given plan properties
	void AppendEnforcers(CMemoryPool *mp, CExpressionHandle &exprhdl,
						 CReqdPropPlan *prpp, CExpressionArray *pdrgpexpr,
						 CExpression *pexpr) override;

	// return distribution partitioning type
	EDistributionPartitioningType
	Edpt() const override
	{
		return EdptNonPartitioned;
	}

	// print
	IOstream &
	OsPrint(IOstream &os) const override
	{
		switch (Edt())
		{
			case CDistributionSpec::EdtReplicated:
				os << "REPLICATED";
				break;
			case CDistributionSpec::EdtTaintedReplicated:
				os << "TAINTED REPLICATED";
				break;
			case CDistributionSpec::EdtStrictReplicated:
				os << "STRICT REPLICATED";
				break;
			default:
				GPOS_ASSERT(
					!"Replicated type must be General, Tainted, or Strict");
		}
		return os;
	}

	// conversion function
	static CDistributionSpecReplicated *
	PdsConvert(CDistributionSpec *pds)
	{
		GPOS_ASSERT(nullptr != pds);
		GPOS_ASSERT(EdtStrictReplicated == pds->Edt() ||
					EdtReplicated == pds->Edt() ||
					EdtTaintedReplicated == pds->Edt());

		return dynamic_cast<CDistributionSpecReplicated *>(pds);
	}

};	// class CDistributionSpecReplicated

}  // namespace gpopt

#endif	// !GPOPT_CDistributionSpecReplicated_H

// EOF

相关信息

greenplumn 源码目录

相关文章

greenplumn CAutoOptCtxt 源码

greenplumn CCTEInfo 源码

greenplumn CCTEMap 源码

greenplumn CCTEReq 源码

greenplumn CCastUtils 源码

greenplumn CColConstraintsArrayMapper 源码

greenplumn CColConstraintsHashMapper 源码

greenplumn CColRef 源码

greenplumn CColRefComputed 源码

greenplumn CColRefSet 源码

0  赞