fix:json-remove, json is true/false, json-length bug

This commit is contained in:
obdev
2024-01-22 12:12:52 +00:00
committed by ob-robot
parent 240e147747
commit 9237df7de1
16 changed files with 149 additions and 18 deletions

View File

@ -13,6 +13,7 @@
#define USING_LOG_PREFIX SQL_ENG
#include <math.h>
#include "sql/engine/expr/ob_expr_is.h"
#include "ob_expr_json_func_helper.h"
#include "share/object/ob_obj_cast.h"
//#include "sql/engine/expr/ob_expr_promotion_util.h"
#include "objit/common/ob_item_type.h"
@ -67,6 +68,9 @@ int ObExprIsBase::calc_result_type2(ObExprResType &type,
if (ob_is_numeric_type(type1.get_type())) {
type1.set_calc_meta(type1.get_obj_meta());
type1.set_calc_accuracy(type1.get_accuracy());
} else if (ob_is_json(type1.get_type())) {
type1.set_calc_meta(type1.get_obj_meta());
type1.set_calc_accuracy(type1.get_accuracy());
} else {
type1.set_calc_type(ObNumberType);
const ObAccuracy &calc_acc = ObAccuracy::DDL_DEFAULT_ACCURACY2[0][ObNumberType];
@ -246,6 +250,10 @@ int ObExprIsBase::cg_result_type_class(ObObjType type, ObExpr::EvalFunc &eval_fu
EVAL_FUNC(decimal_int);
break;
}
case ObJsonType: {
EVAL_FUNC(json);
break;
}
case ObMaxType: {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("is expr got unexpected type param", K(ret), K(type));
@ -542,6 +550,7 @@ NUMERIC_CALC_FUNC(float, ObExprIsNot, true, true, is_not)
NUMERIC_CALC_FUNC(double, ObExprIsNot, true, true, is_not)
NUMERIC_CALC_FUNC(number, ObExprIsNot, true, true, is_not)
NUMERIC_CALC_FUNC(decimal_int, ObExprIsNot, true, true, is_not)
NUMERIC_CALC_FUNC(json, ObExprIsNot, true, true, is_not)
NUMERIC_CALC_FUNC(int, ObExprIsNot, true, false, is_not)
@ -549,18 +558,21 @@ NUMERIC_CALC_FUNC(float, ObExprIsNot, true, false, is_not)
NUMERIC_CALC_FUNC(double, ObExprIsNot, true, false, is_not)
NUMERIC_CALC_FUNC(number, ObExprIsNot, true, false, is_not)
NUMERIC_CALC_FUNC(decimal_int, ObExprIsNot, true, false, is_not)
NUMERIC_CALC_FUNC(json, ObExprIsNot, true, false, is_not)
NUMERIC_CALC_FUNC(int, ObExprIs, false, true, is)
NUMERIC_CALC_FUNC(float, ObExprIs, false, true, is)
NUMERIC_CALC_FUNC(double, ObExprIs, false, true, is)
NUMERIC_CALC_FUNC(number, ObExprIs, false, true, is)
NUMERIC_CALC_FUNC(decimal_int, ObExprIs, false, true, is)
NUMERIC_CALC_FUNC(json, ObExprIs, false, true, is)
NUMERIC_CALC_FUNC(int, ObExprIs, false, false, is)
NUMERIC_CALC_FUNC(float, ObExprIs, false, false, is)
NUMERIC_CALC_FUNC(double, ObExprIs, false, false, is)
NUMERIC_CALC_FUNC(number, ObExprIs, false, false, is)
NUMERIC_CALC_FUNC(decimal_int, ObExprIs, false, false, is)
NUMERIC_CALC_FUNC(json, ObExprIs, false, false, is)
}
}