[CP]sync bugfix from 42x. fix:json compare with const string, behavior not consistent with mysql

This commit is contained in:
obdev
2024-02-09 14:49:24 +00:00
committed by ob-robot
parent c22f50d3c4
commit 3897e45a83
8 changed files with 29 additions and 10 deletions

View File

@ -3589,6 +3589,13 @@ int ObRawExprDeduceType::try_add_cast_expr(RawExprType &parent,
ret = OB_ERR_INVALID_TYPE_FOR_OP;
LOG_WARN("cast to lob type not allowed", K(ret));
}
// for consistent with mysql, if const cast as json, should regard as scalar, don't need parse
if (ObStringTC == ori_tc && ObJsonTC == expect_tc
&& IS_BASIC_CMP_OP(parent.get_expr_type())) {
uint64_t extra = new_expr->get_extra();
new_expr->set_extra(CM_SET_SQL_AS_JSON_SCALAR(extra));
}
OZ(parent.replace_param_expr(child_idx, new_expr));
if (OB_FAIL(ret) && my_session_->is_varparams_sql_prepare()) {
ret = OB_SUCCESS;