greenplumn CDXLScalarPartListValues 源码

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

greenplumn CDXLScalarPartListValues 代码

文件路径:/src/backend/gporca/libnaucrates/src/operators/CDXLScalarPartListValues.cpp

//---------------------------------------------------------------------------
//	Greenplum Database
//	Copyright (C) 2017 VMware, Inc. or its affiliates.
//
//	Implementation of DXL Part List Values expression
//---------------------------------------------------------------------------

#include "naucrates/dxl/operators/CDXLScalarPartListValues.h"

#include "gpopt/mdcache/CMDAccessor.h"
#include "naucrates/dxl/operators/CDXLNode.h"
#include "naucrates/dxl/xml/CXMLSerializer.h"

using namespace gpopt;
using namespace gpmd;
using namespace gpos;
using namespace gpdxl;

// Ctor
CDXLScalarPartListValues::CDXLScalarPartListValues(CMemoryPool *mp,
												   ULONG partitioning_level,
												   IMDId *result_type_mdid,
												   IMDId *elem_type_mdid)
	: CDXLScalar(mp),
	  m_partitioning_level(partitioning_level),
	  m_result_type_mdid(result_type_mdid),
	  m_elem_type_mdid(elem_type_mdid)
{
	GPOS_ASSERT(result_type_mdid->IsValid());
	GPOS_ASSERT(elem_type_mdid->IsValid());
}


// Dtor
CDXLScalarPartListValues::~CDXLScalarPartListValues()
{
	m_result_type_mdid->Release();
	m_elem_type_mdid->Release();
}

// Operator type
Edxlopid
CDXLScalarPartListValues::GetDXLOperator() const
{
	return EdxlopScalarPartListValues;
}

// Operator name
const CWStringConst *
CDXLScalarPartListValues::GetOpNameStr() const
{
	return CDXLTokens::GetDXLTokenStr(EdxltokenScalarPartListValues);
}

// partitioning level
ULONG
CDXLScalarPartListValues::GetPartitioningLevel() const
{
	return m_partitioning_level;
}

// result type
IMDId *
CDXLScalarPartListValues::GetResultTypeMdId() const
{
	return m_result_type_mdid;
}

// element type
IMDId *
CDXLScalarPartListValues::GetElemTypeMdId() const
{
	return m_elem_type_mdid;
}

// does the operator return a boolean result
BOOL
CDXLScalarPartListValues::HasBoolResult(CMDAccessor *  //md_accessor
) const
{
	return false;
}

// Serialize operator in DXL format
void
CDXLScalarPartListValues::SerializeToDXL(CXMLSerializer *xml_serializer,
										 const CDXLNode *  // dxlnode
) const
{
	const CWStringConst *element_name = GetOpNameStr();

	xml_serializer->OpenElement(
		CDXLTokens::GetDXLTokenStr(EdxltokenNamespacePrefix), element_name);
	xml_serializer->AddAttribute(CDXLTokens::GetDXLTokenStr(EdxltokenPartLevel),
								 m_partitioning_level);
	m_result_type_mdid->Serialize(
		xml_serializer,
		CDXLTokens::GetDXLTokenStr(EdxltokenGPDBScalarOpResultTypeId));
	m_elem_type_mdid->Serialize(
		xml_serializer, CDXLTokens::GetDXLTokenStr(EdxltokenArrayElementType));
	xml_serializer->CloseElement(
		CDXLTokens::GetDXLTokenStr(EdxltokenNamespacePrefix), element_name);
}

#ifdef GPOS_DEBUG
// Checks whether operator node is well-structured
void
CDXLScalarPartListValues::AssertValid(const CDXLNode *dxlnode,
									  BOOL	// validate_children
) const
{
	GPOS_ASSERT(0 == dxlnode->Arity());
}
#endif	// GPOS_DEBUG

// conversion function
CDXLScalarPartListValues *
CDXLScalarPartListValues::Cast(CDXLOperator *dxl_op)
{
	GPOS_ASSERT(nullptr != dxl_op);
	GPOS_ASSERT(EdxlopScalarPartListValues == dxl_op->GetDXLOperator());

	return dynamic_cast<CDXLScalarPartListValues *>(dxl_op);
}

// EOF

相关信息

greenplumn 源码目录

相关文章

greenplumn CDXLColDescr 源码

greenplumn CDXLColRef 源码

greenplumn CDXLCtasStorageOptions 源码

greenplumn CDXLDatum 源码

greenplumn CDXLDatumBool 源码

greenplumn CDXLDatumGeneric 源码

greenplumn CDXLDatumInt2 源码

greenplumn CDXLDatumInt4 源码

greenplumn CDXLDatumInt8 源码

greenplumn CDXLDatumOid 源码

0  赞