diff --git a/fe/fe-core/src/main/java/org/apache/doris/analysis/DateLiteral.java b/fe/fe-core/src/main/java/org/apache/doris/analysis/DateLiteral.java index 2377351822..229769e6f2 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/analysis/DateLiteral.java +++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/DateLiteral.java @@ -647,8 +647,13 @@ public class DateLiteral extends LiteralExpr { } } else if (targetType.isStringType()) { return new StringLiteral(getStringValue()); - } else if (Type.isImplicitlyCastable(this.type, targetType, true)) { - return new CastExpr(targetType, this); + } else if (targetType.isBigIntType()) { + long value = getYear() * 1000 + getMonth() * 100 + getDay(); + return new IntLiteral(value, Type.BIGINT); + } else { + if (Type.isImplicitlyCastable(this.type, targetType, true)) { + return new CastExpr(targetType, this); + } } Preconditions.checkState(false); return this;