greenplumn CDXLPhysicalPartitionSelector 源码
greenplumn CDXLPhysicalPartitionSelector 代码
文件路径:/src/backend/gporca/libnaucrates/src/operators/CDXLPhysicalPartitionSelector.cpp
//---------------------------------------------------------------------------
// Greenplum Database
// Copyright (C) 2014 VMware, Inc. or its affiliates.
//
// @filename:
// CDXLPhysicalPartitionSelector.cpp
//
// @doc:
// Implementation of DXL physical partition selector
//---------------------------------------------------------------------------
#include "naucrates/dxl/operators/CDXLPhysicalPartitionSelector.h"
#include "gpos/common/CBitSetIter.h"
#include "naucrates/dxl/CDXLUtils.h"
#include "naucrates/dxl/operators/CDXLNode.h"
#include "naucrates/dxl/xml/CXMLSerializer.h"
using namespace gpos;
using namespace gpdxl;
//---------------------------------------------------------------------------
// @function:
// CDXLPhysicalPartitionSelector::CDXLPhysicalPartitionSelector
//
// @doc:
// Ctor
//
//---------------------------------------------------------------------------
CDXLPhysicalPartitionSelector::CDXLPhysicalPartitionSelector(
CMemoryPool *mp, IMDId *mdid_rel, ULONG selector_id, ULONG scan_id,
ULongPtrArray *parts)
: CDXLPhysical(mp),
m_rel_mdid(mdid_rel),
m_selector_id(selector_id),
m_scan_id(scan_id),
m_parts(parts)
{
}
//---------------------------------------------------------------------------
// @function:
// CDXLPhysicalPartitionSelector::~CDXLPhysicalPartitionSelector
//
// @doc:
// Destructor
//
//---------------------------------------------------------------------------
CDXLPhysicalPartitionSelector::~CDXLPhysicalPartitionSelector()
{
CRefCount::SafeRelease(m_parts);
CRefCount::SafeRelease(m_rel_mdid);
}
//---------------------------------------------------------------------------
// @function:
// CDXLPhysicalPartitionSelector::GetDXLOperator
//
// @doc:
// Operator type
//
//---------------------------------------------------------------------------
Edxlopid
CDXLPhysicalPartitionSelector::GetDXLOperator() const
{
return EdxlopPhysicalPartitionSelector;
}
//---------------------------------------------------------------------------
// @function:
// CDXLPhysicalPartitionSelector::GetOpNameStr
//
// @doc:
// Operator name
//
//---------------------------------------------------------------------------
const CWStringConst *
CDXLPhysicalPartitionSelector::GetOpNameStr() const
{
return CDXLTokens::GetDXLTokenStr(EdxltokenPhysicalPartitionSelector);
}
//---------------------------------------------------------------------------
// @function:
// CDXLPhysicalPartitionSelector::SerializeToDXL
//
// @doc:
// Serialize operator in DXL format
//
//---------------------------------------------------------------------------
void
CDXLPhysicalPartitionSelector::SerializeToDXL(CXMLSerializer *xml_serializer,
const CDXLNode *dxlnode) const
{
const CWStringConst *element_name = GetOpNameStr();
xml_serializer->OpenElement(
CDXLTokens::GetDXLTokenStr(EdxltokenNamespacePrefix), element_name);
m_rel_mdid->Serialize(xml_serializer,
CDXLTokens::GetDXLTokenStr(EdxltokenRelationMdid));
xml_serializer->AddAttribute(
CDXLTokens::GetDXLTokenStr(EdxltokenPhysicalPartitionSelectorId),
m_selector_id);
xml_serializer->AddAttribute(
CDXLTokens::GetDXLTokenStr(EdxltokenPhysicalPartitionSelectorScanId),
m_scan_id);
CWStringDynamic *serialized_partitions =
CDXLUtils::Serialize(m_mp, m_parts);
xml_serializer->AddAttribute(
CDXLTokens::GetDXLTokenStr(EdxltokenPartitions), serialized_partitions);
GPOS_DELETE(serialized_partitions);
dxlnode->SerializePropertiesToDXL(xml_serializer);
// serialize project list and filter lists
(*dxlnode)[0]->SerializeToDXL(xml_serializer);
// serialize printable filter
xml_serializer->OpenElement(
CDXLTokens::GetDXLTokenStr(EdxltokenNamespacePrefix),
CDXLTokens::GetDXLTokenStr(EdxltokenScalarPartFilterExpr));
(*dxlnode)[1]->SerializeToDXL(xml_serializer);
xml_serializer->CloseElement(
CDXLTokens::GetDXLTokenStr(EdxltokenNamespacePrefix),
CDXLTokens::GetDXLTokenStr(EdxltokenScalarPartFilterExpr));
// serialize relational child, if any
(*dxlnode)[2]->SerializeToDXL(xml_serializer);
xml_serializer->CloseElement(
CDXLTokens::GetDXLTokenStr(EdxltokenNamespacePrefix), element_name);
}
#ifdef GPOS_DEBUG
//---------------------------------------------------------------------------
// @function:
// CDXLPhysicalPartitionSelector::AssertValid
//
// @doc:
// Checks whether operator node is well-structured
//
//---------------------------------------------------------------------------
void
CDXLPhysicalPartitionSelector::AssertValid(const CDXLNode *dxlnode,
BOOL validate_children) const
{
const ULONG arity = dxlnode->Arity();
GPOS_ASSERT(6 == arity || 7 == arity);
for (ULONG idx = 0; idx < arity; ++idx)
{
CDXLNode *child_dxlnode = (*dxlnode)[idx];
if (validate_children)
{
child_dxlnode->GetOperator()->AssertValid(child_dxlnode,
validate_children);
}
}
}
#endif // GPOS_DEBUG
// EOF
相关信息
相关文章
greenplumn CDXLCtasStorageOptions 源码
0
赞
热门推荐
-
2、 - 优质文章
-
3、 gate.io
-
7、 golang
-
9、 openharmony
-
10、 Vue中input框自动聚焦