[Bug](DECIMALV3) report failure if a decimal value is overflow (#18336)
This commit is contained in:
@ -1092,15 +1092,17 @@ public class ScalarType extends Type {
|
||||
}
|
||||
|
||||
public static ScalarType getAssignmentCompatibleDecimalV2Type(ScalarType t1, ScalarType t2) {
|
||||
int targetPrecision = Math.max(t1.decimalPrecision(), t2.decimalPrecision());
|
||||
int targetScale = Math.max(t1.decimalScale(), t2.decimalScale());
|
||||
int targetPrecision = Math.max(t1.decimalPrecision() - t1.decimalScale(), t2.decimalPrecision()
|
||||
- t2.decimalScale()) + targetScale;
|
||||
return ScalarType.createDecimalType(PrimitiveType.DECIMALV2,
|
||||
targetPrecision, targetScale);
|
||||
}
|
||||
|
||||
public static ScalarType getAssignmentCompatibleDecimalV3Type(ScalarType t1, ScalarType t2) {
|
||||
int targetPrecision = Math.max(t1.decimalPrecision(), t2.decimalPrecision());
|
||||
int targetScale = Math.max(t1.decimalScale(), t2.decimalScale());
|
||||
int targetPrecision = Math.max(t1.decimalPrecision() - t1.decimalScale(), t2.decimalPrecision()
|
||||
- t2.decimalScale()) + targetScale;
|
||||
return ScalarType.createDecimalV3Type(targetPrecision, targetScale);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user