fix:oracle json function error

This commit is contained in:
obdev 2023-07-13 12:48:20 +00:00 committed by ob-robot
parent 437b2245b2
commit c0135ba735
4 changed files with 14 additions and 12 deletions

View File

@ -788,7 +788,7 @@ int ObJsonPath::change_json_expr_res_type_if_need(common::ObIAllocator &allocato
ret_node.int16_values_[OB_NODE_CAST_TYPE_IDX] = T_VARCHAR;
ret_node.int16_values_[OB_NODE_CAST_COLL_IDX] = 0;
ret_node.int32_values_[OB_NODE_CAST_C_LEN_IDX] = 20;
ret_node.length_semantics_ = 1;
ret_node.length_semantics_ = 0;
ret_node.is_hidden_const_ = 1;
break;
}
@ -826,7 +826,7 @@ int ObJsonPath::change_json_expr_res_type_if_need(common::ObIAllocator &allocato
ret_node.int16_values_[OB_NODE_CAST_TYPE_IDX] = T_VARCHAR;
ret_node.int16_values_[OB_NODE_CAST_COLL_IDX] = 0;
ret_node.int32_values_[OB_NODE_CAST_C_LEN_IDX] = 4000;
ret_node.length_semantics_ = 1;
ret_node.length_semantics_ = 0;
ret_node.is_hidden_const_ = 1;
} else {
ret_node.int16_values_[OB_NODE_CAST_TYPE_IDX] = T_NUMBER;
@ -857,7 +857,7 @@ int ObJsonPath::change_json_expr_res_type_if_need(common::ObIAllocator &allocato
ret_node.int16_values_[OB_NODE_CAST_TYPE_IDX] = T_VARCHAR;
ret_node.int16_values_[OB_NODE_CAST_COLL_IDX] = 0;
ret_node.int32_values_[OB_NODE_CAST_C_LEN_IDX] = 4000;
ret_node.length_semantics_ = 1;
ret_node.length_semantics_ = 0;
ret_node.is_hidden_const_ = 1;
}
case JPN_UPPER:
@ -867,7 +867,7 @@ int ObJsonPath::change_json_expr_res_type_if_need(common::ObIAllocator &allocato
ret_node.int16_values_[OB_NODE_CAST_TYPE_IDX] = T_VARCHAR;
ret_node.int16_values_[OB_NODE_CAST_COLL_IDX] = 0;
ret_node.int32_values_[OB_NODE_CAST_C_LEN_IDX] = 75;
ret_node.length_semantics_ = 1;
ret_node.length_semantics_ = 0;
ret_node.is_hidden_const_ = 1;
break;
break;

View File

@ -104,8 +104,6 @@ int ObExprJsonArray::calc_result_typeN(ObExprResType& type,
LOG_WARN("get cast dest type failed", K(ret));
} else if (OB_FAIL(ObJsonExprHelper::set_dest_type(types_stack[0], type, dst_type, type_ctx))) {
LOG_WARN("set dest type failed", K(ret));
} else {
type.set_calc_collation_type(type.get_collation_type());
}
}

View File

@ -534,7 +534,8 @@ int ObJsonExprHelper::transform_scalar_2jsonBase(const T &datum,
case ObUSmallIntType:
case ObUMediumIntType:
case ObUInt32Type:
case ObUInt64Type: {
case ObUInt64Type:
case ObYearType: {
buf = allocator->alloc(sizeof(ObJsonUint));
if (OB_ISNULL(buf)) {
ret = OB_ALLOCATE_MEMORY_FAILED;
@ -1727,10 +1728,13 @@ int ObJsonExprHelper::parse_asc_option(ObExprResType& asc_type,
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))) {
if (doc_type == ObNCharType) {
length = type1.get_param().get_string_len() * ObCharset::MAX_MB_LEN * 2;
type1.set_calc_length(length);
res_type.set_length(length);
} else if (!temp_type.is_blob() && 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);

View File

@ -757,7 +757,7 @@ int ObDMLResolver::transform_dot_notation2_json_value(ParseNode &node, const ObS
ret_node->int32_values_[0] = 22;
ret_node->int32_values_[OB_NODE_CAST_C_LEN_IDX] = 4000;
ret_node->is_tree_not_param_ = 1;
ret_node->length_semantics_ = 1;
ret_node->length_semantics_ = 0;
ret_node->raw_text_ = "default";
ret_node->text_len_ = 7;
param_vec[2] = ret_node; // return type pos is 2 in json value clause