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,7 +10,6 @@
* See the Mulan PubL v2 for more details.
*/
// This file contains implementation for json_depth.
#define USING_LOG_PREFIX SQL_ENG
#include "ob_expr_json_func_helper.h"
#include "ob_expr_json_depth.h"
@ -48,42 +47,6 @@ int ObExprJsonDepth::calc_result_type1(ObExprResType &type,
return ret;
}
// for old sql engine
int ObExprJsonDepth::calc_result1(common::ObObj &result,
const common::ObObj &arg,
common::ObExprCtx &expr_ctx) const
{
INIT_SUCC(ret);
bool is_null_result = false;
ObIJsonBase *json_doc = NULL;
ObIAllocator *allocator = expr_ctx.calc_buf_;
if (OB_ISNULL(allocator)) {
ret = OB_NOT_INIT;
LOG_WARN("allocator not init", K(ret));
} else {
if (arg.is_null() || arg.get_type() == ObNullType) {
is_null_result = true;
} else if (OB_FAIL(ObJsonExprHelper::get_json_doc(&arg, allocator, 0,
json_doc, is_null_result))) {
LOG_WARN("get_json_doc failed", K(ret));
} else {
// do nothing
}
}
// set result
if (OB_FAIL(ret)) {
LOG_WARN("json_depth failed", K(ret));
} else if (is_null_result) {
result.set_null();
} else {
result.set_int32(json_doc->depth());
}
return ret;
}
int ObExprJsonDepth::eval_json_depth(const ObExpr &expr, ObEvalCtx &ctx, ObDatum &res)
{
// get json doc
@ -94,7 +57,8 @@ int ObExprJsonDepth::eval_json_depth(const ObExpr &expr, ObEvalCtx &ctx, ObDatum
ObIJsonBase *json_doc = NULL;
bool is_null_result = false;
common::ObArenaAllocator &temp_allocator = ctx.get_reset_tmp_alloc();
ObEvalCtx::TempAllocGuard tmp_alloc_g(ctx);
common::ObArenaAllocator &temp_allocator = tmp_alloc_g.get_allocator();
if (OB_FAIL(json_arg->eval(ctx, json_datum))) {
LOG_WARN("eval json arg failed", K(ret));
} else if (val_type == ObNullType || json_datum->is_null()) {