Gabriel39 commented on code in PR #21487: URL: https://github.com/apache/doris/pull/21487#discussion_r1252656615
########## fe/fe-core/src/main/java/org/apache/doris/analysis/ColumnDef.java: ########## @@ -104,14 +111,51 @@ public DefaultValue(boolean isSet, String value, String exprName) { // default "value", "[]" means empty array public static DefaultValue ARRAY_EMPTY_DEFAULT_VALUE = new DefaultValue(true, "[]"); + public static DefaultValue currentTimeStampDefaultValueWithPrecision(Long precision) { + if (precision > 3 || precision < 0) { Review Comment: ```suggestion if (precision > 6 || precision < 0) { ``` ########## fe/fe-core/src/main/java/org/apache/doris/analysis/DefaultValueExprDef.java: ########## @@ -23,28 +23,44 @@ import org.apache.doris.catalog.Type; import org.apache.doris.common.AnalysisException; +import com.google.common.collect.Lists; import com.google.gson.annotations.SerializedName; import org.apache.log4j.LogManager; import org.apache.log4j.Logger; +import java.util.List; + /** * This def used for column which defaultValue is an expression. */ public class DefaultValueExprDef { private static final Logger LOG = LogManager.getLogger(DefaultValueExprDef.class); @SerializedName("exprName") private String exprName; + @SerializedName("precision") + private Long precision; + public DefaultValueExprDef(String exprName) { this.exprName = exprName; } + public DefaultValueExprDef(String exprName, Long precision) { + this.exprName = exprName; + this.precision = precision; + } + /** * generate a FunctionCallExpr * @return FunctionCallExpr of exprName */ public FunctionCallExpr getExpr(Type type) { - FunctionCallExpr expr = new FunctionCallExpr(exprName, new FunctionParams(null)); + List<Expr> exprs = null; + if (precision != null) { + exprs = Lists.newArrayList(); + exprs.add(new IntLiteral(3)); Review Comment: Why use a constant 3 ? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org