[fix](function) add time type in conditional-functions (#41270) (#41379)

## Proposed changes
https://github.com/apache/doris/pull/41270

<!--Describe your changes.-->
This commit is contained in:
Mryange
2024-09-27 17:19:54 +08:00
committed by GitHub
parent 1baf0dbc59
commit 0c51ee26ea
6 changed files with 38 additions and 2 deletions

View File

@ -36,6 +36,8 @@ import org.apache.doris.nereids.types.IntegerType;
import org.apache.doris.nereids.types.LargeIntType;
import org.apache.doris.nereids.types.SmallIntType;
import org.apache.doris.nereids.types.StringType;
import org.apache.doris.nereids.types.TimeType;
import org.apache.doris.nereids.types.TimeV2Type;
import org.apache.doris.nereids.types.TinyIntType;
import org.apache.doris.nereids.types.VarcharType;
import org.apache.doris.nereids.util.ExpressionUtils;
@ -64,6 +66,8 @@ public class Coalesce extends ScalarFunction
FunctionSignature.ret(DateTimeType.INSTANCE).varArgs(DateTimeType.INSTANCE),
FunctionSignature.ret(DateV2Type.INSTANCE).varArgs(DateV2Type.INSTANCE),
FunctionSignature.ret(DateType.INSTANCE).varArgs(DateType.INSTANCE),
FunctionSignature.ret(TimeType.INSTANCE).varArgs(TimeType.INSTANCE),
FunctionSignature.ret(TimeV2Type.INSTANCE).varArgs(TimeV2Type.INSTANCE),
FunctionSignature.ret(DecimalV3Type.WILDCARD).varArgs(DecimalV3Type.WILDCARD),
FunctionSignature.ret(DecimalV2Type.SYSTEM_DEFAULT).varArgs(DecimalV2Type.SYSTEM_DEFAULT),
FunctionSignature.ret(BitmapType.INSTANCE).varArgs(BitmapType.INSTANCE),

View File

@ -43,6 +43,8 @@ import org.apache.doris.nereids.types.MapType;
import org.apache.doris.nereids.types.NullType;
import org.apache.doris.nereids.types.SmallIntType;
import org.apache.doris.nereids.types.StringType;
import org.apache.doris.nereids.types.TimeType;
import org.apache.doris.nereids.types.TimeV2Type;
import org.apache.doris.nereids.types.TinyIntType;
import org.apache.doris.nereids.types.VarcharType;
import org.apache.doris.nereids.types.coercion.AnyDataType;
@ -84,7 +86,12 @@ public class If extends ScalarFunction
.args(BooleanType.INSTANCE, DoubleType.INSTANCE, DoubleType.INSTANCE),
FunctionSignature.ret(DateTimeType.INSTANCE)
.args(BooleanType.INSTANCE, DateTimeType.INSTANCE, DateTimeType.INSTANCE),
FunctionSignature.ret(DateType.INSTANCE).args(BooleanType.INSTANCE, DateType.INSTANCE, DateType.INSTANCE),
FunctionSignature.ret(DateType.INSTANCE).args(BooleanType.INSTANCE, DateType.INSTANCE,
DateType.INSTANCE),
FunctionSignature.ret(TimeType.INSTANCE).args(BooleanType.INSTANCE, TimeType.INSTANCE,
TimeType.INSTANCE),
FunctionSignature.ret(TimeV2Type.INSTANCE).args(BooleanType.INSTANCE, TimeV2Type.INSTANCE,
TimeV2Type.INSTANCE),
FunctionSignature.ret(DecimalV3Type.WILDCARD)
.args(BooleanType.INSTANCE, DecimalV3Type.WILDCARD, DecimalV3Type.WILDCARD),
FunctionSignature.ret(DecimalV2Type.SYSTEM_DEFAULT)

View File

@ -37,6 +37,8 @@ import org.apache.doris.nereids.types.IntegerType;
import org.apache.doris.nereids.types.LargeIntType;
import org.apache.doris.nereids.types.SmallIntType;
import org.apache.doris.nereids.types.StringType;
import org.apache.doris.nereids.types.TimeType;
import org.apache.doris.nereids.types.TimeV2Type;
import org.apache.doris.nereids.types.TinyIntType;
import org.apache.doris.nereids.types.VarcharType;
@ -65,6 +67,8 @@ public class NullIf extends ScalarFunction
FunctionSignature.ret(DateTimeV2Type.SYSTEM_DEFAULT)
.args(DateTimeV2Type.SYSTEM_DEFAULT, DateTimeV2Type.SYSTEM_DEFAULT),
FunctionSignature.ret(DateV2Type.INSTANCE).args(DateV2Type.INSTANCE, DateV2Type.INSTANCE),
FunctionSignature.ret(TimeType.INSTANCE).args(TimeType.INSTANCE, TimeType.INSTANCE),
FunctionSignature.ret(TimeV2Type.INSTANCE).args(TimeV2Type.INSTANCE, TimeV2Type.INSTANCE),
FunctionSignature.ret(DecimalV2Type.SYSTEM_DEFAULT)
.args(DecimalV2Type.SYSTEM_DEFAULT, DecimalV2Type.SYSTEM_DEFAULT),
FunctionSignature.ret(DecimalV3Type.WILDCARD)

View File

@ -36,6 +36,8 @@ import org.apache.doris.nereids.types.IntegerType;
import org.apache.doris.nereids.types.LargeIntType;
import org.apache.doris.nereids.types.SmallIntType;
import org.apache.doris.nereids.types.StringType;
import org.apache.doris.nereids.types.TimeType;
import org.apache.doris.nereids.types.TimeV2Type;
import org.apache.doris.nereids.types.TinyIntType;
import org.apache.doris.nereids.types.VarcharType;
@ -65,7 +67,11 @@ public class Nvl extends ScalarFunction
FunctionSignature.ret(DateTimeV2Type.SYSTEM_DEFAULT)
.args(DateTimeV2Type.SYSTEM_DEFAULT, DateTimeV2Type.SYSTEM_DEFAULT),
FunctionSignature.ret(DateV2Type.INSTANCE)
.args(DateV2Type.INSTANCE, DateV2Type.INSTANCE),
.args(DateV2Type.INSTANCE, DateV2Type.INSTANCE),
FunctionSignature.ret(TimeType.INSTANCE)
.args(TimeType.INSTANCE, TimeType.INSTANCE),
FunctionSignature.ret(TimeV2Type.INSTANCE)
.args(TimeV2Type.INSTANCE, TimeV2Type.INSTANCE),
FunctionSignature.ret(BitmapType.INSTANCE).args(BitmapType.INSTANCE, BitmapType.INSTANCE),
FunctionSignature.ret(VarcharType.SYSTEM_DEFAULT)
.args(VarcharType.SYSTEM_DEFAULT, VarcharType.SYSTEM_DEFAULT),