This is an automated email from the ASF dual-hosted git repository. morrysnow pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push: new 6a03a612a0 [opt](Nereids) add check msg for creating decimal type (#22172) 6a03a612a0 is described below commit 6a03a612a0a5dded93c91b76747095d395c5149f Author: morrySnow <101034200+morrys...@users.noreply.github.com> AuthorDate: Tue Jul 25 11:19:41 2023 +0800 [opt](Nereids) add check msg for creating decimal type (#22172) --- .../java/org/apache/doris/nereids/types/DecimalV2Type.java | 12 +++++++++--- .../java/org/apache/doris/nereids/types/DecimalV3Type.java | 8 +++++--- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/types/DecimalV2Type.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/types/DecimalV2Type.java index d599fbe0c3..a48ea084c1 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/types/DecimalV2Type.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/types/DecimalV2Type.java @@ -68,10 +68,16 @@ public class DecimalV2Type extends FractionalType { private final int precision; private final int scale; + /** + * constructors. + */ public DecimalV2Type(int precision, int scale) { - Preconditions.checkArgument(precision >= scale); - Preconditions.checkArgument(precision > 0 && precision <= MAX_PRECISION); - Preconditions.checkArgument(scale >= 0 && scale <= MAX_SCALE); + Preconditions.checkArgument(precision > 0 && precision <= MAX_PRECISION, + "precision should in (0, " + MAX_PRECISION + "], but real precision is " + precision); + Preconditions.checkArgument(scale >= 0 && scale <= MAX_SCALE, + "scale should in [0, " + MAX_SCALE + "], but real scale is " + scale); + Preconditions.checkArgument(precision >= scale, "precision should not smaller than scale," + + " but precision is " + precision, ", scale is " + scale); this.precision = precision; this.scale = scale; } diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/types/DecimalV3Type.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/types/DecimalV3Type.java index 4c78513b50..b0fdd20580 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/types/DecimalV3Type.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/types/DecimalV3Type.java @@ -99,9 +99,11 @@ public class DecimalV3Type extends FractionalType { /** createDecimalV3Type. */ public static DecimalV3Type createDecimalV3Type(int precision, int scale) { - Preconditions.checkArgument(precision > 0 && precision <= MAX_DECIMAL128_PRECISION); - Preconditions.checkArgument(scale >= 0); - Preconditions.checkArgument(precision >= scale); + Preconditions.checkArgument(precision > 0 && precision <= MAX_DECIMAL128_PRECISION, + "precision should in (0, " + MAX_DECIMAL128_PRECISION + "], but real precision is " + precision); + Preconditions.checkArgument(scale >= 0, "scale should not smaller than 0, but real scale is " + scale); + Preconditions.checkArgument(precision >= scale, "precision should not smaller than scale," + + " but precision is " + precision, ", scale is " + scale); return new DecimalV3Type(precision, scale); } --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org