[CP] fix core caused by missed core and cast interval to year failed error
This commit is contained in:
@ -504,10 +504,13 @@ int ObExprCast::get_cast_type(const ObExprResType param_type2,
|
|||||||
dst_type.set_collation_type(CS_TYPE_UTF8MB4_BIN);
|
dst_type.set_collation_type(CS_TYPE_UTF8MB4_BIN);
|
||||||
} else if (ob_is_interval_tc(obj_type)) {
|
} else if (ob_is_interval_tc(obj_type)) {
|
||||||
if (CM_IS_EXPLICIT_CAST(cast_mode) &&
|
if (CM_IS_EXPLICIT_CAST(cast_mode) &&
|
||||||
(!ObIntervalScaleUtil::scale_check(parse_node.int16_values_[OB_NODE_CAST_N_PREC_IDX]) ||
|
((ObIntervalYMType != obj_type && !ObIntervalScaleUtil::scale_check(parse_node.int16_values_[OB_NODE_CAST_N_PREC_IDX])) ||
|
||||||
!ObIntervalScaleUtil::scale_check(parse_node.int16_values_[OB_NODE_CAST_N_SCALE_IDX]))) {
|
!ObIntervalScaleUtil::scale_check(parse_node.int16_values_[OB_NODE_CAST_N_SCALE_IDX]))) {
|
||||||
ret = OB_ERR_DATETIME_INTERVAL_PRECISION_OUT_OF_RANGE;
|
ret = OB_ERR_DATETIME_INTERVAL_PRECISION_OUT_OF_RANGE;
|
||||||
LOG_WARN("target interval type precision out of range", K(ret), K(obj_type));
|
LOG_WARN("target interval type precision out of range", K(ret), K(obj_type));
|
||||||
|
} else if (ObIntervalYMType == obj_type) {
|
||||||
|
// interval year to month type has no precision
|
||||||
|
dst_type.set_scale(parse_node.int16_values_[OB_NODE_CAST_N_SCALE_IDX]);
|
||||||
} else if (ob_is_interval_ds(obj_type)) {
|
} else if (ob_is_interval_ds(obj_type)) {
|
||||||
//scale in day seconds type is day_scale * 10 + seconds_scale.
|
//scale in day seconds type is day_scale * 10 + seconds_scale.
|
||||||
dst_type.set_scale(parse_node.int16_values_[OB_NODE_CAST_N_PREC_IDX] * 10 +
|
dst_type.set_scale(parse_node.int16_values_[OB_NODE_CAST_N_PREC_IDX] * 10 +
|
||||||
|
|||||||
@ -6574,6 +6574,7 @@ int ObRawExprUtils::create_real_cast_expr(ObRawExprFactory &expr_factory,
|
|||||||
int ret = OB_SUCCESS;
|
int ret = OB_SUCCESS;
|
||||||
ObConstRawExpr *dst_expr = NULL;
|
ObConstRawExpr *dst_expr = NULL;
|
||||||
ParseNode parse_node;
|
ParseNode parse_node;
|
||||||
|
memset(&parse_node, 0, sizeof(ParseNode));
|
||||||
ObObj val;
|
ObObj val;
|
||||||
|
|
||||||
if (OB_ISNULL(src_expr) || OB_ISNULL(session_info)) {
|
if (OB_ISNULL(src_expr) || OB_ISNULL(session_info)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user