sync bugfix:oralce json-agg func coredump bug

This commit is contained in:
obdev
2023-08-21 10:40:29 +00:00
committed by ob-robot
parent 56c6de341c
commit fc317ca70a
2 changed files with 13 additions and 4 deletions

View File

@ -380,12 +380,14 @@ int ObJsonExprHelper::oracle_datum2_json_val(const ObDatum *json_datum,
uint32_t parse_flag = ObJsonParser::JSN_RELAXED_FLAG;
ObString j_str = json_datum->get_string();
bool need_convert = (cs_type != CS_TYPE_INVALID && cs_type != CS_TYPE_BINARY);
if (OB_FAIL(ObTextStringHelper::read_real_string_data(
allocator, val_type, cs_type, data_meta.has_lob_header(), j_str))) {
LOG_WARN("fail to get real data.", K(ret), K(j_str));
} else if (cs_type != CS_TYPE_INVALID && cs_type != CS_TYPE_BINARY
&& OB_FAIL(ObExprUtil::convert_string_collation(j_str, cs_type, j_str, CS_TYPE_UTF8MB4_BIN, *allocator))) {
} else if (need_convert && OB_FAIL(ObExprUtil::convert_string_collation(j_str, cs_type, j_str, CS_TYPE_UTF8MB4_BIN, *allocator))) {
LOG_WARN("fail to convert charset.", K(ret), K(j_str), K(cs_type));
} else if (!need_convert && OB_FAIL(deep_copy_ob_string(*allocator, j_str, j_str))) {
LOG_WARN("fail to deep copy string.", K(ret), K(j_str));
} else if (!is_format_json || is_raw_type) {
if (is_raw_type) {
ObObj tmp_result;
@ -436,6 +438,8 @@ int ObJsonExprHelper::oracle_datum2_json_val(const ObDatum *json_datum,
if (OB_FAIL(ObTextStringHelper::read_real_string_data(
allocator, val_type, cs_type, data_meta.has_lob_header(), j_str))) {
LOG_WARN("fail to get real data.", K(ret), K(j_str));
} else if (OB_FAIL(deep_copy_ob_string(*allocator, j_str, j_str))) {
LOG_WARN("fail to deep copy string.", K(ret), K(j_str));
} else if (OB_FAIL(ObJsonBaseFactory::get_json_base(allocator, j_str, ObJsonInType::JSON_BIN, to_type, j_base))) {
ret = OB_ERR_INVALID_JSON_TEXT_IN_PARAM;
LOG_WARN("fail to get json base", K(ret));