[FEAT MERGE] 开源裁减颗粒度优化

Co-authored-by: nroskill <nroskill@gmail.com>
Co-authored-by: akaError <lzg020616@163.com>
Co-authored-by: yinyj17 <yinyijun92@gmail.com>
This commit is contained in:
wenxingsen
2023-08-15 02:40:25 +00:00
committed by ob-robot
parent a31e422133
commit 9b31f8aa03
378 changed files with 26718 additions and 2379 deletions

View File

@ -15,6 +15,11 @@
#define OCEANBASE_SQL_ENGINE_EXPR_OB_EXPR_UPDATE_XML_H
#include "sql/engine/expr/ob_expr_operator.h"
#ifdef OB_BUILD_ORACLE_XML
#include "lib/xml/ob_multi_mode_interface.h"
#include "lib/xml/ob_xml_tree.h"
#include "lib/xml/ob_xpath.h"
#endif
namespace oceanbase
{
@ -31,11 +36,51 @@ public:
ObExprResType *types,
int64_t param_num,
common::ObExprTypeCtx &type_ctx) const override;
#ifdef OB_BUILD_ORACLE_XML
static int eval_update_xml(const ObExpr &expr, ObEvalCtx &ctx, ObDatum &res);
#else
static int eval_update_xml(const ObExpr &expr, ObEvalCtx &ctx, ObDatum &res) { return OB_NOT_SUPPORTED; }
#endif
virtual int cg_expr(ObExprCGCtx &expr_cg_ctx,
const ObRawExpr &raw_expr,
ObExpr &rt_expr)
const override;
#ifdef OB_BUILD_ORACLE_XML
private:
static int update_xml_tree(ObMulModeMemCtx* xml_mem_ctx,
const ObExpr *expr,
ObEvalCtx &ctx,
ObString &xpath_str,
ObString &default_ns,
ObPathVarObject *prefix_ns,
ObIMulModeBase *xml_tree);
static int update_xml_node(ObMulModeMemCtx* xml_mem_ctx, const ObExpr *expr, ObEvalCtx &ctx, ObIMulModeBase *node);
// for text node and attribute
static int update_text_or_attribute_node(ObMulModeMemCtx* xml_mem_ctx,
ObXmlNode *xml_node,
const ObExpr *expr,
ObEvalCtx &ctx,
bool is_text);
static int update_attribute_node(ObIAllocator &allocator, ObXmlNode *xml_node, const ObExpr *expr, ObEvalCtx &ctx);
static int update_attribute_xml_node(ObXmlNode *old_node, ObXmlNode *update_node);
// for cdata and comment
static int update_cdata_and_comment_node(ObMulModeMemCtx* xml_mem_ctx, ObXmlNode *xml_node, const ObExpr *expr, ObEvalCtx &ctx);
// for namespace
static int update_namespace_node(ObMulModeMemCtx* xml_mem_ctx, ObXmlNode *xml_node, const ObExpr *expr, ObEvalCtx &ctx);
static int update_namespace_xml_node(ObIAllocator &allocator, ObXmlNode *old_node, ObXmlNode *update_node);
static int update_namespace_value(ObIAllocator &allocator, ObXmlNode *xml_node, const ObString &ns_value);
static int get_valid_default_ns_from_parent(ObXmlNode *cur_node, ObXmlAttribute* &default_ns);
static int set_ns_recrusively(ObXmlNode *update_node, ObXmlAttribute *ns);
static int update_new_nodes_ns(ObIAllocator &allocator, ObXmlNode *parent, ObXmlNode *update_node);
static int update_exist_nodes_ns(ObXmlElement *parent, ObXmlAttribute *prefix_ns);
// for element
static int update_element_node(ObMulModeMemCtx* xml_mem_ctx, ObXmlNode *xml_node, const ObExpr *expr, ObEvalCtx &ctx);
static int clear_element_child_node(ObXmlElement *ele_node);
static int update_xml_child_node(ObIAllocator &allocator, ObXmlNode *old_node, ObXmlNode *update_node);
static int remove_and_insert_element_node(ObXmlElement *ele_node, ObXmlNode *update_node, int64_t pos, bool is_remove);
// for pi node
static int update_pi_node(ObMulModeMemCtx* xml_mem_ctx, ObXmlNode *xml_node, const ObExpr *expr, ObEvalCtx &ctx);
#endif
private:
DISALLOW_COPY_AND_ASSIGN(ObExprUpdateXml);
};