From 6e0bc3cf8110ef3a0bf05bfeae21bf5908fa3832 Mon Sep 17 00:00:00 2001 From: lemon Date: Mon, 18 Sep 2023 19:22:20 +0800 Subject: [PATCH] fix --- .../rules/SupportJavaDateFormatter.java | 23 ++++++++++--------- 1 file changed, 12 insertions(+), 11 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 697e918ce15b33..17f4b7d239a237 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 @@ -60,17 +60,7 @@ public Expression visitFromUnixtime(FromUnixtime fromUnixtime, ExpressionRewrite return fromUnixtime; } - private Expression translateJavaFormatter(Expression function, int formatterIndex) { - Expression formatterExpr = function.getArgument(formatterIndex); - Expression newFormatterExpr = translateJavaFormatter(formatterExpr); - if (newFormatterExpr != formatterExpr) { - List newArguments = Lists.newArrayList(function.getArguments()); - newArguments.set(formatterIndex, newFormatterExpr); - return function.withChildren(newArguments); - } - return function; - } - + @Override public Expression visitUnixTimestamp(UnixTimestamp unixTimestamp, ExpressionRewriteContext context) { Expression expr = super.visitUnixTimestamp(unixTimestamp, context); if (!(expr instanceof UnixTimestamp)) { @@ -83,6 +73,17 @@ public Expression visitUnixTimestamp(UnixTimestamp unixTimestamp, ExpressionRewr return unixTimestamp; } + private Expression translateJavaFormatter(Expression function, int formatterIndex) { + Expression formatterExpr = function.getArgument(formatterIndex); + Expression newFormatterExpr = translateJavaFormatter(formatterExpr); + if (newFormatterExpr != formatterExpr) { + List newArguments = Lists.newArrayList(function.getArguments()); + newArguments.set(formatterIndex, newFormatterExpr); + return function.withChildren(newArguments); + } + return function; + } + private Expression translateJavaFormatter(Expression formatterExpr) { if (formatterExpr.isLiteral() && formatterExpr.getDataType().isStringLikeType()) { Literal literal = (Literal) formatterExpr;