fix:46520694,47245275,47250762,47050323,47539331
This commit is contained in:
@ -1628,7 +1628,7 @@ int ObJsonExprHelper::check_item_func_with_return(ObJsonPathNodeType path_type,
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObJsonExprHelper::get_ascii_type(const ObExprResType param_type2, int64_t &dst_type)
|
||||
int ObJsonExprHelper::get_expr_option_value(const ObExprResType param_type2, int64_t &dst_type)
|
||||
{
|
||||
INIT_SUCC(ret);
|
||||
if (!param_type2.is_int() && !param_type2.get_param().is_int()) {
|
||||
@ -1703,6 +1703,70 @@ int ObJsonExprHelper::calc_asciistr_in_expr(const ObString &src,
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObJsonExprHelper::parse_asc_option(ObExprResType& asc_type,
|
||||
ObExprResType& type1,
|
||||
ObExprResType& res_type,
|
||||
ObExprTypeCtx& type_ctx)
|
||||
{
|
||||
INIT_SUCC(ret);
|
||||
ObExprResType temp_type;
|
||||
ObObjType doc_type = type1.get_type();
|
||||
int64_t asc_option = 0;
|
||||
|
||||
if (asc_type.get_type() != ObIntType) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("<ASCII type> param type is unexpected", K(asc_type.get_type()));
|
||||
} else if (OB_FAIL(ObJsonExprHelper::get_expr_option_value(asc_type, asc_option))) {
|
||||
LOG_WARN("get ascii type fail", K(ret));
|
||||
} else if (asc_option == 1
|
||||
&& ob_is_string_type(doc_type)
|
||||
&& ((res_type.is_character_type() && (res_type.get_length_semantics() == LS_CHAR || res_type.get_length_semantics() == LS_BYTE))
|
||||
|| res_type.is_lob())) {
|
||||
type1.set_calc_length_semantics(res_type.get_length_semantics());
|
||||
ObLength length = 0;
|
||||
ObExprResType temp_type;
|
||||
temp_type.set_meta(type1.get_calc_meta());
|
||||
temp_type.set_length_semantics(res_type.get_length_semantics());
|
||||
if (OB_FAIL(ObExprResultTypeUtil::deduce_max_string_length_oracle(type_ctx.get_session()->get_dtc_params(),
|
||||
type1,
|
||||
temp_type,
|
||||
length))) {
|
||||
LOG_WARN("fail to deduce max string length.", K(ret), K(temp_type), K(type1));
|
||||
} else {
|
||||
type1.set_calc_length(length);
|
||||
res_type.set_length(length * 10);
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObJsonExprHelper::character2_ascii_string(common::ObIAllocator *allocator,
|
||||
const ObExpr &expr,
|
||||
ObEvalCtx &ctx,
|
||||
ObString& result,
|
||||
int32_t reserve_len)
|
||||
{
|
||||
INIT_SUCC(ret);
|
||||
char *buf = NULL;
|
||||
int64_t buf_len = result.length() * ObCharset::MAX_MB_LEN * 2;
|
||||
int32_t length = 0;
|
||||
|
||||
if ((OB_NOT_NULL(allocator) && OB_ISNULL(buf = static_cast<char*>(allocator->alloc(buf_len + reserve_len))))
|
||||
|| (OB_ISNULL(buf = static_cast<char*>(expr.get_str_res_mem(ctx, buf_len + reserve_len))))) {
|
||||
ret = OB_ALLOCATE_MEMORY_FAILED;
|
||||
LOG_WARN("fail to allocate memory", K(ret), K(buf_len), K(result.length()));
|
||||
} else if (OB_FAIL(ObJsonExprHelper::calc_asciistr_in_expr(result,
|
||||
expr.datum_meta_.cs_type_,
|
||||
expr.datum_meta_.cs_type_,
|
||||
buf, buf_len, length))) {
|
||||
LOG_WARN("fail to calc unistr", K(ret));
|
||||
} else {
|
||||
result.assign_ptr(buf, length);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObJsonExprHelper::pre_default_value_check(ObObjType dst_type, ObString time_str, ObObjType val_type) {
|
||||
INIT_SUCC(ret);
|
||||
size_t len;
|
||||
|
||||
Reference in New Issue
Block a user