[Improvement](window funnel) restrict timestamp to datetime type in window funnel (#12123)

This commit is contained in:
Gabriel
2022-08-29 12:14:04 +08:00
committed by GitHub
parent 957bf98784
commit af09c1f4eb
2 changed files with 16 additions and 7 deletions

View File

@ -946,6 +946,18 @@ public class FunctionCallExpr extends Expr {
}
fn = getBuiltinFunction(fnName.getFunction(), childTypes,
Function.CompareMode.IS_NONSTRICT_SUPERTYPE_OF);
if (fn != null && fn.getArgs()[2].isDatetime() && childTypes[2].isDatetimeV2()) {
fn.setArgType(childTypes[2], 2);
} else if (fn != null && fn.getArgs()[2].isDatetime() && childTypes[2].isDateV2()) {
fn.setArgType(ScalarType.DATETIMEV2, 2);
}
if (fn != null && childTypes[2].isDate()) {
// cast date to datetime
uncheckedCastChild(ScalarType.DATETIME, 2);
} else if (fn != null && childTypes[2].isDateV2()) {
// cast date to datetime
uncheckedCastChild(ScalarType.DATETIMEV2, 2);
}
} else if (fnName.getFunction().equalsIgnoreCase("if")) {
Type[] childTypes = collectChildReturnTypes();
Type assignmentCompatibleType = ScalarType.getAssignmentCompatibleType(childTypes[1], childTypes[2], true);