greenplumn CDistributionSpecAny 源码

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

greenplumn CDistributionSpecAny 代码

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

//---------------------------------------------------------------------------
//	Greenplum Database
//	Copyright (C) 2011 EMC Corp.
//
//	@filename:
//		CDistributionSpecAny.h
//
//	@doc:
//		Description of a general distribution which imposes no requirements;
//		Can be used only as a required property;
//---------------------------------------------------------------------------
#ifndef GPOPT_CDistributionSpecAny_H
#define GPOPT_CDistributionSpecAny_H

#include "gpos/base.h"

#include "gpopt/base/CDistributionSpec.h"
#include "gpopt/operators/COperator.h"

namespace gpopt
{
using namespace gpos;

//---------------------------------------------------------------------------
//	@class:
//		CDistributionSpecAny
//
//	@doc:
//		Class for representing general distribution specification which
//		imposes no requirements.
//
//---------------------------------------------------------------------------
class CDistributionSpecAny : public CDistributionSpec
{
private:
	// the physical operator that originally requested this distribution spec
	COperator::EOperatorId m_eopidRequested;

	// allow outer references in the operator tree where distribution is requested
	BOOL m_fAllowOuterRefs;


public:
	CDistributionSpecAny(const CDistributionSpecAny &) = delete;

	//ctor
	CDistributionSpecAny(COperator::EOperatorId eopidRequested)
		: m_eopidRequested(eopidRequested), m_fAllowOuterRefs(false)
	{
	}

	//ctor
	CDistributionSpecAny(COperator::EOperatorId eopidRequested,
						 BOOL fAllowOuterRefs)
		: m_eopidRequested(eopidRequested), m_fAllowOuterRefs(fAllowOuterRefs)
	{
	}

	// accessor
	EDistributionType
	Edt() const override
	{
		return CDistributionSpec::EdtAny;
	}

	// does current distribution satisfy the given one
	BOOL
	FSatisfies(const CDistributionSpec *pds) const override
	{
		return EdtAny == pds->Edt();
	}

	// return true if distribution spec can be derived
	BOOL
	FDerivable() const override
	{
		return false;
	}

	// append enforcers to dynamic array for the given plan properties
	void
	AppendEnforcers(
		CMemoryPool *,		  // mp
		CExpressionHandle &,  // exprhdl: gives access to child properties
		CReqdPropPlan *,	  // prpp
		CExpressionArray *,	  // pdrgpexpr
		CExpression *		  // pexpr
		) override
	{
		GPOS_ASSERT(!"attempt to enforce ANY distribution");
	}

	// print
	IOstream &
	OsPrint(IOstream &os) const override
	{
		return os << "ANY "
				  << " EOperatorId: " << m_eopidRequested << " ";
	}

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

	// allow outer references in the operator tree where distribution is requested
	BOOL
	FAllowOuterRefs() const
	{
		return m_fAllowOuterRefs;
	}

	// conversion function
	static CDistributionSpecAny *
	PdsConvert(CDistributionSpec *pds)
	{
		GPOS_ASSERT(nullptr != pds);
		GPOS_ASSERT(EdtAny == pds->Edt());

		return dynamic_cast<CDistributionSpecAny *>(pds);
	}

	// retrieve the physical operator requesting this distribution spec
	COperator::EOperatorId
	GetRequestedOperatorId() const
	{
		return m_eopidRequested;
	}

};	// class CDistributionSpecAny

}  // namespace gpopt

#endif	// !GPOPT_CDistributionSpecAny_H

// EOF

相关信息

greenplumn 源码目录

相关文章

greenplumn CAutoOptCtxt 源码

greenplumn CCTEInfo 源码

greenplumn CCTEMap 源码

greenplumn CCTEReq 源码

greenplumn CCastUtils 源码

greenplumn CColConstraintsArrayMapper 源码

greenplumn CColConstraintsHashMapper 源码

greenplumn CColRef 源码

greenplumn CColRefComputed 源码

greenplumn CColRefSet 源码

0  赞