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

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


The following commit(s) were added to refs/heads/branch-2.1 by this push:
     new 9e8e1dac4e7 [branch-2.1][fix](default value) Avoid default precision 
value of 0 for default expressions during deserialization (#40806)
9e8e1dac4e7 is described below

commit 9e8e1dac4e72b321efdf25f5be71731d122f2091
Author: zy-kkk <zhongy...@gmail.com>
AuthorDate: Fri Sep 13 19:59:12 2024 +0800

    [branch-2.1][fix](default value) Avoid default precision value of 0 for 
default expressions during deserialization (#40806)
    
    pick  (#40671)
    
    This PR fixes the issue where the precision of default value expressions
    was incorrectly set to `0` during deserialization. The `gsonPostProcess`
    method no longer assigns a default precision of `0` if the precision is
    not provided. Additionally, logic has been added to ensure that
    expressions without precision do not incorrectly apply a precision of
    `0`.
---
 .../main/java/org/apache/doris/analysis/DefaultValueExprDef.java    | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/analysis/DefaultValueExprDef.java 
b/fe/fe-core/src/main/java/org/apache/doris/analysis/DefaultValueExprDef.java
index 30ab756bb51..44bc766ee47 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/analysis/DefaultValueExprDef.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/analysis/DefaultValueExprDef.java
@@ -64,7 +64,7 @@ public class DefaultValueExprDef implements Writable, 
GsonPostProcessable {
      */
     public FunctionCallExpr getExpr(Type type) {
         List<Expr> exprs = null;
-        if (precision != null) {
+        if (precision != null && precision != 0) {
             exprs = Lists.newArrayList();
             exprs.add(new IntLiteral(precision));
         }
@@ -101,8 +101,6 @@ public class DefaultValueExprDef implements Writable, 
GsonPostProcessable {
 
     @Override
     public void gsonPostProcess() throws IOException {
-        if (precision == null) {
-            precision = 0L;
-        }
+        // nothing to do
     }
 }


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

Reply via email to