This is an automated email from the ASF dual-hosted git repository.

morrysnow pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/master by this push:
     new f4d3f4ae19 [Fix](Nereids) failed to fold date_format() to constant 
(#20976)
f4d3f4ae19 is described below

commit f4d3f4ae19e6c8ef99716769e4c50083d916e619
Author: mch_ucchi <41606806+sohardforan...@users.noreply.github.com>
AuthorDate: Tue Jun 20 15:11:25 2023 +0800

    [Fix](Nereids) failed to fold date_format() to constant (#20976)
---
 .../nereids/rules/expression/rules/SupportJavaDateFormatter.java  | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/expression/rules/SupportJavaDateFormatter.java
 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/expression/rules/SupportJavaDateFormatter.java
index f861944078..bf3a698887 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/expression/rules/SupportJavaDateFormatter.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/expression/rules/SupportJavaDateFormatter.java
@@ -23,7 +23,7 @@ import org.apache.doris.nereids.trees.expressions.Expression;
 import org.apache.doris.nereids.trees.expressions.functions.scalar.DateFormat;
 import 
org.apache.doris.nereids.trees.expressions.functions.scalar.FromUnixtime;
 import org.apache.doris.nereids.trees.expressions.literal.Literal;
-import org.apache.doris.nereids.trees.expressions.literal.StringLiteral;
+import org.apache.doris.nereids.trees.expressions.literal.VarcharLiteral;
 
 import com.google.common.collect.Lists;
 
@@ -75,11 +75,11 @@ public class SupportJavaDateFormatter extends 
AbstractExpressionRewriteRule {
             Literal literal = (Literal) formatterExpr;
             String originFormatter = literal.getStringValue();
             if (originFormatter.equals("yyyyMMdd")) {
-                return new StringLiteral("%Y%m%d");
+                return new VarcharLiteral("%Y%m%d");
             } else if (originFormatter.equals("yyyy-MM-dd")) {
-                return new StringLiteral("%Y-%m-%d");
+                return new VarcharLiteral("%Y-%m-%d");
             } else if (originFormatter.equals("yyyy-MM-dd HH:mm:ss")) {
-                return new StringLiteral("%Y-%m-%d %H:%i:%s");
+                return new VarcharLiteral("%Y-%m-%d %H:%i:%s");
             }
         }
         return formatterExpr;


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to