You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by yi...@apache.org on 2023/11/17 01:26:56 UTC

(doris) branch branch-1.2-lts updated: [Chore](decimal) make decimal value parse fail information readable (#26381)

This is an automated email from the ASF dual-hosted git repository.

yiguolei pushed a commit to branch branch-1.2-lts
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/branch-1.2-lts by this push:
     new dd7b9f11f70 [Chore](decimal) make decimal value parse fail information readable (#26381)
dd7b9f11f70 is described below

commit dd7b9f11f708587b1c6b59ec320f9753f02a78f3
Author: starocean999 <40...@users.noreply.github.com>
AuthorDate: Fri Nov 17 09:26:49 2023 +0800

    [Chore](decimal) make decimal value parse fail information readable (#26381)
    
    * [Chore](decimal) make decimal value parse fail information readable
    
    * fix bug
---
 .../main/java/org/apache/doris/analysis/StringLiteral.java    | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/fe/fe-core/src/main/java/org/apache/doris/analysis/StringLiteral.java b/fe/fe-core/src/main/java/org/apache/doris/analysis/StringLiteral.java
index 743b074f909..7690302fbce 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/StringLiteral.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/StringLiteral.java
@@ -254,9 +254,14 @@ public class StringLiteral extends LiteralExpr {
                 case DECIMAL32:
                 case DECIMAL64:
                 case DECIMAL128:
-                    DecimalLiteral res = new DecimalLiteral(new BigDecimal(value));
-                    res.setType(targetType);
-                    return res;
+                    try {
+                        DecimalLiteral res = new DecimalLiteral(new BigDecimal(value));
+                        res.setType(targetType);
+                        return res;
+                    } catch (Exception e) {
+                        throw new AnalysisException(String.format(
+                                "input value can't parse to decimal, value=%s", value));
+                    }
                 default:
                     break;
             }


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org