[opt](planner) return bigint literal when cast date literal to bigint type (#15613)

This commit is contained in:
minghong
2023-01-13 12:58:04 +08:00
committed by GitHub
parent c1963e799a
commit a8dacfbfd9

View File

@ -647,8 +647,13 @@ public class DateLiteral extends LiteralExpr {
}
} else if (targetType.isStringType()) {
return new StringLiteral(getStringValue());
} else if (Type.isImplicitlyCastable(this.type, targetType, true)) {
return new CastExpr(targetType, this);
} else if (targetType.isBigIntType()) {
long value = getYear() * 1000 + getMonth() * 100 + getDay();
return new IntLiteral(value, Type.BIGINT);
} else {
if (Type.isImplicitlyCastable(this.type, targetType, true)) {
return new CastExpr(targetType, this);
}
}
Preconditions.checkState(false);
return this;