Fix mysql tests

This commit is contained in:
hezuojiao
2023-01-04 10:38:12 +00:00
committed by ob-robot
parent e8d80ceea0
commit 8ee98a51af
2 changed files with 16 additions and 11 deletions

View File

@ -382,7 +382,13 @@ int ObRawExprDeduceType::calc_result_type(ObNonTerminalRawExpr &expr,
for (int64_t i = 0; i < types.count(); ++i) {
types.at(i).set_calc_meta(types.at(i));
if (lib::is_mysql_mode() && types.at(i).is_double()) {
types.at(i).set_calc_accuracy(types.at(i).get_accuracy());
const ObPrecision p = types.at(i).get_precision();
const ObScale s = types.at(i).get_scale();
// check whether the precision and scale is valid
if ((PRECISION_UNKNOWN_YET == p && s == SCALE_UNKNOWN_YET) ||
(s >= 0 && s <= OB_MAX_DOUBLE_FLOAT_SCALE && p >= s)) {
types.at(i).set_calc_accuracy(types.at(i).get_accuracy());
}
}
}
if (OB_FAIL(ret)) {