[fix](nereids) to_date should return type datev2 for datetimev2 (#21375)
To_date function in nereids return type should be DATEV2 if the arg type is DATETIMEV2. Before the return type was DATE which would cause BE get wrong query result.
This commit is contained in:
@ -522,9 +522,9 @@ public class DateTimeExtractAndTransform {
|
||||
return new DateLiteral(date.getYear(), date.getMonth(), date.getDay());
|
||||
}
|
||||
|
||||
@ExecFunction(name = "to_date", argTypes = {"DATETIMEV2"}, returnType = "DATE")
|
||||
@ExecFunction(name = "to_date", argTypes = {"DATETIMEV2"}, returnType = "DATEV2")
|
||||
public static Expression toDate(DateTimeV2Literal date) {
|
||||
return new DateLiteral(date.getYear(), date.getMonth(), date.getDay());
|
||||
return new DateV2Literal(date.getYear(), date.getMonth(), date.getDay());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user