[Json] json patch from 3.2.2 branch since 2021.12
This commit is contained in:
@ -14,7 +14,7 @@
|
||||
#include "sql/engine/expr/ob_expr_or.h"
|
||||
#include "lib/oblog/ob_log.h"
|
||||
#include "share/object/ob_obj_cast.h"
|
||||
//#include "sql/engine/expr/ob_expr_promotion_util.h"
|
||||
#include "sql/engine/expr/ob_expr_json_func_helper.h"
|
||||
#include "sql/session/ob_sql_session_info.h"
|
||||
|
||||
namespace oceanbase {
|
||||
@ -49,7 +49,17 @@ int ObExprOr::calc_result2(
|
||||
|
||||
bool obj1_is_true = false;
|
||||
EXPR_SET_CAST_CTX_MODE(expr_ctx);
|
||||
if (OB_FAIL(ObLogicalExprOperator::is_true(obj1, expr_ctx.cast_mode_ | CM_NO_RANGE_CHECK, obj1_is_true))) {
|
||||
if (ob_is_json(obj1.get_type())) {
|
||||
// cause for json type, in some case can't transform to number type
|
||||
// add special process for json type
|
||||
// use the some logical as mysql
|
||||
int cmp_result = 0;
|
||||
if (OB_FAIL(ObJsonExprHelper::is_json_zero(obj1.get_string(), cmp_result))) {
|
||||
LOG_WARN("failed: compare json", K(ret));
|
||||
} else {
|
||||
result.set_int32(cmp_result);
|
||||
}
|
||||
} else if (OB_FAIL(ObLogicalExprOperator::is_true(obj1, expr_ctx.cast_mode_ | CM_NO_RANGE_CHECK, obj1_is_true))) {
|
||||
LOG_WARN("fail to evaluate obj1", K(obj1), K(ret));
|
||||
} else if (obj1_is_true) {
|
||||
result.set_int32(static_cast<int32_t>(true));
|
||||
@ -119,7 +129,6 @@ int ObExprOr::cacl_res_with_one_param_null(
|
||||
// By design, compatible with mysql and oracle:
|
||||
// null or false == NULL. null or true == true.
|
||||
// see "NULL and the three-valued logic"
|
||||
// https://en.wikipedia.org/wiki/Null_(SQL)#Comparisons_with_NULL_and_the_three-valued_logic_(3VL)
|
||||
} else if (value) {
|
||||
res.set_int32(static_cast<int32_t>(true));
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user