Fix ps prepare stage type deduction failure
This commit is contained in:
@ -226,6 +226,11 @@ int ObRawExprDeduceType::calc_result_type_with_const_arg(
|
||||
break;
|
||||
} // end switch
|
||||
}
|
||||
if (OB_FAIL(ret) && my_session_->is_ps_prepare_stage()) {
|
||||
// the ps prepare stage does not do type deduction, and directly gives a default type.
|
||||
result_type.set_null();
|
||||
ret = OB_SUCCESS;
|
||||
}
|
||||
}
|
||||
#undef GET_TYPE_ARRAY
|
||||
return ret;
|
||||
@ -396,6 +401,11 @@ int ObRawExprDeduceType::calc_result_type(ObNonTerminalRawExpr &expr,
|
||||
LOG_WARN("fail to calc result type with const arguments", K(ret));
|
||||
}
|
||||
}
|
||||
if (OB_FAIL(ret) && my_session_->is_ps_prepare_stage()) {
|
||||
// the ps prepare stage does not do type deduction, and directly gives a default type.
|
||||
result_type.set_null();
|
||||
ret = OB_SUCCESS;
|
||||
}
|
||||
// check parameters can cast to expected type
|
||||
if (OB_SUCC(ret)) {
|
||||
const bool is_oracle_mode = lib::is_oracle_mode();
|
||||
@ -412,7 +422,8 @@ int ObRawExprDeduceType::calc_result_type(ObNonTerminalRawExpr &expr,
|
||||
LOG_WARN("PLS-00306: wrong number or types of arguments in call", K(ret));
|
||||
}
|
||||
if (OB_FAIL(ret)) {
|
||||
} else if (from != to && !cast_supported(from, from_cs_type, to, to_cs_type)) {
|
||||
} else if (from != to && !cast_supported(from, from_cs_type, to, to_cs_type)
|
||||
&& !my_session_->is_ps_prepare_stage()) {
|
||||
ret = OB_ERR_INVALID_TYPE_FOR_OP;
|
||||
LOG_WARN("cast parameter to expected type not supported", K(ret), K(i), K(from), K(to));
|
||||
} else if (is_oracle_mode && (ob_is_lob_locator(from) || ob_is_text_tc(from))) {
|
||||
@ -1188,7 +1199,8 @@ int ObRawExprDeduceType::visit(ObAggFunRawExpr &expr)
|
||||
? from_type
|
||||
: ObNumberType);
|
||||
if (from_type != to_type && !cast_supported(from_type, from_cs_type,
|
||||
to_type, CS_TYPE_BINARY)) {
|
||||
to_type, CS_TYPE_BINARY)
|
||||
&& !my_session_->is_ps_prepare_stage()) {
|
||||
ret = OB_ERR_INVALID_TYPE_FOR_OP;
|
||||
LOG_WARN("cast to expected type not supported", K(ret), K(from_type), K(to_type));
|
||||
} else {
|
||||
@ -1312,7 +1324,8 @@ int ObRawExprDeduceType::visit(ObAggFunRawExpr &expr)
|
||||
: (T_FUN_GROUP_PERCENTILE_DISC == expr.get_expr_type()
|
||||
? from_cs_type : CS_TYPE_BINARY);
|
||||
if (from_type != to_type && !cast_supported(from_type, from_cs_type,
|
||||
to_type, to_cs_type)) {
|
||||
to_type, to_cs_type)
|
||||
&& !my_session_->is_ps_prepare_stage()) {
|
||||
ret = OB_ERR_INVALID_TYPE_FOR_OP;
|
||||
LOG_WARN("cast to expected type not supported", K(ret), K(from_type), K(to_type));
|
||||
} else {
|
||||
@ -1385,11 +1398,13 @@ int ObRawExprDeduceType::visit(ObAggFunRawExpr &expr)
|
||||
}
|
||||
}
|
||||
if (from_type1 != to_type && !cast_supported(from_type1, from_cs_type1,
|
||||
to_type, to_cs_type)) {
|
||||
to_type, to_cs_type)
|
||||
&& !my_session_->is_ps_prepare_stage()) {
|
||||
ret = OB_ERR_INVALID_TYPE_FOR_OP;
|
||||
LOG_WARN("cast to expected type not supported", K(ret), K(from_type1), K(to_type));
|
||||
} else if (from_type2 != to_type && !cast_supported(from_type2, from_cs_type2,
|
||||
to_type, to_cs_type)) {
|
||||
to_type, to_cs_type)
|
||||
&& !my_session_->is_ps_prepare_stage()) {
|
||||
ret = OB_ERR_INVALID_TYPE_FOR_OP;
|
||||
LOG_WARN("cast to expected type not supported", K(ret), K(from_type2), K(to_type));
|
||||
} else {
|
||||
@ -2895,6 +2910,10 @@ int ObRawExprDeduceType::try_add_cast_expr(RawExprType &parent,
|
||||
LOG_WARN("cast to lob type not allowed", K(ret));
|
||||
}
|
||||
OZ(parent.replace_param_expr(child_idx, new_expr));
|
||||
if (OB_FAIL(ret) && my_session_->is_ps_prepare_stage()) {
|
||||
ret = OB_SUCCESS;
|
||||
LOG_DEBUG("ps prepare phase ignores type deduce error");
|
||||
}
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
|
||||
Reference in New Issue
Block a user