You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by mo...@apache.org on 2022/10/04 13:31:26 UTC

[doris] branch master updated: [fix](decimal) retain Decimal trailing zero when select on fe (#13065)

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

morningman 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 b083fb6d5f [fix](decimal) retain Decimal trailing zero when select on fe (#13065)
b083fb6d5f is described below

commit b083fb6d5fee00f902bef6093885f50f926d67b1
Author: xueweizhang <zx...@163.com>
AuthorDate: Tue Oct 4 21:31:18 2022 +0800

    [fix](decimal) retain Decimal trailing zero when select on fe (#13065)
---
 .../src/main/java/org/apache/doris/common/util/LiteralUtils.java      | 4 ++--
 fe/fe-core/src/main/java/org/apache/doris/qe/StmtExecutor.java        | 2 +-
 .../data/query_p0/sql_functions/array_functions/sql/q02.out           | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/fe/fe-core/src/main/java/org/apache/doris/common/util/LiteralUtils.java b/fe/fe-core/src/main/java/org/apache/doris/common/util/LiteralUtils.java
index 3820f0465d..0b71d1548d 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/common/util/LiteralUtils.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/common/util/LiteralUtils.java
@@ -38,7 +38,7 @@ public class LiteralUtils {
             String timeStr = literal.getStringValue();
             return timeStr.substring(1, timeStr.length() - 1);
         } else {
-            return BigDecimal.valueOf(literal.getValue()).stripTrailingZeros().toPlainString();
+            return BigDecimal.valueOf(literal.getValue()).toPlainString();
         }
     }
 
@@ -48,7 +48,7 @@ public class LiteralUtils {
             if (v instanceof FloatLiteral) {
                 list.add(getStringValue((FloatLiteral) v));
             } else if (v instanceof DecimalLiteral) {
-                list.add(((DecimalLiteral) v).getValue().stripTrailingZeros().toPlainString());
+                list.add(((DecimalLiteral) v).getValue().toPlainString());
             } else if (v instanceof StringLiteral) {
                 list.add("'" + v.getStringValue() + "'");
             } else if (v instanceof ArrayLiteral) {
diff --git a/fe/fe-core/src/main/java/org/apache/doris/qe/StmtExecutor.java b/fe/fe-core/src/main/java/org/apache/doris/qe/StmtExecutor.java
index 628bc70454..f7c3f8bc35 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/qe/StmtExecutor.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/qe/StmtExecutor.java
@@ -1012,7 +1012,7 @@ public class StmtExecutor implements ProfileWriter {
                 } else if (expr instanceof FloatLiteral) {
                     data.add(LiteralUtils.getStringValue((FloatLiteral) expr));
                 } else if (expr instanceof DecimalLiteral) {
-                    data.add(((DecimalLiteral) expr).getValue().stripTrailingZeros().toPlainString());
+                    data.add(((DecimalLiteral) expr).getValue().toPlainString());
                 } else if (expr instanceof ArrayLiteral) {
                     data.add(LiteralUtils.getStringValue((ArrayLiteral) expr));
                 } else {
diff --git a/regression-test/data/query_p0/sql_functions/array_functions/sql/q02.out b/regression-test/data/query_p0/sql_functions/array_functions/sql/q02.out
index 210eb5974d..b1b6330fe0 100644
--- a/regression-test/data/query_p0/sql_functions/array_functions/sql/q02.out
+++ b/regression-test/data/query_p0/sql_functions/array_functions/sql/q02.out
@@ -9,7 +9,7 @@
 [1, 2]
 
 -- !q02_4 --
-[1, 2]
+[1.0, 2]
 
 -- !q02_5 --
 [-1, 2]


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