fix: 1.roll back add quote 2.add new type support for json table value column 3 error clause process bug

This commit is contained in:
obdev
2023-02-17 03:11:54 +00:00
committed by ob-robot
parent d9a7c9d842
commit 7770bb3358
11 changed files with 61 additions and 64 deletions

View File

@ -1821,7 +1821,7 @@ static int common_json_string(const ObExpr &expr,
// get json string
if (OB_FAIL(j_bin.reset_iter())) {
LOG_WARN("failed to reset json bin iter", K(ret), K(j_bin_str));
} else if (CAST_FAIL(j_base->print(j_buf, true, false, 0, true))) {
} else if (CAST_FAIL(j_base->print(j_buf, true))) {
LOG_WARN("fail to convert json to string", K(ret), K(j_bin_str));
ret = OB_ERR_INVALID_JSON_VALUE_FOR_CAST;
LOG_USER_ERROR(OB_ERR_INVALID_JSON_VALUE_FOR_CAST);
@ -7029,7 +7029,7 @@ CAST_FUNC_NAME(json, raw)
if (OB_FAIL(j_bin.reset_iter())) {
LOG_WARN("failed to reset json bin iter", K(ret), K(j_bin_str));
} else if (CAST_FAIL(j_base->print(j_buf, true, false, 0, true))) {
} else if (CAST_FAIL(j_base->print(j_buf, true))) {
LOG_WARN("fail to convert json to string", K(ret), K(j_bin_str));
ret = OB_ERR_INVALID_JSON_VALUE_FOR_CAST;
LOG_USER_ERROR(OB_ERR_INVALID_JSON_VALUE_FOR_CAST);
@ -7078,7 +7078,7 @@ CAST_FUNC_NAME(json, string)
if (OB_FAIL(j_bin.reset_iter())) {
LOG_WARN("failed to reset json bin iter", K(ret), K(j_bin_str));
} else if (CAST_FAIL(j_base->print(j_buf, true, false, 0, true))) {
} else if (CAST_FAIL(j_base->print(j_buf, true))) {
LOG_WARN("fail to convert json to string", K(ret), K(j_bin_str));
ret = OB_ERR_INVALID_JSON_VALUE_FOR_CAST;
LOG_USER_ERROR(OB_ERR_INVALID_JSON_VALUE_FOR_CAST);

View File

@ -186,7 +186,7 @@ int ObJsonExprHelper::cast_to_json_tree(ObString &text, common::ObIAllocator *al
LOG_WARN("get json tree fail", K(ret));
} else {
ObJsonBuffer jbuf(allocator);
if (OB_FAIL(j_tree->print(jbuf, true, false, 0, true))) {
if (OB_FAIL(j_tree->print(jbuf, true, false, 0))) {
LOG_WARN("json binary to string failed", K(ret));
} else if (jbuf.empty()) {
ret = OB_ALLOCATE_MEMORY_FAILED;
@ -1162,7 +1162,7 @@ int ObJsonExprHelper::transform_convertible_2String(const ObExpr &expr,
}
} else {
ObJsonString ob_str(value.ptr(), value.length());
if (OB_FAIL(ob_str.print(j_buf, true, false, 0, true))) {
if (OB_FAIL(ob_str.print(j_buf, true, false, 0))) {
LOG_WARN("fail to print json node", K(ret));
}
}
@ -1178,7 +1178,7 @@ int ObJsonExprHelper::transform_convertible_2String(const ObExpr &expr,
ObJsonInType::JSON_BIN, json_node))) {
ret = OB_ERR_INVALID_JSON_TEXT_IN_PARAM;
LOG_WARN("fail to get json base", K(ret));
} else if (OB_FAIL(json_node->print(j_buf, true, false, 0, true))) {
} else if (OB_FAIL(json_node->print(j_buf, true, false, 0))) {
LOG_WARN("fail to print json node", K(ret));
}
break;

View File

@ -374,7 +374,7 @@ int ObExprJsonObject::eval_ora_json_object(const ObExpr &expr, ObEvalCtx &ctx, O
if (OB_SUCC(ret)) {
if (unique_type == OB_JSON_ON_UNIQUE_USE && OB_FAIL(check_key_valid(view_key_names, key))) {
LOG_WARN("duplicate key fail");
} else if (OB_FAIL(ob_str.print(res_str, true, false, 0, true))) {
} else if (OB_FAIL(ob_str.print(res_str, true))) {
LOG_WARN("fail to print json node", K(ret));
} else if (OB_FAIL(res_str.append(":"))) {
LOG_WARN("colon write fail");
@ -391,7 +391,7 @@ int ObExprJsonObject::eval_ora_json_object(const ObExpr &expr, ObEvalCtx &ctx, O
if (OB_SUCC(ret)) {
if (unique_type == OB_JSON_ON_UNIQUE_USE && OB_FAIL(check_key_valid(view_key_names, key))) {
LOG_WARN("duplicate key fail");
} else if (OB_FAIL(ob_str.print(res_str, true, false, 0, true))) {
} else if (OB_FAIL(ob_str.print(res_str, true))) {
LOG_WARN("fail to print json node", K(ret));
} else if (OB_FAIL(res_str.append(":"))) {
LOG_WARN("colon write fail");

View File

@ -81,7 +81,7 @@ int ObExprJsonPretty::calc(ObEvalCtx &ctx, const ObDatum &data, ObDatumMeta meta
ret = OB_ERR_INVALID_JSON_TEXT_IN_PARAM;
}
LOG_WARN("fail to get json base", K(ret), K(type), K(j_str), K(j_in_type));
} else if (OB_FAIL(j_base->print(j_buf, true, true, 0, true))) {
} else if (OB_FAIL(j_base->print(j_buf, true, true, 0))) {
LOG_WARN("fail to print json", K(ret), K(type), K(j_str), K(j_in_type));
}

View File

@ -461,7 +461,7 @@ int ObExprJsonQuery::set_result(ObObjType dst_type,
if (dst_type == ObVarcharType || dst_type == ObLongTextType) {
ObJsonBuffer jbuf(allocator);
ObString res_string;
if (OB_FAIL(jb_res->print(jbuf, true, pretty_type > 0, 0, true))) {
if (OB_FAIL(jb_res->print(jbuf, true, pretty_type > 0))) {
LOG_WARN("json binary to string failed", K(ret));
} else if (jbuf.empty()) {
ret = OB_ALLOCATE_MEMORY_FAILED;