提交 b96d7663 编写于 作者: O obdev 提交者: wangzelin.wzl

[CP] JSON bug fix

上级 1b88c270
......@@ -3340,7 +3340,7 @@ int ObAggregateProcessor::get_json_arrayagg_result(const ObAggrInfo &aggr_info,
ObString origin_str = converted_datum.get_string();
ObString converted_str;
if (OB_FAIL(ObExprUtil::convert_string_collation(origin_str, cs_type, converted_str,
CS_TYPE_UTF8MB4_BIN, tmp_alloc))) {
CS_TYPE_UTF8MB4_BIN, tmp_alloc))) {
LOG_WARN("convert string collation failed", K(ret), K(cs_type), K(origin_str.length()));
} else {
converted_datum.set_string(converted_str);
......@@ -3445,6 +3445,9 @@ int ObAggregateProcessor::get_json_objectagg_result(const ObAggrInfo &aggr_info,
K(tmp_obj[0].get_type()), K(tmp_obj[0].get_collation_type()));
ret = OB_ERR_INVALID_JSON_CHARSET;
LOG_USER_ERROR(OB_ERR_INVALID_JSON_CHARSET);
} else if (NULL == tmp_obj[0].get_string_ptr()) {
ret = OB_ERR_NULL_VALUE;
LOG_WARN("unexpected null result", K(ret), K(tmp_obj[0]));
} else {
ObObjType val_type0 = tmp_obj[0].get_type();
ObCollationType cs_type0 = tmp_obj[0].get_collation_type();
......
......@@ -2215,7 +2215,8 @@ static int common_string_json(const ObExpr &expr,
if (is_need_charset_convert == false) {
j_text.assign_ptr(in_str.ptr(), in_str.length());
}
bool is_enumset_to_str = (expr.args_[0]->type_ == T_FUN_SET_TO_STR);
bool is_enumset_to_str = ((expr.args_[0]->type_ == T_FUN_SET_TO_STR)
|| (expr.args_[0]->type_ == T_FUN_ENUM_TO_STR));
ObIJsonBase *j_base = NULL;
ObJsonOpaque j_opaque(j_text, in_type);
ObJsonString j_string(j_text.ptr(), j_text.length());
......
......@@ -574,7 +574,8 @@ int ObExprCast::calc_result2(ObObj& result, const ObObj& obj1, const ObObj& obj2
if (OB_SUCC(ret)) {
if (is_bool) {
ret = ObObjCaster::bool_to_json(dest_type, cast_ctx, obj1_round, buf_obj1, res_obj);
} else if (OB_UNLIKELY(item_type_obj1 == T_FUN_SET_TO_STR)) {
} else if (OB_UNLIKELY(item_type_obj1 == T_FUN_SET_TO_STR)
|| OB_UNLIKELY(item_type_obj1 == T_FUN_ENUM_TO_STR)) {
ret = ObObjCaster::enumset_to_json(dest_type, cast_ctx, obj1_round, buf_obj1, res_obj);
} else {
ret = ObObjCaster::to_type(dest_type, cast_ctx, obj1_round, buf_obj1, res_obj);
......
......@@ -1707,7 +1707,7 @@ static ObObjType MERGE_RESULT_TYPE[ObMaxType][ObMaxType] = {
ObNCharType, /*ObEnumType=>ObNCharType */
ObMaxType, /*ObEnumType=>URowID*/
ObMaxType, /*ObEnumType=>ObLobType*/
ObMaxType, /*ObEnumType=>ObJsonType*/
ObVarcharType, /*ObEnumType=>ObJsonType*/
},
/*ObSetType*/
{
......@@ -1758,7 +1758,7 @@ static ObObjType MERGE_RESULT_TYPE[ObMaxType][ObMaxType] = {
ObNCharType, /*ObSetType=>ObNCharType */
ObMaxType, /*ObSetType=>URowID*/
ObMaxType, /*ObSetType=>ObLobType*/
ObMaxType, /*ObSetType=>ObJsonType*/
ObVarcharType, /*ObSetType=>ObJsonType*/
},
/*ObEnumInnerType*/
{
......@@ -2458,8 +2458,8 @@ static ObObjType MERGE_RESULT_TYPE[ObMaxType][ObMaxType] = {
ObJsonType, /* ObJsonType=>ObMediumTextType */
ObJsonType, /* ObJsonType=>ObLongTextType */
ObJsonType, /* ObJsonType=>ObBitType */
ObMaxType, /* ObJsonType=>ObEnumType */
ObMaxType, /* ObJsonType=>ObSetType */
ObVarcharType, /* ObJsonType=>ObEnumType */
ObVarcharType, /* ObJsonType=>ObSetType */
ObMaxType, /* ObJsonType=>ObEnumInnerType */
ObMaxType, /* ObJsonType=>ObSetInnerType */
ObMaxType, /* ObJsonType=>ObTimestampTZType */
......
......@@ -1728,7 +1728,7 @@ static ObObjType RELATIONAL_CMP_TYPE[ObMaxType][ObMaxType] =
ObNumberType, /* ObNCharType */
ObNullType, /* ObURowIDType */
ObNullType, /* ObLobType */
ObMaxType, /* ObJsonType */
ObNumberType, /* ObJsonType */
},
/*SetType*/
{
......@@ -2479,7 +2479,7 @@ static ObObjType RELATIONAL_CMP_TYPE[ObMaxType][ObMaxType] =
ObJsonType, /*MediumTextType*/
ObJsonType, /*LongTextType*/
ObJsonType, /*BitType*/
ObMaxType, /* EnumType */
ObNumberType, /* EnumType */
ObNumberType, /* SetType */
ObMaxType, /* EnumInnerType */
ObMaxType, /* SetInnerType */
......
......@@ -679,8 +679,10 @@ int ObRawExprWrapEnumSet::visit(ObAggFunRawExpr& expr)
int ret = OB_SUCCESS;
if (expr.has_enum_set_column() && (T_FUN_GROUP_CONCAT == expr.get_expr_type() ||
T_FUN_MAX == expr.get_expr_type() ||
T_FUN_MIN == expr.get_expr_type())) {
const ObIArray<ObRawExpr*>& real_parm_exprs = expr.get_real_param_exprs();
T_FUN_MIN == expr.get_expr_type() ||
T_FUN_JSON_OBJECTAGG == expr.get_expr_type() ||
T_FUN_JSON_ARRAYAGG == expr.get_expr_type())) {
const ObIArray<ObRawExpr*> &real_parm_exprs = expr.get_real_param_exprs();
const bool is_same_need = false;
for (int64_t i = 0; OB_SUCC(ret) && i < real_parm_exprs.count(); ++i) {
ObRawExpr* real_param_expr = real_parm_exprs.at(i);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册