greenplumn CMDFunctionGPDB 源码

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

greenplumn CMDFunctionGPDB 代码

文件路径:/src/backend/gporca/libnaucrates/include/naucrates/md/CMDFunctionGPDB.h

//---------------------------------------------------------------------------
//	Greenplum Database
//	Copyright (C) 2011 EMC Corp.
//
//	@filename:
//		CMDFunctionGPDB.h
//
//	@doc:
//		Implementation of GPDB-specific functions in the metadata cache
//---------------------------------------------------------------------------


#ifndef GPMD_CMDFunctionGPDB_H
#define GPMD_CMDFunctionGPDB_H

#include "gpos/base.h"

#include "naucrates/dxl/xml/CXMLSerializer.h"
#include "naucrates/md/IMDFunction.h"

namespace gpmd
{
using namespace gpdxl;

//---------------------------------------------------------------------------
//	@class:
//		CMDFunctionGPDB
//
//	@doc:
//		Implementation for GPDB-specific functions in the metadata cache
//
//---------------------------------------------------------------------------
class CMDFunctionGPDB : public IMDFunction
{
private:
	// memory pool
	CMemoryPool *m_mp;

	// DXL for object
	const CWStringDynamic *m_dxl_str;

	// func id
	IMDId *m_mdid;

	// func name
	CMDName *m_mdname;

	// result type
	IMDId *m_mdid_type_result;

	// output argument types
	IMdIdArray *m_mdid_types_array;

	// whether function returns a set of values
	BOOL m_returns_set;

	// function stability
	EFuncStbl m_func_stability;

	// function data access
	EFuncDataAcc m_func_data_access;

	// function strictness (i.e. whether func returns NULL on NULL input)
	BOOL m_is_strict;

	// function result has very similar number of distinct values as the
	// single function argument (used for cardinality estimation)
	BOOL m_is_ndv_preserving;

	// is an increasing function (non-implicit/lossy cast) which can be used for partition selection
	BOOL m_is_allowed_for_PS;

	// dxl token array for stability
	Edxltoken m_dxl_func_stability_array[EfsSentinel];

	// dxl token array for data access
	Edxltoken m_dxl_data_access_array[EfdaSentinel];

	// returns the string representation of the function stability
	const CWStringConst *GetFuncStabilityStr() const;

	// returns the string representation of the function data access
	const CWStringConst *GetFuncDataAccessStr() const;

	// serialize the array of output arg types into a comma-separated string
	CWStringDynamic *GetOutputArgTypeArrayStr() const;

	// initialize dxl token arrays
	void InitDXLTokenArrays();

public:
	CMDFunctionGPDB(const CMDFunctionGPDB &) = delete;

	// ctor/dtor
	CMDFunctionGPDB(CMemoryPool *mp, IMDId *mdid, CMDName *mdname,
					IMDId *result_type_mdid, IMdIdArray *mdid_array,
					BOOL ReturnsSet, EFuncStbl func_stability,
					EFuncDataAcc func_data_access, BOOL is_strict,
					BOOL is_ndv_preserving, BOOL is_allowed_for_PS);

	~CMDFunctionGPDB() override;

	// accessors
	const CWStringDynamic *
	GetStrRepr() const override
	{
		return m_dxl_str;
	}

	// function id
	IMDId *MDId() const override;

	// function name
	CMDName Mdname() const override;

	// result type
	IMDId *GetResultTypeMdid() const override;

	// output argument types
	IMdIdArray *OutputArgTypesMdidArray() const override;

	// does function return NULL on NULL input
	BOOL
	IsStrict() const override
	{
		return m_is_strict;
	}

	BOOL
	IsNDVPreserving() const override
	{
		return m_is_ndv_preserving;
	}

	// is this function a lossy cast allowed for Partition selection
	BOOL
	IsAllowedForPS() const override
	{
		return m_is_allowed_for_PS;
	}

	// function stability
	EFuncStbl
	GetFuncStability() const override
	{
		return m_func_stability;
	}

	// function data access
	EFuncDataAcc
	GetFuncDataAccess() const override
	{
		return m_func_data_access;
	}

	// does function return a set of values
	BOOL ReturnsSet() const override;

	// serialize object in DXL format
	void Serialize(gpdxl::CXMLSerializer *xml_serializer) const override;

#ifdef GPOS_DEBUG
	// debug print of the type in the provided stream
	void DebugPrint(IOstream &os) const override;
#endif
};
}  // namespace gpmd

#endif	// !GPMD_CMDFunctionGPDB_H

// EOF

相关信息

greenplumn 源码目录

相关文章

greenplumn CDXLBucket 源码

greenplumn CDXLColStats 源码

greenplumn CDXLRelStats 源码

greenplumn CDXLStatsDerivedColumn 源码

greenplumn CDXLStatsDerivedRelation 源码

greenplumn CGPDBTypeHelper 源码

greenplumn CMDAggregateGPDB 源码

greenplumn CMDArrayCoerceCastGPDB 源码

greenplumn CMDCastGPDB 源码

greenplumn CMDCheckConstraintGPDB 源码

0  赞