greenplumn CScalarIdent 源码

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

greenplumn CScalarIdent 代码

文件路径:/src/backend/gporca/libgpopt/include/gpopt/operators/CScalarIdent.h

//---------------------------------------------------------------------------
//	Greenplum Database
//	Copyright (C) 2009 Greenplum, Inc.
//
//	@filename:
//		CScalarIdent.h
//
//	@doc:
//		Scalar column identifier
//---------------------------------------------------------------------------
#ifndef GPOPT_CScalarIdent_H
#define GPOPT_CScalarIdent_H

#include "gpos/base.h"

#include "gpopt/base/CDrvdProp.h"
#include "gpopt/operators/CScalar.h"

namespace gpopt
{
using namespace gpos;

//---------------------------------------------------------------------------
//	@class:
//		CScalarIdent
//
//	@doc:
//		scalar identifier operator
//
//---------------------------------------------------------------------------
class CScalarIdent : public CScalar
{
private:
	// column
	const CColRef *m_pcr;


public:
	CScalarIdent(const CScalarIdent &) = delete;

	// ctor
	CScalarIdent(CMemoryPool *mp, const CColRef *colref)
		: CScalar(mp), m_pcr(colref)
	{
	}

	// dtor
	~CScalarIdent() override = default;

	// ident accessors
	EOperatorId
	Eopid() const override
	{
		return EopScalarIdent;
	}

	// return a string for operator name
	const CHAR *
	SzId() const override
	{
		return "CScalarIdent";
	}

	// accessor
	const CColRef *
	Pcr() const
	{
		return m_pcr;
	}

	// operator specific hash function
	ULONG HashValue() const override;

	// match function
	BOOL Matches(COperator *pop) const override;

	// sensitivity to order of inputs
	BOOL FInputOrderSensitive() const override;

	// return a copy of the operator with remapped columns
	COperator *PopCopyWithRemappedColumns(CMemoryPool *mp,
										  UlongToColRefMap *colref_mapping,
										  BOOL must_exist) override;


	// return locally used columns
	CColRefSet *
	PcrsUsed(CMemoryPool *mp,
			 CExpressionHandle &  // exprhdl

			 ) override
	{
		CColRefSet *pcrs = GPOS_NEW(mp) CColRefSet(mp);
		pcrs->Include(m_pcr);

		return pcrs;
	}

	// conversion function
	static CScalarIdent *
	PopConvert(COperator *pop)
	{
		GPOS_ASSERT(nullptr != pop);
		GPOS_ASSERT(EopScalarIdent == pop->Eopid());

		return dynamic_cast<CScalarIdent *>(pop);
	}

	// the type of the scalar expression
	IMDId *MdidType() const override;

	// the type modifier of the scalar expression
	INT TypeModifier() const override;

	// print
	IOstream &OsPrint(IOstream &os) const override;

	// is the given expression a scalar cast of a scalar identifier
	static BOOL FCastedScId(CExpression *pexpr);

	// is the given expression a scalar cast of given scalar identifier
	static BOOL FCastedScId(CExpression *pexpr, CColRef *colref);

	// is the given expression a scalar func allowed for Partition selection of given scalar identifier
	static BOOL FAllowedFuncScId(CExpression *pexpr);

	// is the given expression a scalar func allowed for Partition selection of given scalar identifier
	static BOOL FAllowedFuncScId(CExpression *pexpr, CColRef *colref);

};	// class CScalarIdent

}  // namespace gpopt


#endif	// !GPOPT_CScalarIdent_H

// EOF

相关信息

greenplumn 源码目录

相关文章

greenplumn CExpression 源码

greenplumn CExpressionFactorizer 源码

greenplumn CExpressionHandle 源码

greenplumn CExpressionPreprocessor 源码

greenplumn CExpressionUtils 源码

greenplumn CHashedDistributions 源码

greenplumn CLogical 源码

greenplumn CLogicalApply 源码

greenplumn CLogicalAssert 源码

greenplumn CLogicalBitmapTableGet 源码

0  赞