[fix](planner) fix bugs in uncheckedCastChild (#15905)

1. `uncheckedCastChild` may generate redundant `CastExpr` like `cast( cast(XXX as Date) as Date)`
2. generate DateLiteral to replace cast(IntLiteral as Date)
This commit is contained in:
minghong
2023-01-19 15:51:08 +08:00
committed by GitHub
parent 21b78cb820
commit 74c0677d62
6 changed files with 90 additions and 21 deletions

View File

@ -283,6 +283,13 @@ public abstract class Type {
return isScalarType(PrimitiveType.DATETIMEV2);
}
public boolean isDateLike() {
return isScalarType(PrimitiveType.DATETIME)
|| isScalarType(PrimitiveType.DATETIMEV2)
|| isScalarType(PrimitiveType.DATE)
|| isScalarType(PrimitiveType.DATEV2);
}
public boolean isTimeV2() {
return isScalarType(PrimitiveType.TIMEV2);
}