[Bug](DECIMAL) Fix bug for arithmatic expr DECIMALV2 / DECIMALV3 (#18723)

This commit is contained in:
Gabriel
2023-04-17 16:43:36 +08:00
committed by GitHub
parent d61f52d277
commit 74d424e6d4
3 changed files with 29 additions and 1 deletions

View File

@ -566,7 +566,7 @@ public class ArithmeticExpr extends Expr {
if (((ScalarType) type).getScalarScale() != ((ScalarType) children.get(1).type).getScalarScale()) {
castChild(type, 1);
}
} else if (op == Operator.DIVIDE && (t2Scale != 0) && t1.isDecimalV3()) {
} else if (op == Operator.DIVIDE && (t2Scale != 0) && t1TargetType.isDecimalV3()) {
int targetScale = t1Scale + t2Scale;
if (precision < targetScale) {
type = castBinaryOp(Type.DOUBLE);