Skip to content

Commit

Permalink
fix regression test
Browse files Browse the repository at this point in the history
  • Loading branch information
924060929 committed Dec 18, 2022
1 parent ff938d1 commit f8f97a5
Showing 1 changed file with 23 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import org.apache.doris.analysis.IsNullPredicate;
import org.apache.doris.analysis.LikePredicate;
import org.apache.doris.analysis.SlotRef;
import org.apache.doris.analysis.StringLiteral;
import org.apache.doris.analysis.TimestampArithmeticExpr;
import org.apache.doris.catalog.Function.NullableMode;
import org.apache.doris.catalog.Type;
Expand Down Expand Up @@ -69,6 +70,10 @@
import org.apache.doris.nereids.trees.expressions.functions.agg.AggregateParam;
import org.apache.doris.nereids.trees.expressions.functions.agg.Count;
import org.apache.doris.nereids.trees.expressions.functions.scalar.ScalarFunction;
import org.apache.doris.nereids.trees.expressions.literal.DateLiteral;
import org.apache.doris.nereids.trees.expressions.literal.DateTimeLiteral;
import org.apache.doris.nereids.trees.expressions.literal.DateTimeV2Literal;
import org.apache.doris.nereids.trees.expressions.literal.DateV2Literal;
import org.apache.doris.nereids.trees.expressions.literal.Literal;
import org.apache.doris.nereids.trees.expressions.literal.NullLiteral;
import org.apache.doris.nereids.trees.expressions.visitor.DefaultExpressionVisitor;
Expand Down Expand Up @@ -199,6 +204,24 @@ public Expr visitNullLiteral(NullLiteral nullLiteral, PlanTranslatorContext cont
return nullLit;
}

@Override
public Expr visitDateLiteral(DateLiteral dateLiteral, PlanTranslatorContext context) {
// BE not support date v2 literal and datetime v2 literal
if (dateLiteral instanceof DateV2Literal) {
return new CastExpr(Type.DATEV2, new StringLiteral(dateLiteral.toString()));
}
return super.visitDateLiteral(dateLiteral, context);
}

@Override
public Expr visitDateTimeLiteral(DateTimeLiteral dateTimeLiteral, PlanTranslatorContext context) {
// BE not support date v2 literal and datetime v2 literal
if (dateTimeLiteral instanceof DateTimeV2Literal) {
return new CastExpr(Type.DATETIMEV2, new StringLiteral(dateTimeLiteral.toString()));
}
return super.visitDateTimeLiteral(dateTimeLiteral, context);
}

@Override
public Expr visitBetween(Between between, PlanTranslatorContext context) {
throw new RuntimeException("Unexpected invocation");
Expand Down

0 comments on commit f8f97a5

Please sign in to comment.