From 0cc050ccdcf801b73c8125728fd6f63e4cc028a7 Mon Sep 17 00:00:00 2001 From: chenhao7253886 Date: Fri, 22 Mar 2019 15:30:43 +0800 Subject: [PATCH] Fix bug that throws exception when pruning partition type is date --- fe/src/main/java/org/apache/doris/analysis/DateLiteral.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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 f98a7fb81f4a8b..e3d1820c41436c 100644 --- a/fe/src/main/java/org/apache/doris/analysis/DateLiteral.java +++ b/fe/src/main/java/org/apache/doris/analysis/DateLiteral.java @@ -175,7 +175,11 @@ public Date getValue() { @Override protected Expr uncheckedCastTo(Type targetType) throws AnalysisException { - // programmer error, we should never reach this state + if (targetType.isDateType()) { + return this; + } else if (targetType.isStringType()) { + return new StringLiteral(date.toString()); + } Preconditions.checkState(false); return this; }