From 751a219f0a3fe6d7971faed311c60ef4921e358d Mon Sep 17 00:00:00 2001 From: EmmyMiao87 <522274284@qq.com> Date: Mon, 21 Oct 2019 13:57:50 +0800 Subject: [PATCH] Add the unchecked cast from date literal to others (#2021) Fix the ISSUE:2017 This commit enable the cast function in date. The date literal can be cast to target type which is implicitly castable such as int, bigint, largeint. --- fe/src/main/java/org/apache/doris/analysis/DateLiteral.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fe/src/main/java/org/apache/doris/analysis/DateLiteral.java b/fe/src/main/java/org/apache/doris/analysis/DateLiteral.java index 9d2b58a932..8bbedfee2b 100644 --- a/fe/src/main/java/org/apache/doris/analysis/DateLiteral.java +++ b/fe/src/main/java/org/apache/doris/analysis/DateLiteral.java @@ -313,6 +313,8 @@ public class DateLiteral extends LiteralExpr { return this; } else if (targetType.isStringType()) { return new StringLiteral(getStringValue()); + } else if (Type.isImplicitlyCastable(this.type, targetType, true)) { + return new CastExpr(targetType, this); } Preconditions.checkState(false); return this;