patch 4.0

This commit is contained in:
wangzelin.wzl
2022-10-24 10:34:53 +08:00
parent 4ad6e00ec3
commit 93a1074b0c
10533 changed files with 2588271 additions and 2299373 deletions

View File

@ -10,13 +10,12 @@
* See the Mulan PubL v2 for more details.
*/
// This file contains implementation for json_valid.
#define USING_LOG_PREFIX SQL_ENG
#include "ob_expr_json_valid.h"
#include "sql/engine/expr/ob_expr_json_func_helper.h"
#include "sql/engine/expr/ob_expr_util.h"
#include "share/object/ob_obj_cast.h"
#include "sql/parser/ob_item_type.h"
#include "objit/common/ob_item_type.h"
#include "sql/session/ob_sql_session_info.h"
#include "lib/json_type/ob_json_tree.h"
@ -119,24 +118,6 @@ int ObExprJsonValid::calc(const T &data, ObObjType type, ObCollationType cs_type
return ret;
}
// for old sql engine
int ObExprJsonValid::calc_result1(common::ObObj &result, const common::ObObj &obj,
common::ObExprCtx &expr_ctx) const
{
INIT_SUCC(ret);
ObCollationType cs_type = obj.get_collation_type();
ObObjType in_type = input_types_.at(0).get_calc_type();
if (OB_ISNULL(expr_ctx.calc_buf_)) {
ret = OB_NOT_INIT;
LOG_WARN("varchar buffer not init", K(ret));
} else if (OB_FAIL(calc(obj, in_type, cs_type, expr_ctx.calc_buf_, result))) {
LOG_WARN("fail to calc json valid result", K(ret), K(in_type));
}
return ret;
}
// for new sql engine
int ObExprJsonValid::eval_json_valid(const ObExpr &expr, ObEvalCtx &ctx, ObDatum &res)
{
@ -148,7 +129,8 @@ int ObExprJsonValid::eval_json_valid(const ObExpr &expr, ObEvalCtx &ctx, ObDatum
if (OB_FAIL(arg->eval(ctx, datum))) {
LOG_WARN("eval json arg failed", K(ret));
} else {
common::ObIAllocator &tmp_allocator = ctx.get_reset_tmp_alloc();
ObEvalCtx::TempAllocGuard tmp_alloc_g(ctx);
common::ObIAllocator &tmp_allocator = tmp_alloc_g.get_allocator();
if (OB_FAIL(calc(*datum, arg->datum_meta_.type_, cs_type, &tmp_allocator, res))) {
LOG_WARN("fail to calc json valid result", K(ret), K(arg->datum_meta_.type_));
}