ORCA优化器浅析——CDXLOperator Base class for operators in a DXL tree
  5b99XfAwWKiH 2023年11月02日 31 0


ORCA优化器浅析——CDXLOperator Base class for operators in a DXL tree_数据库

如上图所示,CDXLOperator作为Base class for operators in a DXL tree,其子类CDXLLogical、CDXLScalar、CDXLPhysical作为逻辑节点、物理节点和Scalar节点的DXL表示类,因此其包含了这些类的共同部分特性,比如获取其DXL节点表示的函数GetDXLOperator、获取其Operator类型的函数GetDXLOperatorType,如下图右侧所示。

class CDXLOperator : public CRefCount {
private:	
	CDXLOperator(const CDXLOperator &); // private copy constructor
protected:	
	CMemoryPool *m_mp; // memory pool
public:	
	explicit CDXLOperator(CMemoryPool *); // ctor/dtor
	virtual ~CDXLOperator();	
	virtual Edxlopid GetDXLOperator() const = 0; // ident accessors	
	virtual const CWStringConst *GetOpNameStr() const = 0; // name of the operator
	virtual Edxloptype GetDXLOperatorType() const = 0;

	// serialize operator in DXL format given a serializer object and the
	// host DXL node, providing access to the operator's children
	virtual void SerializeToDXL(CXMLSerializer *, const CDXLNode *) const = 0;

	// check if given column is defined by operator
	virtual BOOL IsColDefined(ULONG	 // colid ) const { // by default, operator does not define columns
		return false;
	}

	static const CWStringConst *GetJoinTypeNameStr(EdxlJoinType);	
	static const CWStringConst *GetIdxScanDirectionStr(EdxlIndexScanDirection); // Return the index scan direction
};

其中最重要的函数是SerializeToDXL,该函数用于使用给定serializer object将operator序列化成DXL format。而GetOpNameStr函数则是获取该operator DXL类在DXL format中的标签,其实就是xml中的标签,如下代码所示,CDXLScalarAggref的标签为CDXLTokens::GetDXLTokenStr(EdxltokenScalarAggref),即为AggFunc。

const CWStringConst *CDXLScalarAggref::GetOpNameStr() const{
	return CDXLTokens::GetDXLTokenStr(EdxltokenScalarAggref);
}
		{EdxltokenScalarAggref, GPOS_WSZ_LIT("AggFunc")},

ORCA优化器浅析——CDXLOperator Base class for operators in a DXL tree_ci_02


operators in a DXL tree仅仅是DXL tree中的一部分,除了Operator DXL节点的标签,还有其他标签,比如Comment、Plan、Id等。

ORCA优化器浅析——CDXLOperator Base class for operators in a DXL tree_ci_03


【版权声明】本文内容来自摩杜云社区用户原创、第三方投稿、转载,内容版权归原作者所有。本网站的目的在于传递更多信息,不拥有版权,亦不承担相应法律责任。如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱: cloudbbs@moduyun.com

  1. 分享:
最后一次编辑于 2023年11月08日 0

暂无评论

推荐阅读
  anLrwkgbyYZS   2023年12月30日   27   0   0 i++iosi++ioscici
  anLrwkgbyYZS   2023年12月30日   29   0   0 ideciciMaxideMax
5b99XfAwWKiH