From 9aa9894b1110bb9c2513c2a2170388269b476f1c Mon Sep 17 00:00:00 2001 From: morrySnow <101034200+morrySnow@users.noreply.github.com> Date: Thu, 26 Oct 2023 11:36:14 +0800 Subject: [PATCH] [fix](Nereids) create table default value error msg is diff with lagacy planner (#25897) old error msg: default value precision: 2023-10-25 14:45:30.292 can not be greater than type precision: DATETIME(1) new error msg: default value precision: CURRENT_TIMESTAMP(3) can not be greater than type precision: DATETIME(1) --- .../plans/commands/info/DefaultValue.java | 27 ------------------- 1 file changed, 27 deletions(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/info/DefaultValue.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/info/DefaultValue.java index cd8ddb0f32..40c2b5ed85 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/info/DefaultValue.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/info/DefaultValue.java @@ -19,10 +19,6 @@ package org.apache.doris.nereids.trees.plans.commands.info; import org.apache.doris.analysis.DefaultValueExprDef; import org.apache.doris.catalog.ScalarType; -import org.apache.doris.common.util.TimeUtils; - -import java.time.LocalDateTime; -import java.time.format.DateTimeFormatter; /** * default value of a column. @@ -106,29 +102,6 @@ public class DefaultValue { * get string value of a default value expression. */ public String getValue() { - if (isCurrentTimeStamp()) { - return LocalDateTime.now(TimeUtils.getTimeZone().toZoneId()).toString().replace('T', ' '); - } else if (isCurrentTimeStampWithPrecision()) { - long precision = getCurrentTimeStampPrecision(); - String format = "yyyy-MM-dd HH:mm:ss"; - if (precision == 0) { - return LocalDateTime.now(TimeUtils.getTimeZone().toZoneId()).toString().replace('T', ' '); - } else if (precision == 1) { - format = "yyyy-MM-dd HH:mm:ss.S"; - } else if (precision == 2) { - format = "yyyy-MM-dd HH:mm:ss.SS"; - } else if (precision == 3) { - format = "yyyy-MM-dd HH:mm:ss.SSS"; - } else if (precision == 4) { - format = "yyyy-MM-dd HH:mm:ss.SSSS"; - } else if (precision == 5) { - format = "yyyy-MM-dd HH:mm:ss.SSSSS"; - } else if (precision == 6) { - format = "yyyy-MM-dd HH:mm:ss.SSSSSS"; - } - return LocalDateTime.now(TimeUtils.getTimeZone().toZoneId()) - .format(DateTimeFormatter.ofPattern(format)); - } return value; }