From 27d64964e6ea8a05d5dc5a5062a7b794385db6ec Mon Sep 17 00:00:00 2001 From: morrySnow <101034200+morrySnow@users.noreply.github.com> Date: Fri, 23 Dec 2022 18:29:50 +0800 Subject: [PATCH] [enhancement](Nereids) cast expression to the type with parameters (#14657) --- .../org/apache/doris/nereids/DorisParser.g4 | 291 +----------------- .../nereids/parser/LogicalPlanBuilder.java | 11 +- .../doris/nereids/parser/NereidsParser.java | 5 + .../functions/scalar/Coalesce.java | 2 +- .../functions/scalar/ConvertTz.java | 4 +- .../functions/scalar/CurrentTimestamp.java | 2 +- .../expressions/functions/scalar/Date.java | 2 +- .../functions/scalar/DateDiff.java | 9 +- .../functions/scalar/DateFormat.java | 3 +- .../functions/scalar/DateTrunc.java | 3 +- .../expressions/functions/scalar/DateV2.java | 2 +- .../expressions/functions/scalar/Day.java | 2 +- .../expressions/functions/scalar/DayCeil.java | 12 +- .../functions/scalar/DayFloor.java | 12 +- .../expressions/functions/scalar/DayName.java | 2 +- .../functions/scalar/DayOfMonth.java | 2 +- .../functions/scalar/DayOfWeek.java | 2 +- .../functions/scalar/DayOfYear.java | 2 +- .../expressions/functions/scalar/DaysAdd.java | 3 +- .../functions/scalar/DaysDiff.java | 11 +- .../expressions/functions/scalar/DaysSub.java | 3 +- .../functions/scalar/Greatest.java | 2 +- .../expressions/functions/scalar/Hour.java | 2 +- .../functions/scalar/HourCeil.java | 20 +- .../functions/scalar/HourFloor.java | 20 +- .../functions/scalar/HoursAdd.java | 5 +- .../functions/scalar/HoursDiff.java | 11 +- .../functions/scalar/HoursSub.java | 5 +- .../expressions/functions/scalar/If.java | 4 +- .../functions/scalar/LocalTime.java | 2 +- .../functions/scalar/LocalTimestamp.java | 2 +- .../expressions/functions/scalar/Minute.java | 2 +- .../functions/scalar/MinuteCeil.java | 20 +- .../functions/scalar/MinuteFloor.java | 20 +- .../functions/scalar/MinutesAdd.java | 5 +- .../functions/scalar/MinutesDiff.java | 11 +- .../functions/scalar/MinutesSub.java | 5 +- .../expressions/functions/scalar/Month.java | 2 +- .../functions/scalar/MonthCeil.java | 12 +- .../functions/scalar/MonthFloor.java | 12 +- .../functions/scalar/MonthName.java | 2 +- .../functions/scalar/MonthsAdd.java | 3 +- .../functions/scalar/MonthsDiff.java | 11 +- .../functions/scalar/MonthsSub.java | 3 +- .../expressions/functions/scalar/Now.java | 2 +- .../expressions/functions/scalar/NullIf.java | 3 +- .../expressions/functions/scalar/Nvl.java | 9 +- .../expressions/functions/scalar/Quarter.java | 2 +- .../expressions/functions/scalar/Second.java | 2 +- .../functions/scalar/SecondCeil.java | 20 +- .../functions/scalar/SecondFloor.java | 20 +- .../functions/scalar/SecondsAdd.java | 5 +- .../functions/scalar/SecondsDiff.java | 11 +- .../functions/scalar/SecondsSub.java | 5 +- .../functions/scalar/TimeDiff.java | 9 +- .../functions/scalar/Timestamp.java | 2 +- .../expressions/functions/scalar/ToDate.java | 2 +- .../functions/scalar/ToDateV2.java | 2 +- .../functions/scalar/UnixTimestamp.java | 2 +- .../expressions/functions/scalar/Week.java | 4 +- .../functions/scalar/WeekCeil.java | 12 +- .../functions/scalar/WeekFloor.java | 12 +- .../functions/scalar/WeekOfYear.java | 2 +- .../expressions/functions/scalar/Weekday.java | 2 +- .../functions/scalar/WeeksDiff.java | 11 +- .../expressions/functions/scalar/Year.java | 2 +- .../functions/scalar/YearCeil.java | 12 +- .../functions/scalar/YearFloor.java | 12 +- .../functions/scalar/YearWeek.java | 4 +- .../functions/scalar/YearsAdd.java | 3 +- .../functions/scalar/YearsDiff.java | 11 +- .../functions/scalar/YearsSub.java | 3 +- .../literal/DateTimeV2Literal.java | 4 +- .../apache/doris/nereids/types/DataType.java | 208 +++++-------- .../doris/nereids/types/DateTimeV2Type.java | 12 +- .../doris/nereids/types/DecimalV2Type.java | 4 + .../doris/nereids/types/DecimalV3Type.java | 26 +- .../nereids/parser/NereidsParserTest.java | 15 +- .../rewrite/ExpressionRewriteTest.java | 42 +-- .../doris/nereids/types/DataTypeTest.java | 58 ++++ 80 files changed, 479 insertions(+), 642 deletions(-) diff --git a/fe/fe-core/src/main/antlr4/org/apache/doris/nereids/DorisParser.g4 b/fe/fe-core/src/main/antlr4/org/apache/doris/nereids/DorisParser.g4 index 939b2059c6..a9dc12ff27 100644 --- a/fe/fe-core/src/main/antlr4/org/apache/doris/nereids/DorisParser.g4 +++ b/fe/fe-core/src/main/antlr4/org/apache/doris/nereids/DorisParser.g4 @@ -21,19 +21,6 @@ parser grammar DorisParser; options { tokenVocab = DorisLexer; } -@members { - /** - * When false, a literal with an exponent would be converted into - * double type rather than decimal type. - */ - public boolean legacy_exponent_literal_as_decimal_enabled = false; - - /** - * When true, the behavior of keywords follows ANSI SQL standard. - */ - public boolean SQL_standard_keyword_behavior = true; -} - multiStatements : (statement SEMICOLON*)+ EOF ; @@ -299,7 +286,7 @@ primaryExpression RIGHT_PAREN #date_sub | CASE whenClause+ (ELSE elseExpression=expression)? END #searchedCase | CASE value=expression whenClause+ (ELSE elseExpression=expression)? END #simpleCase - | name=CAST LEFT_PAREN expression AS identifier RIGHT_PAREN #cast + | name=CAST LEFT_PAREN expression AS dataType RIGHT_PAREN #cast | constant #constantDefault | ASTERISK #star | qualifiedName DOT ASTERISK #star @@ -346,6 +333,11 @@ unitIdentifier : YEAR | MONTH | WEEK | DAY | HOUR | MINUTE | SECOND ; +dataType + : identifier (LEFT_PAREN INTEGER_VALUE + (COMMA INTEGER_VALUE)* RIGHT_PAREN)? #primitiveDataType + ; + // this rule is used for explicitly capturing wrong identifiers such as test-table, which should actually be `test-table` // replace identifier with errorCapturingIdentifier where the immediate follow symbol is not an expression, otherwise // valid expressions such as "a-b" can be recognized as an identifier @@ -361,14 +353,12 @@ errorCapturingIdentifierExtra identifier : strictIdentifier - | {!SQL_standard_keyword_behavior}? strictNonReserved ; strictIdentifier : IDENTIFIER #unquotedIdentifier | quotedIdentifier #quotedIdentifierAlternative - | {SQL_standard_keyword_behavior}? ansiNonReserved #unquotedIdentifier - | {!SQL_standard_keyword_behavior}? nonReserved #unquotedIdentifier + | nonReserved #unquotedIdentifier ; quotedIdentifier @@ -380,272 +370,11 @@ number | MINUS? (EXPONENT_VALUE | DECIMAL_VALUE) #decimalLiteral ; -// When `SQL_standard_keyword_behavior=true`, there are 2 kinds of keywords in Spark SQL. -// - Reserved keywords: -// Keywords that are reserved and can't be used as identifiers for table, view, column, -// function, alias, etc. +// there are 1 kinds of keywords in Doris. // - Non-reserved keywords: -// Keywords that have a special meaning only in particular contexts and can be used as -// identifiers in other contexts. For example, `EXPLAIN SELECT ...` is a command, but EXPLAIN -// can be used as identifiers in other places. -// You can find the full keywords list by searching "Start of the keywords list" in this file. -// The non-reserved keywords are listed below. Keywords not in this list are reserved keywords. -ansiNonReserved -//--ANSI-NON-RESERVED-START - : ADD - | ADDDATE - | AFTER - | ALTER - | ANALYZE - | ANALYZED - | ANTI - | ARCHIVE - | ARRAY - | ASC - | AT - | AVG - | BETWEEN - | BUCKET - | BUCKETS - | BY - | CACHE - | CASCADE - | CATALOG - | CATALOGS - | CHANGE - | CLEAR - | CLUSTER - | CLUSTERED - | CODEGEN - | COLLECTION - | COLUMNS - | COMMENT - | COMMIT - | COMPACT - | COMPACTIONS - | COMPUTE - | CONCATENATE - | COST - | CUBE - | CURRENT - | DATA - | DATABASE - | DATABASES - | DATE - | DATE_ADD - | DATEDIFF - | DATE_DIFF - | DAY - | DAYS_ADD - | DAYS_SUB - | DATE_ADD - | DATE_SUB - | DBPROPERTIES - | DEFINED - | DELETE - | DELIMITED - | DESC - | DESCRIBE - | DFS - | DIRECTORIES - | DIRECTORY - | DISTRIBUTE - | DROP - | ESCAPED - | EXCHANGE - | EXISTS - | EXPLAIN - | EXPORT - | EXTENDED - | EXTERNAL - | EXTRACT - | FIELDS - | FILEFORMAT - | FIRST - | FOLLOWING - | FORMAT - | FORMATTED - | FUNCTION - | FUNCTIONS - | GLOBAL - | GROUPING - | GRAPH - | HOUR - | IF - | IGNORE - | IMPORT - | INDEX - | INDEXES - | INPATH - | INPUTFORMAT - | INSERT - | INTERVAL - | ISNULL - | ITEMS - | KEYS - | LAST - | LAZY - | LIKE - | ILIKE - | IS_NOT_NULL_PRED - | IS_NULL_PRED - | LIMIT - | OFFSET - | LINES - | LIST - | LOAD - | LOCAL - | LOCATION - | LOCK - | LOCKS - | LOGICAL - | MACRO - | MAP - | MATCHED - | MERGE - | MINUTE - | MONTH - | MSCK - | NAMESPACE - | NAMESPACES - | NO - | NULLS - | OF - | OPTIMIZED - | OPTION - | OPTIONS - | OUT - | OUTPUTFORMAT - | OVER - | OVERLAY - | OVERWRITE - | PARSED - | PARTITION - | PARTITIONED - | PARTITIONS - | PERCENTLIT - | PHYSICAL - | PIVOT - | PLACING - | PLAN - | POLICY - | POSITION - | PRECEDING - | PRINCIPALS - | PROPERTIES - | PURGE - | QUERY - | RANGE - | RECORDREADER - | RECORDWRITER - | RECOVER - | REDUCE - | REFRESH - | RENAME - | REPAIR - | REPEATABLE - | REPLACE - | RESET - | RESPECT - | RESTRICT - | REVOKE - | REWRITTEN - | RLIKE - | ROLE - | ROLES - | ROLLBACK - | ROLLUP - | ROW - | ROWS - | SCHEMA - | SCHEMAS - | SECOND - | SEMI - | SEPARATED - | SERDE - | SERDEPROPERTIES - | SET - | SETMINUS - | SETS - | SHOW - | SKEWED - | SORT - | SORTED - | START - | STATISTICS - | STORED - | STRATIFY - | STRUCT - | SUBDATE - | SUBSTR - | SUBSTRING - | SUM - | SYNC - | SYSTEM_TIME - | SYSTEM_VERSION - | TABLES - | TABLESAMPLE - | TBLPROPERTIES - | TEMPORARY - | TERMINATED - | TIMESTAMP - | TIMESTAMPADD - | TIMESTAMPDIFF - | TOUCH - | TRANSACTION - | TRANSACTIONS - | TRANSFORM - | TRIM - | TRUE - | TRUNCATE - | TRY_CAST - | TYPE - | UNARCHIVE - | UNBOUNDED - | UNCACHE - | UNLOCK - | UNSET - | UPDATE - | USE - | VALUES - | VERBOSE - | VERSION - | VIEW - | VIEWS - | WINDOW - | YEAR - | ZONE -//--ANSI-NON-RESERVED-END - ; - -// When `SQL_standard_keyword_behavior=false`, there are 2 kinds of keywords in Spark SQL. -// - Non-reserved keywords: -// Same definition as the one when `SQL_standard_keyword_behavior=true`. -// - Strict-non-reserved keywords: -// A strict version of non-reserved keywords, which can not be used as table alias. -// You can find the full keywords list by searching "Start of the keywords list" in this file. -// The strict-non-reserved keywords are listed in `strictNonReserved`. +// normal version of non-reserved keywords. // The non-reserved keywords are listed in `nonReserved`. -// These 2 together contain all the keywords. -strictNonReserved - : ANTI - | CROSS - | EXCEPT - | FULL - | INNER - | INTERSECT - | JOIN - | LATERAL - | LEFT - | NATURAL - | ON - | RIGHT - | SEMI - | SETMINUS - | UNION - | USING - ; - +// TODO: need to stay consistent with the legacy nonReserved //--DEFAULT-NON-RESERVED-START : ADD diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/parser/LogicalPlanBuilder.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/parser/LogicalPlanBuilder.java index e5f71076c3..dfe9911a0a 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/parser/LogicalPlanBuilder.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/parser/LogicalPlanBuilder.java @@ -65,6 +65,7 @@ import org.apache.doris.nereids.DorisParser.ParenthesizedExpressionContext; import org.apache.doris.nereids.DorisParser.PlanTypeContext; import org.apache.doris.nereids.DorisParser.PredicateContext; import org.apache.doris.nereids.DorisParser.PredicatedContext; +import org.apache.doris.nereids.DorisParser.PrimitiveDataTypeContext; import org.apache.doris.nereids.DorisParser.QualifiedNameContext; import org.apache.doris.nereids.DorisParser.QueryContext; import org.apache.doris.nereids.DorisParser.QueryOrganizationContext; @@ -776,7 +777,7 @@ public class LogicalPlanBuilder extends DorisParserBaseVisitor { @Override public Expression visitCast(DorisParser.CastContext ctx) { return ParserUtils.withOrigin(ctx, () -> - new Cast(getExpression(ctx.expression()), DataType.convertFromString(ctx.identifier().getText()))); + new Cast(getExpression(ctx.expression()), typedVisit(ctx.dataType()))); } @Override @@ -1473,4 +1474,12 @@ public class LogicalPlanBuilder extends DorisParserBaseVisitor { } return ExplainLevel.ALL_PLAN; } + + @Override + public DataType visitPrimitiveDataType(PrimitiveDataTypeContext ctx) { + String dataType = ctx.identifier().getText().toLowerCase(Locale.ROOT); + List l = Lists.newArrayList(dataType); + ctx.INTEGER_VALUE().stream().map(ParseTree::getText).forEach(l::add); + return DataType.convertPrimitiveFromStrings(l); + } } diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/parser/NereidsParser.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/parser/NereidsParser.java index 72c8c9368e..b6af329ca4 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/parser/NereidsParser.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/parser/NereidsParser.java @@ -28,6 +28,7 @@ import org.apache.doris.nereids.trees.expressions.Expression; import org.apache.doris.nereids.trees.plans.commands.ExplainCommand; import org.apache.doris.nereids.trees.plans.commands.ExplainCommand.ExplainLevel; import org.apache.doris.nereids.trees.plans.logical.LogicalPlan; +import org.apache.doris.nereids.types.DataType; import com.google.common.collect.Lists; import org.antlr.v4.runtime.CharStreams; @@ -90,6 +91,10 @@ public class NereidsParser { return parse(expression, DorisParser::expression); } + public DataType parseDataType(String dataType) { + return parse(dataType, DorisParser::dataType); + } + private T parse(String sql, Function parseFunction) { ParserRuleContext tree = toAst(sql, parseFunction); LogicalPlanBuilder logicalPlanBuilder = new LogicalPlanBuilder(); diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/Coalesce.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/Coalesce.java index 8d29668b53..bea07e1798 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/Coalesce.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/Coalesce.java @@ -61,7 +61,7 @@ public class Coalesce extends ScalarFunction FunctionSignature.ret(DoubleType.INSTANCE).varArgs(DoubleType.INSTANCE), FunctionSignature.ret(DateTimeType.INSTANCE).varArgs(DateTimeType.INSTANCE), FunctionSignature.ret(DateType.INSTANCE).varArgs(DateType.INSTANCE), - FunctionSignature.ret(DateTimeV2Type.INSTANCE).varArgs(DateTimeV2Type.INSTANCE), + FunctionSignature.ret(DateTimeV2Type.SYSTEM_DEFAULT).varArgs(DateTimeV2Type.SYSTEM_DEFAULT), FunctionSignature.ret(DateV2Type.INSTANCE).varArgs(DateV2Type.INSTANCE), FunctionSignature.ret(DecimalV2Type.SYSTEM_DEFAULT).varArgs(DecimalV2Type.SYSTEM_DEFAULT), FunctionSignature.ret(BitmapType.INSTANCE).varArgs(BitmapType.INSTANCE), diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/ConvertTz.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/ConvertTz.java index 5e1462478a..57de9ce315 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/ConvertTz.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/ConvertTz.java @@ -42,8 +42,8 @@ public class ConvertTz extends ScalarFunction public static final List SIGNATURES = ImmutableList.of( FunctionSignature.ret(DateTimeType.INSTANCE) .args(DateTimeType.INSTANCE, VarcharType.SYSTEM_DEFAULT, VarcharType.SYSTEM_DEFAULT), - FunctionSignature.ret(DateTimeV2Type.INSTANCE) - .args(DateTimeV2Type.INSTANCE, VarcharType.SYSTEM_DEFAULT, VarcharType.SYSTEM_DEFAULT), + FunctionSignature.ret(DateTimeV2Type.SYSTEM_DEFAULT) + .args(DateTimeV2Type.SYSTEM_DEFAULT, VarcharType.SYSTEM_DEFAULT, VarcharType.SYSTEM_DEFAULT), FunctionSignature.ret(DateV2Type.INSTANCE) .args(DateV2Type.INSTANCE, VarcharType.SYSTEM_DEFAULT, VarcharType.SYSTEM_DEFAULT) ); diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/CurrentTimestamp.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/CurrentTimestamp.java index 44e8fab924..dd8bce75c6 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/CurrentTimestamp.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/CurrentTimestamp.java @@ -41,7 +41,7 @@ public class CurrentTimestamp extends DateTimeWithPrecision public static final List SIGNATURES = ImmutableList.of( FunctionSignature.ret(DateTimeType.INSTANCE).args(), - FunctionSignature.ret(DateTimeV2Type.INSTANCE).args(IntegerType.INSTANCE) + FunctionSignature.ret(DateTimeV2Type.SYSTEM_DEFAULT).args(IntegerType.INSTANCE) ); /** diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/Date.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/Date.java index 737966bb2d..8b8f232cc3 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/Date.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/Date.java @@ -41,7 +41,7 @@ public class Date extends ScalarFunction public static final List SIGNATURES = ImmutableList.of( FunctionSignature.ret(DateType.INSTANCE).args(DateTimeType.INSTANCE), - FunctionSignature.ret(DateV2Type.INSTANCE).args(DateTimeV2Type.INSTANCE) + FunctionSignature.ret(DateV2Type.INSTANCE).args(DateTimeV2Type.SYSTEM_DEFAULT) ); /** diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/DateDiff.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/DateDiff.java index 0bbf3b0244..6df351ce84 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/DateDiff.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/DateDiff.java @@ -41,11 +41,12 @@ public class DateDiff extends ScalarFunction public static final List SIGNATURES = ImmutableList.of( FunctionSignature.ret(IntegerType.INSTANCE).args(DateTimeType.INSTANCE, DateTimeType.INSTANCE), - FunctionSignature.ret(IntegerType.INSTANCE).args(DateTimeV2Type.INSTANCE, DateTimeV2Type.INSTANCE), - FunctionSignature.ret(IntegerType.INSTANCE).args(DateTimeV2Type.INSTANCE, DateV2Type.INSTANCE), - FunctionSignature.ret(IntegerType.INSTANCE).args(DateV2Type.INSTANCE, DateTimeV2Type.INSTANCE), + FunctionSignature.ret(IntegerType.INSTANCE) + .args(DateTimeV2Type.SYSTEM_DEFAULT, DateTimeV2Type.SYSTEM_DEFAULT), + FunctionSignature.ret(IntegerType.INSTANCE).args(DateTimeV2Type.SYSTEM_DEFAULT, DateV2Type.INSTANCE), + FunctionSignature.ret(IntegerType.INSTANCE).args(DateV2Type.INSTANCE, DateTimeV2Type.SYSTEM_DEFAULT), FunctionSignature.ret(IntegerType.INSTANCE).args(DateV2Type.INSTANCE, DateV2Type.INSTANCE), - FunctionSignature.ret(IntegerType.INSTANCE).args(DateTimeV2Type.INSTANCE, DateTimeType.INSTANCE), + FunctionSignature.ret(IntegerType.INSTANCE).args(DateTimeV2Type.SYSTEM_DEFAULT, DateTimeType.INSTANCE), FunctionSignature.ret(IntegerType.INSTANCE).args(DateV2Type.INSTANCE, DateTimeType.INSTANCE) ); diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/DateFormat.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/DateFormat.java index 4b309e6934..8c10ed3ed1 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/DateFormat.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/DateFormat.java @@ -43,7 +43,8 @@ public class DateFormat extends ScalarFunction public static final List SIGNATURES = ImmutableList.of( FunctionSignature.ret(VarcharType.SYSTEM_DEFAULT).args(DateTimeType.INSTANCE, VarcharType.SYSTEM_DEFAULT), FunctionSignature.ret(VarcharType.SYSTEM_DEFAULT).args(DateType.INSTANCE, VarcharType.SYSTEM_DEFAULT), - FunctionSignature.ret(VarcharType.SYSTEM_DEFAULT).args(DateTimeV2Type.INSTANCE, VarcharType.SYSTEM_DEFAULT), + FunctionSignature.ret(VarcharType.SYSTEM_DEFAULT) + .args(DateTimeV2Type.SYSTEM_DEFAULT, VarcharType.SYSTEM_DEFAULT), FunctionSignature.ret(VarcharType.SYSTEM_DEFAULT).args(DateV2Type.INSTANCE, VarcharType.SYSTEM_DEFAULT) ); diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/DateTrunc.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/DateTrunc.java index c0435f8ee2..583a7a7203 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/DateTrunc.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/DateTrunc.java @@ -40,7 +40,8 @@ public class DateTrunc extends ScalarFunction public static final List SIGNATURES = ImmutableList.of( FunctionSignature.ret(DateTimeType.INSTANCE).args(DateTimeType.INSTANCE, VarcharType.SYSTEM_DEFAULT), - FunctionSignature.ret(DateTimeV2Type.INSTANCE).args(DateTimeV2Type.INSTANCE, VarcharType.SYSTEM_DEFAULT) + FunctionSignature.ret(DateTimeV2Type.SYSTEM_DEFAULT) + .args(DateTimeV2Type.SYSTEM_DEFAULT, VarcharType.SYSTEM_DEFAULT) ); /** diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/DateV2.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/DateV2.java index b03dbc2de7..959ae0fa0f 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/DateV2.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/DateV2.java @@ -38,7 +38,7 @@ public class DateV2 extends ScalarFunction implements UnaryExpression, ExplicitlyCastableSignature, AlwaysNullable { public static final List SIGNATURES = ImmutableList.of( - FunctionSignature.ret(DateV2Type.INSTANCE).args(DateTimeV2Type.INSTANCE) + FunctionSignature.ret(DateV2Type.INSTANCE).args(DateTimeV2Type.SYSTEM_DEFAULT) ); /** diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/Day.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/Day.java index 66c0d63c91..aa3f697515 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/Day.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/Day.java @@ -41,7 +41,7 @@ public class Day extends ScalarFunction public static final List SIGNATURES = ImmutableList.of( FunctionSignature.ret(IntegerType.INSTANCE).args(DateTimeType.INSTANCE), - FunctionSignature.ret(IntegerType.INSTANCE).args(DateTimeV2Type.INSTANCE), + FunctionSignature.ret(IntegerType.INSTANCE).args(DateTimeV2Type.SYSTEM_DEFAULT), FunctionSignature.ret(IntegerType.INSTANCE).args(DateV2Type.INSTANCE) ); diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/DayCeil.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/DayCeil.java index fa0cd18401..dd39b0edaf 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/DayCeil.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/DayCeil.java @@ -40,18 +40,20 @@ public class DayCeil extends ScalarFunction public static final List SIGNATURES = ImmutableList.of( FunctionSignature.ret(DateTimeType.INSTANCE).args(DateTimeType.INSTANCE), - FunctionSignature.ret(DateTimeV2Type.INSTANCE).args(DateTimeV2Type.INSTANCE), + FunctionSignature.ret(DateTimeV2Type.SYSTEM_DEFAULT).args(DateTimeV2Type.SYSTEM_DEFAULT), FunctionSignature.ret(DateV2Type.INSTANCE).args(DateV2Type.INSTANCE), FunctionSignature.ret(DateTimeType.INSTANCE).args(DateTimeType.INSTANCE, DateTimeType.INSTANCE), FunctionSignature.ret(DateTimeType.INSTANCE).args(DateTimeType.INSTANCE, IntegerType.INSTANCE), - FunctionSignature.ret(DateTimeV2Type.INSTANCE).args(DateTimeV2Type.INSTANCE, DateTimeV2Type.INSTANCE), - FunctionSignature.ret(DateTimeV2Type.INSTANCE).args(DateTimeV2Type.INSTANCE, IntegerType.INSTANCE), + FunctionSignature.ret(DateTimeV2Type.SYSTEM_DEFAULT) + .args(DateTimeV2Type.SYSTEM_DEFAULT, DateTimeV2Type.SYSTEM_DEFAULT), + FunctionSignature.ret(DateTimeV2Type.SYSTEM_DEFAULT) + .args(DateTimeV2Type.SYSTEM_DEFAULT, IntegerType.INSTANCE), FunctionSignature.ret(DateV2Type.INSTANCE).args(DateV2Type.INSTANCE, DateV2Type.INSTANCE), FunctionSignature.ret(DateV2Type.INSTANCE).args(DateV2Type.INSTANCE, IntegerType.INSTANCE), FunctionSignature.ret(DateTimeType.INSTANCE) .args(DateTimeType.INSTANCE, IntegerType.INSTANCE, DateTimeType.INSTANCE), - FunctionSignature.ret(DateTimeV2Type.INSTANCE) - .args(DateTimeV2Type.INSTANCE, IntegerType.INSTANCE, DateTimeV2Type.INSTANCE), + FunctionSignature.ret(DateTimeV2Type.SYSTEM_DEFAULT) + .args(DateTimeV2Type.SYSTEM_DEFAULT, IntegerType.INSTANCE, DateTimeV2Type.SYSTEM_DEFAULT), FunctionSignature.ret(DateV2Type.INSTANCE) .args(DateV2Type.INSTANCE, IntegerType.INSTANCE, DateV2Type.INSTANCE) ); diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/DayFloor.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/DayFloor.java index a2044f9520..2e49e286af 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/DayFloor.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/DayFloor.java @@ -40,18 +40,20 @@ public class DayFloor extends ScalarFunction public static final List SIGNATURES = ImmutableList.of( FunctionSignature.ret(DateTimeType.INSTANCE).args(DateTimeType.INSTANCE), - FunctionSignature.ret(DateTimeV2Type.INSTANCE).args(DateTimeV2Type.INSTANCE), + FunctionSignature.ret(DateTimeV2Type.SYSTEM_DEFAULT).args(DateTimeV2Type.SYSTEM_DEFAULT), FunctionSignature.ret(DateV2Type.INSTANCE).args(DateV2Type.INSTANCE), FunctionSignature.ret(DateTimeType.INSTANCE).args(DateTimeType.INSTANCE, DateTimeType.INSTANCE), FunctionSignature.ret(DateTimeType.INSTANCE).args(DateTimeType.INSTANCE, IntegerType.INSTANCE), - FunctionSignature.ret(DateTimeV2Type.INSTANCE).args(DateTimeV2Type.INSTANCE, DateTimeV2Type.INSTANCE), - FunctionSignature.ret(DateTimeV2Type.INSTANCE).args(DateTimeV2Type.INSTANCE, IntegerType.INSTANCE), + FunctionSignature.ret(DateTimeV2Type.SYSTEM_DEFAULT) + .args(DateTimeV2Type.SYSTEM_DEFAULT, DateTimeV2Type.SYSTEM_DEFAULT), + FunctionSignature.ret(DateTimeV2Type.SYSTEM_DEFAULT) + .args(DateTimeV2Type.SYSTEM_DEFAULT, IntegerType.INSTANCE), FunctionSignature.ret(DateV2Type.INSTANCE).args(DateV2Type.INSTANCE, DateV2Type.INSTANCE), FunctionSignature.ret(DateV2Type.INSTANCE).args(DateV2Type.INSTANCE, IntegerType.INSTANCE), FunctionSignature.ret(DateTimeType.INSTANCE) .args(DateTimeType.INSTANCE, IntegerType.INSTANCE, DateTimeType.INSTANCE), - FunctionSignature.ret(DateTimeV2Type.INSTANCE) - .args(DateTimeV2Type.INSTANCE, IntegerType.INSTANCE, DateTimeV2Type.INSTANCE), + FunctionSignature.ret(DateTimeV2Type.SYSTEM_DEFAULT) + .args(DateTimeV2Type.SYSTEM_DEFAULT, IntegerType.INSTANCE, DateTimeV2Type.SYSTEM_DEFAULT), FunctionSignature.ret(DateV2Type.INSTANCE) .args(DateV2Type.INSTANCE, IntegerType.INSTANCE, DateV2Type.INSTANCE) ); diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/DayName.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/DayName.java index 34fe76ef2c..69cc04f7a4 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/DayName.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/DayName.java @@ -41,7 +41,7 @@ public class DayName extends ScalarFunction public static final List SIGNATURES = ImmutableList.of( FunctionSignature.ret(VarcharType.SYSTEM_DEFAULT).args(DateTimeType.INSTANCE), - FunctionSignature.ret(VarcharType.SYSTEM_DEFAULT).args(DateTimeV2Type.INSTANCE), + FunctionSignature.ret(VarcharType.SYSTEM_DEFAULT).args(DateTimeV2Type.SYSTEM_DEFAULT), FunctionSignature.ret(VarcharType.SYSTEM_DEFAULT).args(DateV2Type.INSTANCE) ); diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/DayOfMonth.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/DayOfMonth.java index 877a1a6e35..3a2f0d8ff5 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/DayOfMonth.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/DayOfMonth.java @@ -41,7 +41,7 @@ public class DayOfMonth extends ScalarFunction public static final List SIGNATURES = ImmutableList.of( FunctionSignature.ret(IntegerType.INSTANCE).args(DateTimeType.INSTANCE), - FunctionSignature.ret(IntegerType.INSTANCE).args(DateTimeV2Type.INSTANCE), + FunctionSignature.ret(IntegerType.INSTANCE).args(DateTimeV2Type.SYSTEM_DEFAULT), FunctionSignature.ret(IntegerType.INSTANCE).args(DateV2Type.INSTANCE) ); diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/DayOfWeek.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/DayOfWeek.java index 6b58420962..be6159aea2 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/DayOfWeek.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/DayOfWeek.java @@ -41,7 +41,7 @@ public class DayOfWeek extends ScalarFunction public static final List SIGNATURES = ImmutableList.of( FunctionSignature.ret(IntegerType.INSTANCE).args(DateTimeType.INSTANCE), - FunctionSignature.ret(IntegerType.INSTANCE).args(DateTimeV2Type.INSTANCE), + FunctionSignature.ret(IntegerType.INSTANCE).args(DateTimeV2Type.SYSTEM_DEFAULT), FunctionSignature.ret(IntegerType.INSTANCE).args(DateV2Type.INSTANCE) ); diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/DayOfYear.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/DayOfYear.java index 06560aaea7..29393fad3f 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/DayOfYear.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/DayOfYear.java @@ -41,7 +41,7 @@ public class DayOfYear extends ScalarFunction public static final List SIGNATURES = ImmutableList.of( FunctionSignature.ret(IntegerType.INSTANCE).args(DateTimeType.INSTANCE), - FunctionSignature.ret(IntegerType.INSTANCE).args(DateTimeV2Type.INSTANCE), + FunctionSignature.ret(IntegerType.INSTANCE).args(DateTimeV2Type.SYSTEM_DEFAULT), FunctionSignature.ret(IntegerType.INSTANCE).args(DateV2Type.INSTANCE) ); diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/DaysAdd.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/DaysAdd.java index c7bb1b8e09..6c6ddec38b 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/DaysAdd.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/DaysAdd.java @@ -40,7 +40,8 @@ import java.util.List; public class DaysAdd extends ScalarFunction implements BinaryExpression, ExplicitlyCastableSignature, AlwaysNullable { public static final List SIGNATURES = ImmutableList.of( FunctionSignature.ret(DateTimeType.INSTANCE).args(DateTimeType.INSTANCE, IntegerType.INSTANCE), - FunctionSignature.ret(DateTimeV2Type.INSTANCE).args(DateTimeV2Type.INSTANCE, IntegerType.INSTANCE), + FunctionSignature.ret(DateTimeV2Type.SYSTEM_DEFAULT) + .args(DateTimeV2Type.SYSTEM_DEFAULT, IntegerType.INSTANCE), FunctionSignature.ret(DateType.INSTANCE).args(DateType.INSTANCE, IntegerType.INSTANCE), FunctionSignature.ret(DateV2Type.INSTANCE).args(DateV2Type.INSTANCE, IntegerType.INSTANCE) ); diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/DaysDiff.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/DaysDiff.java index 41cdf8f59a..1490ee16a1 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/DaysDiff.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/DaysDiff.java @@ -41,14 +41,15 @@ public class DaysDiff extends ScalarFunction public static final List SIGNATURES = ImmutableList.of( FunctionSignature.ret(BigIntType.INSTANCE).args(DateTimeType.INSTANCE, DateTimeType.INSTANCE), - FunctionSignature.ret(BigIntType.INSTANCE).args(DateTimeV2Type.INSTANCE, DateTimeV2Type.INSTANCE), - FunctionSignature.ret(BigIntType.INSTANCE).args(DateV2Type.INSTANCE, DateTimeV2Type.INSTANCE), - FunctionSignature.ret(BigIntType.INSTANCE).args(DateTimeV2Type.INSTANCE, DateV2Type.INSTANCE), + FunctionSignature.ret(BigIntType.INSTANCE) + .args(DateTimeV2Type.SYSTEM_DEFAULT, DateTimeV2Type.SYSTEM_DEFAULT), + FunctionSignature.ret(BigIntType.INSTANCE).args(DateV2Type.INSTANCE, DateTimeV2Type.SYSTEM_DEFAULT), + FunctionSignature.ret(BigIntType.INSTANCE).args(DateTimeV2Type.SYSTEM_DEFAULT, DateV2Type.INSTANCE), FunctionSignature.ret(BigIntType.INSTANCE).args(DateV2Type.INSTANCE, DateV2Type.INSTANCE), FunctionSignature.ret(BigIntType.INSTANCE).args(DateV2Type.INSTANCE, DateTimeType.INSTANCE), FunctionSignature.ret(BigIntType.INSTANCE).args(DateTimeType.INSTANCE, DateV2Type.INSTANCE), - FunctionSignature.ret(BigIntType.INSTANCE).args(DateTimeV2Type.INSTANCE, DateTimeType.INSTANCE), - FunctionSignature.ret(BigIntType.INSTANCE).args(DateTimeType.INSTANCE, DateTimeV2Type.INSTANCE) + FunctionSignature.ret(BigIntType.INSTANCE).args(DateTimeV2Type.SYSTEM_DEFAULT, DateTimeType.INSTANCE), + FunctionSignature.ret(BigIntType.INSTANCE).args(DateTimeType.INSTANCE, DateTimeV2Type.SYSTEM_DEFAULT) ); /** diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/DaysSub.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/DaysSub.java index 001244f226..1eee01d762 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/DaysSub.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/DaysSub.java @@ -40,7 +40,8 @@ import java.util.List; public class DaysSub extends ScalarFunction implements BinaryExpression, ExplicitlyCastableSignature, AlwaysNullable { public static final List SIGNATURES = ImmutableList.of( FunctionSignature.ret(DateTimeType.INSTANCE).args(DateTimeType.INSTANCE, IntegerType.INSTANCE), - FunctionSignature.ret(DateTimeV2Type.INSTANCE).args(DateTimeV2Type.INSTANCE, IntegerType.INSTANCE), + FunctionSignature.ret(DateTimeV2Type.SYSTEM_DEFAULT) + .args(DateTimeV2Type.SYSTEM_DEFAULT, IntegerType.INSTANCE), FunctionSignature.ret(DateType.INSTANCE).args(DateType.INSTANCE, IntegerType.INSTANCE), FunctionSignature.ret(DateV2Type.INSTANCE).args(DateV2Type.INSTANCE, IntegerType.INSTANCE) ); diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/Greatest.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/Greatest.java index feda6bcb14..da98843cd8 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/Greatest.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/Greatest.java @@ -57,7 +57,7 @@ public class Greatest extends ScalarFunction FunctionSignature.ret(DoubleType.INSTANCE).varArgs(DoubleType.INSTANCE), FunctionSignature.ret(DecimalV2Type.SYSTEM_DEFAULT).varArgs(DecimalV2Type.SYSTEM_DEFAULT), FunctionSignature.ret(DateTimeType.INSTANCE).varArgs(DateTimeType.INSTANCE), - FunctionSignature.ret(DateTimeV2Type.INSTANCE).varArgs(DateTimeV2Type.INSTANCE), + FunctionSignature.ret(DateTimeV2Type.SYSTEM_DEFAULT).varArgs(DateTimeV2Type.SYSTEM_DEFAULT), FunctionSignature.ret(VarcharType.SYSTEM_DEFAULT).varArgs(VarcharType.SYSTEM_DEFAULT), FunctionSignature.ret(StringType.INSTANCE).varArgs(StringType.INSTANCE) ); diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/Hour.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/Hour.java index fcdcc3b33c..f965bc856a 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/Hour.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/Hour.java @@ -41,7 +41,7 @@ public class Hour extends ScalarFunction public static final List SIGNATURES = ImmutableList.of( FunctionSignature.ret(IntegerType.INSTANCE).args(DateTimeType.INSTANCE), - FunctionSignature.ret(IntegerType.INSTANCE).args(DateTimeV2Type.INSTANCE), + FunctionSignature.ret(IntegerType.INSTANCE).args(DateTimeV2Type.SYSTEM_DEFAULT), FunctionSignature.ret(IntegerType.INSTANCE).args(DateV2Type.INSTANCE) ); diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/HourCeil.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/HourCeil.java index 1ec2c82dbd..469ce67477 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/HourCeil.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/HourCeil.java @@ -40,19 +40,21 @@ public class HourCeil extends ScalarFunction public static final List SIGNATURES = ImmutableList.of( FunctionSignature.ret(DateTimeType.INSTANCE).args(DateTimeType.INSTANCE), - FunctionSignature.ret(DateTimeV2Type.INSTANCE).args(DateTimeV2Type.INSTANCE), - FunctionSignature.ret(DateTimeV2Type.INSTANCE).args(DateV2Type.INSTANCE), + FunctionSignature.ret(DateTimeV2Type.SYSTEM_DEFAULT).args(DateTimeV2Type.SYSTEM_DEFAULT), + FunctionSignature.ret(DateTimeV2Type.SYSTEM_DEFAULT).args(DateV2Type.INSTANCE), FunctionSignature.ret(DateTimeType.INSTANCE).args(DateTimeType.INSTANCE, DateTimeType.INSTANCE), FunctionSignature.ret(DateTimeType.INSTANCE).args(DateTimeType.INSTANCE, IntegerType.INSTANCE), - FunctionSignature.ret(DateTimeV2Type.INSTANCE).args(DateTimeV2Type.INSTANCE, DateTimeV2Type.INSTANCE), - FunctionSignature.ret(DateTimeV2Type.INSTANCE).args(DateTimeV2Type.INSTANCE, IntegerType.INSTANCE), - FunctionSignature.ret(DateTimeV2Type.INSTANCE).args(DateV2Type.INSTANCE, DateV2Type.INSTANCE), - FunctionSignature.ret(DateTimeV2Type.INSTANCE).args(DateV2Type.INSTANCE, IntegerType.INSTANCE), + FunctionSignature.ret(DateTimeV2Type.SYSTEM_DEFAULT) + .args(DateTimeV2Type.SYSTEM_DEFAULT, DateTimeV2Type.SYSTEM_DEFAULT), + FunctionSignature.ret(DateTimeV2Type.SYSTEM_DEFAULT) + .args(DateTimeV2Type.SYSTEM_DEFAULT, IntegerType.INSTANCE), + FunctionSignature.ret(DateTimeV2Type.SYSTEM_DEFAULT).args(DateV2Type.INSTANCE, DateV2Type.INSTANCE), + FunctionSignature.ret(DateTimeV2Type.SYSTEM_DEFAULT).args(DateV2Type.INSTANCE, IntegerType.INSTANCE), FunctionSignature.ret(DateTimeType.INSTANCE) .args(DateTimeType.INSTANCE, IntegerType.INSTANCE, DateTimeType.INSTANCE), - FunctionSignature.ret(DateTimeV2Type.INSTANCE) - .args(DateTimeV2Type.INSTANCE, IntegerType.INSTANCE, DateTimeV2Type.INSTANCE), - FunctionSignature.ret(DateTimeV2Type.INSTANCE) + FunctionSignature.ret(DateTimeV2Type.SYSTEM_DEFAULT) + .args(DateTimeV2Type.SYSTEM_DEFAULT, IntegerType.INSTANCE, DateTimeV2Type.SYSTEM_DEFAULT), + FunctionSignature.ret(DateTimeV2Type.SYSTEM_DEFAULT) .args(DateV2Type.INSTANCE, IntegerType.INSTANCE, DateV2Type.INSTANCE) ); diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/HourFloor.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/HourFloor.java index 1cf208205f..1252783ab7 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/HourFloor.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/HourFloor.java @@ -40,19 +40,21 @@ public class HourFloor extends ScalarFunction public static final List SIGNATURES = ImmutableList.of( FunctionSignature.ret(DateTimeType.INSTANCE).args(DateTimeType.INSTANCE), - FunctionSignature.ret(DateTimeV2Type.INSTANCE).args(DateTimeV2Type.INSTANCE), - FunctionSignature.ret(DateTimeV2Type.INSTANCE).args(DateV2Type.INSTANCE), + FunctionSignature.ret(DateTimeV2Type.SYSTEM_DEFAULT).args(DateTimeV2Type.SYSTEM_DEFAULT), + FunctionSignature.ret(DateTimeV2Type.SYSTEM_DEFAULT).args(DateV2Type.INSTANCE), FunctionSignature.ret(DateTimeType.INSTANCE).args(DateTimeType.INSTANCE, DateTimeType.INSTANCE), FunctionSignature.ret(DateTimeType.INSTANCE).args(DateTimeType.INSTANCE, IntegerType.INSTANCE), - FunctionSignature.ret(DateTimeV2Type.INSTANCE).args(DateTimeV2Type.INSTANCE, DateTimeV2Type.INSTANCE), - FunctionSignature.ret(DateTimeV2Type.INSTANCE).args(DateTimeV2Type.INSTANCE, IntegerType.INSTANCE), - FunctionSignature.ret(DateTimeV2Type.INSTANCE).args(DateV2Type.INSTANCE, DateV2Type.INSTANCE), - FunctionSignature.ret(DateTimeV2Type.INSTANCE).args(DateV2Type.INSTANCE, IntegerType.INSTANCE), + FunctionSignature.ret(DateTimeV2Type.SYSTEM_DEFAULT) + .args(DateTimeV2Type.SYSTEM_DEFAULT, DateTimeV2Type.SYSTEM_DEFAULT), + FunctionSignature.ret(DateTimeV2Type.SYSTEM_DEFAULT) + .args(DateTimeV2Type.SYSTEM_DEFAULT, IntegerType.INSTANCE), + FunctionSignature.ret(DateTimeV2Type.SYSTEM_DEFAULT).args(DateV2Type.INSTANCE, DateV2Type.INSTANCE), + FunctionSignature.ret(DateTimeV2Type.SYSTEM_DEFAULT).args(DateV2Type.INSTANCE, IntegerType.INSTANCE), FunctionSignature.ret(DateTimeType.INSTANCE) .args(DateTimeType.INSTANCE, IntegerType.INSTANCE, DateTimeType.INSTANCE), - FunctionSignature.ret(DateTimeV2Type.INSTANCE) - .args(DateTimeV2Type.INSTANCE, IntegerType.INSTANCE, DateTimeV2Type.INSTANCE), - FunctionSignature.ret(DateTimeV2Type.INSTANCE) + FunctionSignature.ret(DateTimeV2Type.SYSTEM_DEFAULT) + .args(DateTimeV2Type.SYSTEM_DEFAULT, IntegerType.INSTANCE, DateTimeV2Type.SYSTEM_DEFAULT), + FunctionSignature.ret(DateTimeV2Type.SYSTEM_DEFAULT) .args(DateV2Type.INSTANCE, IntegerType.INSTANCE, DateV2Type.INSTANCE) ); diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/HoursAdd.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/HoursAdd.java index 0c4820b52d..f562237f1f 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/HoursAdd.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/HoursAdd.java @@ -40,9 +40,10 @@ import java.util.List; public class HoursAdd extends ScalarFunction implements BinaryExpression, ExplicitlyCastableSignature, AlwaysNullable { public static final List SIGNATURES = ImmutableList.of( FunctionSignature.ret(DateTimeType.INSTANCE).args(DateTimeType.INSTANCE, IntegerType.INSTANCE), - FunctionSignature.ret(DateTimeV2Type.INSTANCE).args(DateTimeV2Type.INSTANCE, IntegerType.INSTANCE), + FunctionSignature.ret(DateTimeV2Type.SYSTEM_DEFAULT) + .args(DateTimeV2Type.SYSTEM_DEFAULT, IntegerType.INSTANCE), FunctionSignature.ret(DateTimeType.INSTANCE).args(DateType.INSTANCE, IntegerType.INSTANCE), - FunctionSignature.ret(DateTimeV2Type.INSTANCE).args(DateV2Type.INSTANCE, IntegerType.INSTANCE) + FunctionSignature.ret(DateTimeV2Type.SYSTEM_DEFAULT).args(DateV2Type.INSTANCE, IntegerType.INSTANCE) ); public HoursAdd(Expression arg0, Expression arg1) { diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/HoursDiff.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/HoursDiff.java index 245d5ee528..8c1ab99b91 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/HoursDiff.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/HoursDiff.java @@ -41,14 +41,15 @@ public class HoursDiff extends ScalarFunction public static final List SIGNATURES = ImmutableList.of( FunctionSignature.ret(BigIntType.INSTANCE).args(DateTimeType.INSTANCE, DateTimeType.INSTANCE), - FunctionSignature.ret(BigIntType.INSTANCE).args(DateTimeV2Type.INSTANCE, DateTimeV2Type.INSTANCE), - FunctionSignature.ret(BigIntType.INSTANCE).args(DateV2Type.INSTANCE, DateTimeV2Type.INSTANCE), - FunctionSignature.ret(BigIntType.INSTANCE).args(DateTimeV2Type.INSTANCE, DateV2Type.INSTANCE), + FunctionSignature.ret(BigIntType.INSTANCE) + .args(DateTimeV2Type.SYSTEM_DEFAULT, DateTimeV2Type.SYSTEM_DEFAULT), + FunctionSignature.ret(BigIntType.INSTANCE).args(DateV2Type.INSTANCE, DateTimeV2Type.SYSTEM_DEFAULT), + FunctionSignature.ret(BigIntType.INSTANCE).args(DateTimeV2Type.SYSTEM_DEFAULT, DateV2Type.INSTANCE), FunctionSignature.ret(BigIntType.INSTANCE).args(DateV2Type.INSTANCE, DateV2Type.INSTANCE), FunctionSignature.ret(BigIntType.INSTANCE).args(DateV2Type.INSTANCE, DateTimeType.INSTANCE), FunctionSignature.ret(BigIntType.INSTANCE).args(DateTimeType.INSTANCE, DateV2Type.INSTANCE), - FunctionSignature.ret(BigIntType.INSTANCE).args(DateTimeV2Type.INSTANCE, DateTimeType.INSTANCE), - FunctionSignature.ret(BigIntType.INSTANCE).args(DateTimeType.INSTANCE, DateTimeV2Type.INSTANCE) + FunctionSignature.ret(BigIntType.INSTANCE).args(DateTimeV2Type.SYSTEM_DEFAULT, DateTimeType.INSTANCE), + FunctionSignature.ret(BigIntType.INSTANCE).args(DateTimeType.INSTANCE, DateTimeV2Type.SYSTEM_DEFAULT) ); /** diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/HoursSub.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/HoursSub.java index cab530fa54..3baa868869 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/HoursSub.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/HoursSub.java @@ -40,9 +40,10 @@ import java.util.List; public class HoursSub extends ScalarFunction implements BinaryExpression, ExplicitlyCastableSignature, AlwaysNullable { public static final List SIGNATURES = ImmutableList.of( FunctionSignature.ret(DateTimeType.INSTANCE).args(DateTimeType.INSTANCE, IntegerType.INSTANCE), - FunctionSignature.ret(DateTimeV2Type.INSTANCE).args(DateTimeV2Type.INSTANCE, IntegerType.INSTANCE), + FunctionSignature.ret(DateTimeV2Type.SYSTEM_DEFAULT) + .args(DateTimeV2Type.SYSTEM_DEFAULT, IntegerType.INSTANCE), FunctionSignature.ret(DateTimeType.INSTANCE).args(DateType.INSTANCE, IntegerType.INSTANCE), - FunctionSignature.ret(DateTimeV2Type.INSTANCE).args(DateV2Type.INSTANCE, IntegerType.INSTANCE) + FunctionSignature.ret(DateTimeV2Type.SYSTEM_DEFAULT).args(DateV2Type.INSTANCE, IntegerType.INSTANCE) ); public HoursSub(Expression arg0, Expression arg1) { diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/If.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/If.java index 9d4273c290..b17dcd97e5 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/If.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/If.java @@ -75,8 +75,8 @@ public class If extends ScalarFunction FunctionSignature.ret(DateTimeType.INSTANCE) .args(BooleanType.INSTANCE, DateTimeType.INSTANCE, DateTimeType.INSTANCE), FunctionSignature.ret(DateType.INSTANCE).args(BooleanType.INSTANCE, DateType.INSTANCE, DateType.INSTANCE), - FunctionSignature.ret(DateTimeV2Type.INSTANCE) - .args(BooleanType.INSTANCE, DateTimeV2Type.INSTANCE, DateTimeV2Type.INSTANCE), + FunctionSignature.ret(DateTimeV2Type.SYSTEM_DEFAULT) + .args(BooleanType.INSTANCE, DateTimeV2Type.SYSTEM_DEFAULT, DateTimeV2Type.SYSTEM_DEFAULT), FunctionSignature.ret(DateV2Type.INSTANCE) .args(BooleanType.INSTANCE, DateV2Type.INSTANCE, DateV2Type.INSTANCE), FunctionSignature.ret(DecimalV2Type.SYSTEM_DEFAULT) diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/LocalTime.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/LocalTime.java index 4d2c29b3a1..e58dfe1a7f 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/LocalTime.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/LocalTime.java @@ -41,7 +41,7 @@ public class LocalTime extends DateTimeWithPrecision public static final List SIGNATURES = ImmutableList.of( FunctionSignature.ret(DateTimeType.INSTANCE).args(), - FunctionSignature.ret(DateTimeV2Type.INSTANCE).args(IntegerType.INSTANCE) + FunctionSignature.ret(DateTimeV2Type.SYSTEM_DEFAULT).args(IntegerType.INSTANCE) ); /** diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/LocalTimestamp.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/LocalTimestamp.java index e84ab28e27..ce84578746 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/LocalTimestamp.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/LocalTimestamp.java @@ -41,7 +41,7 @@ public class LocalTimestamp extends DateTimeWithPrecision public static final List SIGNATURES = ImmutableList.of( FunctionSignature.ret(DateTimeType.INSTANCE).args(), - FunctionSignature.ret(DateTimeV2Type.INSTANCE).args(IntegerType.INSTANCE) + FunctionSignature.ret(DateTimeV2Type.SYSTEM_DEFAULT).args(IntegerType.INSTANCE) ); /** diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/Minute.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/Minute.java index 8749892774..9150058e2d 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/Minute.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/Minute.java @@ -41,7 +41,7 @@ public class Minute extends ScalarFunction public static final List SIGNATURES = ImmutableList.of( FunctionSignature.ret(IntegerType.INSTANCE).args(DateTimeType.INSTANCE), - FunctionSignature.ret(IntegerType.INSTANCE).args(DateTimeV2Type.INSTANCE), + FunctionSignature.ret(IntegerType.INSTANCE).args(DateTimeV2Type.SYSTEM_DEFAULT), FunctionSignature.ret(IntegerType.INSTANCE).args(DateV2Type.INSTANCE) ); diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/MinuteCeil.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/MinuteCeil.java index dedc4c7afe..1e3a7e04a7 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/MinuteCeil.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/MinuteCeil.java @@ -40,19 +40,21 @@ public class MinuteCeil extends ScalarFunction public static final List SIGNATURES = ImmutableList.of( FunctionSignature.ret(DateTimeType.INSTANCE).args(DateTimeType.INSTANCE), - FunctionSignature.ret(DateTimeV2Type.INSTANCE).args(DateTimeV2Type.INSTANCE), - FunctionSignature.ret(DateTimeV2Type.INSTANCE).args(DateV2Type.INSTANCE), + FunctionSignature.ret(DateTimeV2Type.SYSTEM_DEFAULT).args(DateTimeV2Type.SYSTEM_DEFAULT), + FunctionSignature.ret(DateTimeV2Type.SYSTEM_DEFAULT).args(DateV2Type.INSTANCE), FunctionSignature.ret(DateTimeType.INSTANCE).args(DateTimeType.INSTANCE, DateTimeType.INSTANCE), FunctionSignature.ret(DateTimeType.INSTANCE).args(DateTimeType.INSTANCE, IntegerType.INSTANCE), - FunctionSignature.ret(DateTimeV2Type.INSTANCE).args(DateTimeV2Type.INSTANCE, DateTimeV2Type.INSTANCE), - FunctionSignature.ret(DateTimeV2Type.INSTANCE).args(DateTimeV2Type.INSTANCE, IntegerType.INSTANCE), - FunctionSignature.ret(DateTimeV2Type.INSTANCE).args(DateV2Type.INSTANCE, DateV2Type.INSTANCE), - FunctionSignature.ret(DateTimeV2Type.INSTANCE).args(DateV2Type.INSTANCE, IntegerType.INSTANCE), + FunctionSignature.ret(DateTimeV2Type.SYSTEM_DEFAULT) + .args(DateTimeV2Type.SYSTEM_DEFAULT, DateTimeV2Type.SYSTEM_DEFAULT), + FunctionSignature.ret(DateTimeV2Type.SYSTEM_DEFAULT) + .args(DateTimeV2Type.SYSTEM_DEFAULT, IntegerType.INSTANCE), + FunctionSignature.ret(DateTimeV2Type.SYSTEM_DEFAULT).args(DateV2Type.INSTANCE, DateV2Type.INSTANCE), + FunctionSignature.ret(DateTimeV2Type.SYSTEM_DEFAULT).args(DateV2Type.INSTANCE, IntegerType.INSTANCE), FunctionSignature.ret(DateTimeType.INSTANCE) .args(DateTimeType.INSTANCE, IntegerType.INSTANCE, DateTimeType.INSTANCE), - FunctionSignature.ret(DateTimeV2Type.INSTANCE) - .args(DateTimeV2Type.INSTANCE, IntegerType.INSTANCE, DateTimeV2Type.INSTANCE), - FunctionSignature.ret(DateTimeV2Type.INSTANCE) + FunctionSignature.ret(DateTimeV2Type.SYSTEM_DEFAULT) + .args(DateTimeV2Type.SYSTEM_DEFAULT, IntegerType.INSTANCE, DateTimeV2Type.SYSTEM_DEFAULT), + FunctionSignature.ret(DateTimeV2Type.SYSTEM_DEFAULT) .args(DateV2Type.INSTANCE, IntegerType.INSTANCE, DateV2Type.INSTANCE) ); diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/MinuteFloor.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/MinuteFloor.java index e999d6193a..4e0bf57362 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/MinuteFloor.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/MinuteFloor.java @@ -40,19 +40,21 @@ public class MinuteFloor extends ScalarFunction public static final List SIGNATURES = ImmutableList.of( FunctionSignature.ret(DateTimeType.INSTANCE).args(DateTimeType.INSTANCE), - FunctionSignature.ret(DateTimeV2Type.INSTANCE).args(DateTimeV2Type.INSTANCE), - FunctionSignature.ret(DateTimeV2Type.INSTANCE).args(DateV2Type.INSTANCE), + FunctionSignature.ret(DateTimeV2Type.SYSTEM_DEFAULT).args(DateTimeV2Type.SYSTEM_DEFAULT), + FunctionSignature.ret(DateTimeV2Type.SYSTEM_DEFAULT).args(DateV2Type.INSTANCE), FunctionSignature.ret(DateTimeType.INSTANCE).args(DateTimeType.INSTANCE, DateTimeType.INSTANCE), FunctionSignature.ret(DateTimeType.INSTANCE).args(DateTimeType.INSTANCE, IntegerType.INSTANCE), - FunctionSignature.ret(DateTimeV2Type.INSTANCE).args(DateTimeV2Type.INSTANCE, DateTimeV2Type.INSTANCE), - FunctionSignature.ret(DateTimeV2Type.INSTANCE).args(DateTimeV2Type.INSTANCE, IntegerType.INSTANCE), - FunctionSignature.ret(DateTimeV2Type.INSTANCE).args(DateV2Type.INSTANCE, DateV2Type.INSTANCE), - FunctionSignature.ret(DateTimeV2Type.INSTANCE).args(DateV2Type.INSTANCE, IntegerType.INSTANCE), + FunctionSignature.ret(DateTimeV2Type.SYSTEM_DEFAULT) + .args(DateTimeV2Type.SYSTEM_DEFAULT, DateTimeV2Type.SYSTEM_DEFAULT), + FunctionSignature.ret(DateTimeV2Type.SYSTEM_DEFAULT) + .args(DateTimeV2Type.SYSTEM_DEFAULT, IntegerType.INSTANCE), + FunctionSignature.ret(DateTimeV2Type.SYSTEM_DEFAULT).args(DateV2Type.INSTANCE, DateV2Type.INSTANCE), + FunctionSignature.ret(DateTimeV2Type.SYSTEM_DEFAULT).args(DateV2Type.INSTANCE, IntegerType.INSTANCE), FunctionSignature.ret(DateTimeType.INSTANCE) .args(DateTimeType.INSTANCE, IntegerType.INSTANCE, DateTimeType.INSTANCE), - FunctionSignature.ret(DateTimeV2Type.INSTANCE) - .args(DateTimeV2Type.INSTANCE, IntegerType.INSTANCE, DateTimeV2Type.INSTANCE), - FunctionSignature.ret(DateTimeV2Type.INSTANCE) + FunctionSignature.ret(DateTimeV2Type.SYSTEM_DEFAULT) + .args(DateTimeV2Type.SYSTEM_DEFAULT, IntegerType.INSTANCE, DateTimeV2Type.SYSTEM_DEFAULT), + FunctionSignature.ret(DateTimeV2Type.SYSTEM_DEFAULT) .args(DateV2Type.INSTANCE, IntegerType.INSTANCE, DateV2Type.INSTANCE) ); diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/MinutesAdd.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/MinutesAdd.java index 8dbf28a6bc..e8856e9699 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/MinutesAdd.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/MinutesAdd.java @@ -41,9 +41,10 @@ public class MinutesAdd extends ScalarFunction implements BinaryExpression, ExplicitlyCastableSignature, AlwaysNullable { public static final List SIGNATURES = ImmutableList.of( FunctionSignature.ret(DateTimeType.INSTANCE).args(DateTimeType.INSTANCE, IntegerType.INSTANCE), - FunctionSignature.ret(DateTimeV2Type.INSTANCE).args(DateTimeV2Type.INSTANCE, IntegerType.INSTANCE), + FunctionSignature.ret(DateTimeV2Type.SYSTEM_DEFAULT) + .args(DateTimeV2Type.SYSTEM_DEFAULT, IntegerType.INSTANCE), FunctionSignature.ret(DateTimeType.INSTANCE).args(DateType.INSTANCE, IntegerType.INSTANCE), - FunctionSignature.ret(DateTimeV2Type.INSTANCE).args(DateV2Type.INSTANCE, IntegerType.INSTANCE) + FunctionSignature.ret(DateTimeV2Type.SYSTEM_DEFAULT).args(DateV2Type.INSTANCE, IntegerType.INSTANCE) ); public MinutesAdd(Expression arg0, Expression arg1) { diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/MinutesDiff.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/MinutesDiff.java index d01d84b00c..dde202929c 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/MinutesDiff.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/MinutesDiff.java @@ -41,14 +41,15 @@ public class MinutesDiff extends ScalarFunction public static final List SIGNATURES = ImmutableList.of( FunctionSignature.ret(BigIntType.INSTANCE).args(DateTimeType.INSTANCE, DateTimeType.INSTANCE), - FunctionSignature.ret(BigIntType.INSTANCE).args(DateTimeV2Type.INSTANCE, DateTimeV2Type.INSTANCE), - FunctionSignature.ret(BigIntType.INSTANCE).args(DateV2Type.INSTANCE, DateTimeV2Type.INSTANCE), - FunctionSignature.ret(BigIntType.INSTANCE).args(DateTimeV2Type.INSTANCE, DateV2Type.INSTANCE), + FunctionSignature.ret(BigIntType.INSTANCE) + .args(DateTimeV2Type.SYSTEM_DEFAULT, DateTimeV2Type.SYSTEM_DEFAULT), + FunctionSignature.ret(BigIntType.INSTANCE).args(DateV2Type.INSTANCE, DateTimeV2Type.SYSTEM_DEFAULT), + FunctionSignature.ret(BigIntType.INSTANCE).args(DateTimeV2Type.SYSTEM_DEFAULT, DateV2Type.INSTANCE), FunctionSignature.ret(BigIntType.INSTANCE).args(DateV2Type.INSTANCE, DateV2Type.INSTANCE), FunctionSignature.ret(BigIntType.INSTANCE).args(DateV2Type.INSTANCE, DateTimeType.INSTANCE), FunctionSignature.ret(BigIntType.INSTANCE).args(DateTimeType.INSTANCE, DateV2Type.INSTANCE), - FunctionSignature.ret(BigIntType.INSTANCE).args(DateTimeV2Type.INSTANCE, DateTimeType.INSTANCE), - FunctionSignature.ret(BigIntType.INSTANCE).args(DateTimeType.INSTANCE, DateTimeV2Type.INSTANCE) + FunctionSignature.ret(BigIntType.INSTANCE).args(DateTimeV2Type.SYSTEM_DEFAULT, DateTimeType.INSTANCE), + FunctionSignature.ret(BigIntType.INSTANCE).args(DateTimeType.INSTANCE, DateTimeV2Type.SYSTEM_DEFAULT) ); /** diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/MinutesSub.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/MinutesSub.java index 8733843dea..6efae1ce19 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/MinutesSub.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/MinutesSub.java @@ -41,9 +41,10 @@ public class MinutesSub extends ScalarFunction implements BinaryExpression, ExplicitlyCastableSignature, AlwaysNullable { public static final List SIGNATURES = ImmutableList.of( FunctionSignature.ret(DateTimeType.INSTANCE).args(DateTimeType.INSTANCE, IntegerType.INSTANCE), - FunctionSignature.ret(DateTimeV2Type.INSTANCE).args(DateTimeV2Type.INSTANCE, IntegerType.INSTANCE), + FunctionSignature.ret(DateTimeV2Type.SYSTEM_DEFAULT) + .args(DateTimeV2Type.SYSTEM_DEFAULT, IntegerType.INSTANCE), FunctionSignature.ret(DateTimeType.INSTANCE).args(DateType.INSTANCE, IntegerType.INSTANCE), - FunctionSignature.ret(DateTimeV2Type.INSTANCE).args(DateV2Type.INSTANCE, IntegerType.INSTANCE) + FunctionSignature.ret(DateTimeV2Type.SYSTEM_DEFAULT).args(DateV2Type.INSTANCE, IntegerType.INSTANCE) ); public MinutesSub(Expression arg0, Expression arg1) { diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/Month.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/Month.java index 0301e4b39a..adbe46c97b 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/Month.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/Month.java @@ -41,7 +41,7 @@ public class Month extends ScalarFunction public static final List SIGNATURES = ImmutableList.of( FunctionSignature.ret(IntegerType.INSTANCE).args(DateTimeType.INSTANCE), - FunctionSignature.ret(IntegerType.INSTANCE).args(DateTimeV2Type.INSTANCE), + FunctionSignature.ret(IntegerType.INSTANCE).args(DateTimeV2Type.SYSTEM_DEFAULT), FunctionSignature.ret(IntegerType.INSTANCE).args(DateV2Type.INSTANCE) ); diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/MonthCeil.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/MonthCeil.java index 5c4eb8719c..d05a82a3c7 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/MonthCeil.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/MonthCeil.java @@ -40,18 +40,20 @@ public class MonthCeil extends ScalarFunction public static final List SIGNATURES = ImmutableList.of( FunctionSignature.ret(DateTimeType.INSTANCE).args(DateTimeType.INSTANCE), - FunctionSignature.ret(DateTimeV2Type.INSTANCE).args(DateTimeV2Type.INSTANCE), + FunctionSignature.ret(DateTimeV2Type.SYSTEM_DEFAULT).args(DateTimeV2Type.SYSTEM_DEFAULT), FunctionSignature.ret(DateV2Type.INSTANCE).args(DateV2Type.INSTANCE), FunctionSignature.ret(DateTimeType.INSTANCE).args(DateTimeType.INSTANCE, DateTimeType.INSTANCE), FunctionSignature.ret(DateTimeType.INSTANCE).args(DateTimeType.INSTANCE, IntegerType.INSTANCE), - FunctionSignature.ret(DateTimeV2Type.INSTANCE).args(DateTimeV2Type.INSTANCE, DateTimeV2Type.INSTANCE), - FunctionSignature.ret(DateTimeV2Type.INSTANCE).args(DateTimeV2Type.INSTANCE, IntegerType.INSTANCE), + FunctionSignature.ret(DateTimeV2Type.SYSTEM_DEFAULT) + .args(DateTimeV2Type.SYSTEM_DEFAULT, DateTimeV2Type.SYSTEM_DEFAULT), + FunctionSignature.ret(DateTimeV2Type.SYSTEM_DEFAULT) + .args(DateTimeV2Type.SYSTEM_DEFAULT, IntegerType.INSTANCE), FunctionSignature.ret(DateV2Type.INSTANCE).args(DateV2Type.INSTANCE, DateV2Type.INSTANCE), FunctionSignature.ret(DateV2Type.INSTANCE).args(DateV2Type.INSTANCE, IntegerType.INSTANCE), FunctionSignature.ret(DateTimeType.INSTANCE) .args(DateTimeType.INSTANCE, IntegerType.INSTANCE, DateTimeType.INSTANCE), - FunctionSignature.ret(DateTimeV2Type.INSTANCE) - .args(DateTimeV2Type.INSTANCE, IntegerType.INSTANCE, DateTimeV2Type.INSTANCE), + FunctionSignature.ret(DateTimeV2Type.SYSTEM_DEFAULT) + .args(DateTimeV2Type.SYSTEM_DEFAULT, IntegerType.INSTANCE, DateTimeV2Type.SYSTEM_DEFAULT), FunctionSignature.ret(DateV2Type.INSTANCE) .args(DateV2Type.INSTANCE, IntegerType.INSTANCE, DateV2Type.INSTANCE) ); diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/MonthFloor.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/MonthFloor.java index a414771b07..9fe8465144 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/MonthFloor.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/MonthFloor.java @@ -40,18 +40,20 @@ public class MonthFloor extends ScalarFunction public static final List SIGNATURES = ImmutableList.of( FunctionSignature.ret(DateTimeType.INSTANCE).args(DateTimeType.INSTANCE), - FunctionSignature.ret(DateTimeV2Type.INSTANCE).args(DateTimeV2Type.INSTANCE), + FunctionSignature.ret(DateTimeV2Type.SYSTEM_DEFAULT).args(DateTimeV2Type.SYSTEM_DEFAULT), FunctionSignature.ret(DateV2Type.INSTANCE).args(DateV2Type.INSTANCE), FunctionSignature.ret(DateTimeType.INSTANCE).args(DateTimeType.INSTANCE, DateTimeType.INSTANCE), FunctionSignature.ret(DateTimeType.INSTANCE).args(DateTimeType.INSTANCE, IntegerType.INSTANCE), - FunctionSignature.ret(DateTimeV2Type.INSTANCE).args(DateTimeV2Type.INSTANCE, DateTimeV2Type.INSTANCE), - FunctionSignature.ret(DateTimeV2Type.INSTANCE).args(DateTimeV2Type.INSTANCE, IntegerType.INSTANCE), + FunctionSignature.ret(DateTimeV2Type.SYSTEM_DEFAULT) + .args(DateTimeV2Type.SYSTEM_DEFAULT, DateTimeV2Type.SYSTEM_DEFAULT), + FunctionSignature.ret(DateTimeV2Type.SYSTEM_DEFAULT) + .args(DateTimeV2Type.SYSTEM_DEFAULT, IntegerType.INSTANCE), FunctionSignature.ret(DateV2Type.INSTANCE).args(DateV2Type.INSTANCE, DateV2Type.INSTANCE), FunctionSignature.ret(DateV2Type.INSTANCE).args(DateV2Type.INSTANCE, IntegerType.INSTANCE), FunctionSignature.ret(DateTimeType.INSTANCE) .args(DateTimeType.INSTANCE, IntegerType.INSTANCE, DateTimeType.INSTANCE), - FunctionSignature.ret(DateTimeV2Type.INSTANCE) - .args(DateTimeV2Type.INSTANCE, IntegerType.INSTANCE, DateTimeV2Type.INSTANCE), + FunctionSignature.ret(DateTimeV2Type.SYSTEM_DEFAULT) + .args(DateTimeV2Type.SYSTEM_DEFAULT, IntegerType.INSTANCE, DateTimeV2Type.SYSTEM_DEFAULT), FunctionSignature.ret(DateV2Type.INSTANCE) .args(DateV2Type.INSTANCE, IntegerType.INSTANCE, DateV2Type.INSTANCE) ); diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/MonthName.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/MonthName.java index 680ae0a91a..b1286a7760 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/MonthName.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/MonthName.java @@ -41,7 +41,7 @@ public class MonthName extends ScalarFunction public static final List SIGNATURES = ImmutableList.of( FunctionSignature.ret(VarcharType.SYSTEM_DEFAULT).args(DateTimeType.INSTANCE), - FunctionSignature.ret(VarcharType.SYSTEM_DEFAULT).args(DateTimeV2Type.INSTANCE), + FunctionSignature.ret(VarcharType.SYSTEM_DEFAULT).args(DateTimeV2Type.SYSTEM_DEFAULT), FunctionSignature.ret(VarcharType.SYSTEM_DEFAULT).args(DateV2Type.INSTANCE) ); diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/MonthsAdd.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/MonthsAdd.java index 4cfc73454e..87f96e65a0 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/MonthsAdd.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/MonthsAdd.java @@ -41,7 +41,8 @@ public class MonthsAdd extends ScalarFunction implements BinaryExpression, ExplicitlyCastableSignature, AlwaysNullable { public static final List SIGNATURES = ImmutableList.of( FunctionSignature.ret(DateTimeType.INSTANCE).args(DateTimeType.INSTANCE, IntegerType.INSTANCE), - FunctionSignature.ret(DateTimeV2Type.INSTANCE).args(DateTimeV2Type.INSTANCE, IntegerType.INSTANCE), + FunctionSignature.ret(DateTimeV2Type.SYSTEM_DEFAULT) + .args(DateTimeV2Type.SYSTEM_DEFAULT, IntegerType.INSTANCE), FunctionSignature.ret(DateType.INSTANCE).args(DateType.INSTANCE, IntegerType.INSTANCE), FunctionSignature.ret(DateV2Type.INSTANCE).args(DateV2Type.INSTANCE, IntegerType.INSTANCE) ); diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/MonthsDiff.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/MonthsDiff.java index 20d6f3847e..20049c2ac8 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/MonthsDiff.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/MonthsDiff.java @@ -41,14 +41,15 @@ public class MonthsDiff extends ScalarFunction public static final List SIGNATURES = ImmutableList.of( FunctionSignature.ret(BigIntType.INSTANCE).args(DateTimeType.INSTANCE, DateTimeType.INSTANCE), - FunctionSignature.ret(BigIntType.INSTANCE).args(DateTimeV2Type.INSTANCE, DateTimeV2Type.INSTANCE), - FunctionSignature.ret(BigIntType.INSTANCE).args(DateV2Type.INSTANCE, DateTimeV2Type.INSTANCE), - FunctionSignature.ret(BigIntType.INSTANCE).args(DateTimeV2Type.INSTANCE, DateV2Type.INSTANCE), + FunctionSignature.ret(BigIntType.INSTANCE) + .args(DateTimeV2Type.SYSTEM_DEFAULT, DateTimeV2Type.SYSTEM_DEFAULT), + FunctionSignature.ret(BigIntType.INSTANCE).args(DateV2Type.INSTANCE, DateTimeV2Type.SYSTEM_DEFAULT), + FunctionSignature.ret(BigIntType.INSTANCE).args(DateTimeV2Type.SYSTEM_DEFAULT, DateV2Type.INSTANCE), FunctionSignature.ret(BigIntType.INSTANCE).args(DateV2Type.INSTANCE, DateV2Type.INSTANCE), FunctionSignature.ret(BigIntType.INSTANCE).args(DateV2Type.INSTANCE, DateTimeType.INSTANCE), FunctionSignature.ret(BigIntType.INSTANCE).args(DateTimeType.INSTANCE, DateV2Type.INSTANCE), - FunctionSignature.ret(BigIntType.INSTANCE).args(DateTimeV2Type.INSTANCE, DateTimeType.INSTANCE), - FunctionSignature.ret(BigIntType.INSTANCE).args(DateTimeType.INSTANCE, DateTimeV2Type.INSTANCE) + FunctionSignature.ret(BigIntType.INSTANCE).args(DateTimeV2Type.SYSTEM_DEFAULT, DateTimeType.INSTANCE), + FunctionSignature.ret(BigIntType.INSTANCE).args(DateTimeType.INSTANCE, DateTimeV2Type.SYSTEM_DEFAULT) ); /** diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/MonthsSub.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/MonthsSub.java index 10df4e2195..26a6d69cfa 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/MonthsSub.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/MonthsSub.java @@ -40,7 +40,8 @@ import java.util.List; public class MonthsSub extends ScalarFunction implements BinaryExpression, ExplicitlyCastableSignature, AlwaysNullable { public static final List SIGNATURES = ImmutableList.of( FunctionSignature.ret(DateTimeType.INSTANCE).args(DateTimeType.INSTANCE, IntegerType.INSTANCE), - FunctionSignature.ret(DateTimeV2Type.INSTANCE).args(DateTimeV2Type.INSTANCE, IntegerType.INSTANCE), + FunctionSignature.ret(DateTimeV2Type.SYSTEM_DEFAULT) + .args(DateTimeV2Type.SYSTEM_DEFAULT, IntegerType.INSTANCE), FunctionSignature.ret(DateType.INSTANCE).args(DateType.INSTANCE, IntegerType.INSTANCE), FunctionSignature.ret(DateV2Type.INSTANCE).args(DateV2Type.INSTANCE, IntegerType.INSTANCE) ); diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/Now.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/Now.java index e8d603262d..e8f1bba59d 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/Now.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/Now.java @@ -41,7 +41,7 @@ public class Now extends DateTimeWithPrecision public static final List SIGNATURES = ImmutableList.of( FunctionSignature.ret(DateTimeType.INSTANCE).args(), - FunctionSignature.ret(DateTimeV2Type.INSTANCE).args(IntegerType.INSTANCE) + FunctionSignature.ret(DateTimeV2Type.SYSTEM_DEFAULT).args(IntegerType.INSTANCE) ); /** diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/NullIf.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/NullIf.java index 2f22b8ac82..6aaf8be9cc 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/NullIf.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/NullIf.java @@ -61,7 +61,8 @@ public class NullIf extends ScalarFunction FunctionSignature.ret(DoubleType.INSTANCE).args(DoubleType.INSTANCE, DoubleType.INSTANCE), FunctionSignature.ret(DateTimeType.INSTANCE).args(DateTimeType.INSTANCE, DateTimeType.INSTANCE), FunctionSignature.ret(DateType.INSTANCE).args(DateType.INSTANCE, DateType.INSTANCE), - FunctionSignature.ret(DateTimeV2Type.INSTANCE).args(DateTimeV2Type.INSTANCE, DateTimeV2Type.INSTANCE), + FunctionSignature.ret(DateTimeV2Type.SYSTEM_DEFAULT) + .args(DateTimeV2Type.SYSTEM_DEFAULT, DateTimeV2Type.SYSTEM_DEFAULT), FunctionSignature.ret(DateV2Type.INSTANCE).args(DateV2Type.INSTANCE, DateV2Type.INSTANCE), FunctionSignature.ret(DecimalV2Type.SYSTEM_DEFAULT) .args(DecimalV2Type.SYSTEM_DEFAULT, DecimalV2Type.SYSTEM_DEFAULT), diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/Nvl.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/Nvl.java index bf58884634..6e6224c2b0 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/Nvl.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/Nvl.java @@ -63,9 +63,12 @@ public class Nvl extends ScalarFunction FunctionSignature.ret(DateTimeType.INSTANCE).args(DateTimeType.INSTANCE, DateTimeType.INSTANCE), FunctionSignature.ret(DateTimeType.INSTANCE).args(DateType.INSTANCE, DateTimeType.INSTANCE), FunctionSignature.ret(DateTimeType.INSTANCE).args(DateTimeType.INSTANCE, DateType.INSTANCE), - FunctionSignature.ret(DateTimeV2Type.INSTANCE).args(DateTimeV2Type.INSTANCE, DateTimeV2Type.INSTANCE), - FunctionSignature.ret(DateTimeV2Type.INSTANCE).args(DateV2Type.INSTANCE, DateTimeV2Type.INSTANCE), - FunctionSignature.ret(DateTimeV2Type.INSTANCE).args(DateTimeV2Type.INSTANCE, DateV2Type.INSTANCE), + FunctionSignature.ret(DateTimeV2Type.SYSTEM_DEFAULT) + .args(DateTimeV2Type.SYSTEM_DEFAULT, DateTimeV2Type.SYSTEM_DEFAULT), + FunctionSignature.ret(DateTimeV2Type.SYSTEM_DEFAULT) + .args(DateV2Type.INSTANCE, DateTimeV2Type.SYSTEM_DEFAULT), + FunctionSignature.ret(DateTimeV2Type.SYSTEM_DEFAULT) + .args(DateTimeV2Type.SYSTEM_DEFAULT, DateV2Type.INSTANCE), FunctionSignature.ret(DecimalV2Type.SYSTEM_DEFAULT) .args(DecimalV2Type.SYSTEM_DEFAULT, DecimalV2Type.SYSTEM_DEFAULT), FunctionSignature.ret(BitmapType.INSTANCE).args(BitmapType.INSTANCE, BitmapType.INSTANCE), diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/Quarter.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/Quarter.java index e2d9f34a8c..fc434c7823 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/Quarter.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/Quarter.java @@ -41,7 +41,7 @@ public class Quarter extends ScalarFunction public static final List SIGNATURES = ImmutableList.of( FunctionSignature.ret(IntegerType.INSTANCE).args(DateTimeType.INSTANCE), - FunctionSignature.ret(IntegerType.INSTANCE).args(DateTimeV2Type.INSTANCE), + FunctionSignature.ret(IntegerType.INSTANCE).args(DateTimeV2Type.SYSTEM_DEFAULT), FunctionSignature.ret(IntegerType.INSTANCE).args(DateV2Type.INSTANCE) ); diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/Second.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/Second.java index df2d9a1d5a..09919e4975 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/Second.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/Second.java @@ -41,7 +41,7 @@ public class Second extends ScalarFunction public static final List SIGNATURES = ImmutableList.of( FunctionSignature.ret(IntegerType.INSTANCE).args(DateTimeType.INSTANCE), - FunctionSignature.ret(IntegerType.INSTANCE).args(DateTimeV2Type.INSTANCE), + FunctionSignature.ret(IntegerType.INSTANCE).args(DateTimeV2Type.SYSTEM_DEFAULT), FunctionSignature.ret(IntegerType.INSTANCE).args(DateV2Type.INSTANCE) ); diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/SecondCeil.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/SecondCeil.java index d7837a9dd9..76eb696f1a 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/SecondCeil.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/SecondCeil.java @@ -40,19 +40,21 @@ public class SecondCeil extends ScalarFunction public static final List SIGNATURES = ImmutableList.of( FunctionSignature.ret(DateTimeType.INSTANCE).args(DateTimeType.INSTANCE), - FunctionSignature.ret(DateTimeV2Type.INSTANCE).args(DateTimeV2Type.INSTANCE), - FunctionSignature.ret(DateTimeV2Type.INSTANCE).args(DateV2Type.INSTANCE), + FunctionSignature.ret(DateTimeV2Type.SYSTEM_DEFAULT).args(DateTimeV2Type.SYSTEM_DEFAULT), + FunctionSignature.ret(DateTimeV2Type.SYSTEM_DEFAULT).args(DateV2Type.INSTANCE), FunctionSignature.ret(DateTimeType.INSTANCE).args(DateTimeType.INSTANCE, DateTimeType.INSTANCE), FunctionSignature.ret(DateTimeType.INSTANCE).args(DateTimeType.INSTANCE, IntegerType.INSTANCE), - FunctionSignature.ret(DateTimeV2Type.INSTANCE).args(DateTimeV2Type.INSTANCE, DateTimeV2Type.INSTANCE), - FunctionSignature.ret(DateTimeV2Type.INSTANCE).args(DateTimeV2Type.INSTANCE, IntegerType.INSTANCE), - FunctionSignature.ret(DateTimeV2Type.INSTANCE).args(DateV2Type.INSTANCE, DateV2Type.INSTANCE), - FunctionSignature.ret(DateTimeV2Type.INSTANCE).args(DateV2Type.INSTANCE, IntegerType.INSTANCE), + FunctionSignature.ret(DateTimeV2Type.SYSTEM_DEFAULT) + .args(DateTimeV2Type.SYSTEM_DEFAULT, DateTimeV2Type.SYSTEM_DEFAULT), + FunctionSignature.ret(DateTimeV2Type.SYSTEM_DEFAULT) + .args(DateTimeV2Type.SYSTEM_DEFAULT, IntegerType.INSTANCE), + FunctionSignature.ret(DateTimeV2Type.SYSTEM_DEFAULT).args(DateV2Type.INSTANCE, DateV2Type.INSTANCE), + FunctionSignature.ret(DateTimeV2Type.SYSTEM_DEFAULT).args(DateV2Type.INSTANCE, IntegerType.INSTANCE), FunctionSignature.ret(DateTimeType.INSTANCE) .args(DateTimeType.INSTANCE, IntegerType.INSTANCE, DateTimeType.INSTANCE), - FunctionSignature.ret(DateTimeV2Type.INSTANCE) - .args(DateTimeV2Type.INSTANCE, IntegerType.INSTANCE, DateTimeV2Type.INSTANCE), - FunctionSignature.ret(DateTimeV2Type.INSTANCE) + FunctionSignature.ret(DateTimeV2Type.SYSTEM_DEFAULT) + .args(DateTimeV2Type.SYSTEM_DEFAULT, IntegerType.INSTANCE, DateTimeV2Type.SYSTEM_DEFAULT), + FunctionSignature.ret(DateTimeV2Type.SYSTEM_DEFAULT) .args(DateV2Type.INSTANCE, IntegerType.INSTANCE, DateV2Type.INSTANCE) ); diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/SecondFloor.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/SecondFloor.java index 10bdb1c362..a5f3b26312 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/SecondFloor.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/SecondFloor.java @@ -40,19 +40,21 @@ public class SecondFloor extends ScalarFunction public static final List SIGNATURES = ImmutableList.of( FunctionSignature.ret(DateTimeType.INSTANCE).args(DateTimeType.INSTANCE), - FunctionSignature.ret(DateTimeV2Type.INSTANCE).args(DateTimeV2Type.INSTANCE), - FunctionSignature.ret(DateTimeV2Type.INSTANCE).args(DateV2Type.INSTANCE), + FunctionSignature.ret(DateTimeV2Type.SYSTEM_DEFAULT).args(DateTimeV2Type.SYSTEM_DEFAULT), + FunctionSignature.ret(DateTimeV2Type.SYSTEM_DEFAULT).args(DateV2Type.INSTANCE), FunctionSignature.ret(DateTimeType.INSTANCE).args(DateTimeType.INSTANCE, DateTimeType.INSTANCE), FunctionSignature.ret(DateTimeType.INSTANCE).args(DateTimeType.INSTANCE, IntegerType.INSTANCE), - FunctionSignature.ret(DateTimeV2Type.INSTANCE).args(DateTimeV2Type.INSTANCE, DateTimeV2Type.INSTANCE), - FunctionSignature.ret(DateTimeV2Type.INSTANCE).args(DateTimeV2Type.INSTANCE, IntegerType.INSTANCE), - FunctionSignature.ret(DateTimeV2Type.INSTANCE).args(DateV2Type.INSTANCE, DateV2Type.INSTANCE), - FunctionSignature.ret(DateTimeV2Type.INSTANCE).args(DateV2Type.INSTANCE, IntegerType.INSTANCE), + FunctionSignature.ret(DateTimeV2Type.SYSTEM_DEFAULT) + .args(DateTimeV2Type.SYSTEM_DEFAULT, DateTimeV2Type.SYSTEM_DEFAULT), + FunctionSignature.ret(DateTimeV2Type.SYSTEM_DEFAULT) + .args(DateTimeV2Type.SYSTEM_DEFAULT, IntegerType.INSTANCE), + FunctionSignature.ret(DateTimeV2Type.SYSTEM_DEFAULT).args(DateV2Type.INSTANCE, DateV2Type.INSTANCE), + FunctionSignature.ret(DateTimeV2Type.SYSTEM_DEFAULT).args(DateV2Type.INSTANCE, IntegerType.INSTANCE), FunctionSignature.ret(DateTimeType.INSTANCE) .args(DateTimeType.INSTANCE, IntegerType.INSTANCE, DateTimeType.INSTANCE), - FunctionSignature.ret(DateTimeV2Type.INSTANCE) - .args(DateTimeV2Type.INSTANCE, IntegerType.INSTANCE, DateTimeV2Type.INSTANCE), - FunctionSignature.ret(DateTimeV2Type.INSTANCE) + FunctionSignature.ret(DateTimeV2Type.SYSTEM_DEFAULT) + .args(DateTimeV2Type.SYSTEM_DEFAULT, IntegerType.INSTANCE, DateTimeV2Type.SYSTEM_DEFAULT), + FunctionSignature.ret(DateTimeV2Type.SYSTEM_DEFAULT) .args(DateV2Type.INSTANCE, IntegerType.INSTANCE, DateV2Type.INSTANCE) ); diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/SecondsAdd.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/SecondsAdd.java index 0a23c66d75..65e83a25f4 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/SecondsAdd.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/SecondsAdd.java @@ -41,9 +41,10 @@ public class SecondsAdd extends ScalarFunction implements BinaryExpression, ExplicitlyCastableSignature, AlwaysNullable { public static final List SIGNATURES = ImmutableList.of( FunctionSignature.ret(DateTimeType.INSTANCE).args(DateTimeType.INSTANCE, IntegerType.INSTANCE), - FunctionSignature.ret(DateTimeV2Type.INSTANCE).args(DateTimeV2Type.INSTANCE, IntegerType.INSTANCE), + FunctionSignature.ret(DateTimeV2Type.SYSTEM_DEFAULT) + .args(DateTimeV2Type.SYSTEM_DEFAULT, IntegerType.INSTANCE), FunctionSignature.ret(DateTimeType.INSTANCE).args(DateType.INSTANCE, IntegerType.INSTANCE), - FunctionSignature.ret(DateTimeV2Type.INSTANCE).args(DateV2Type.INSTANCE, IntegerType.INSTANCE) + FunctionSignature.ret(DateTimeV2Type.SYSTEM_DEFAULT).args(DateV2Type.INSTANCE, IntegerType.INSTANCE) ); public SecondsAdd(Expression arg0, Expression arg1) { diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/SecondsDiff.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/SecondsDiff.java index 8d46ebc74f..d501ccb13f 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/SecondsDiff.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/SecondsDiff.java @@ -41,14 +41,15 @@ public class SecondsDiff extends ScalarFunction public static final List SIGNATURES = ImmutableList.of( FunctionSignature.ret(BigIntType.INSTANCE).args(DateTimeType.INSTANCE, DateTimeType.INSTANCE), - FunctionSignature.ret(BigIntType.INSTANCE).args(DateTimeV2Type.INSTANCE, DateTimeV2Type.INSTANCE), - FunctionSignature.ret(BigIntType.INSTANCE).args(DateV2Type.INSTANCE, DateTimeV2Type.INSTANCE), - FunctionSignature.ret(BigIntType.INSTANCE).args(DateTimeV2Type.INSTANCE, DateV2Type.INSTANCE), + FunctionSignature.ret(BigIntType.INSTANCE) + .args(DateTimeV2Type.SYSTEM_DEFAULT, DateTimeV2Type.SYSTEM_DEFAULT), + FunctionSignature.ret(BigIntType.INSTANCE).args(DateV2Type.INSTANCE, DateTimeV2Type.SYSTEM_DEFAULT), + FunctionSignature.ret(BigIntType.INSTANCE).args(DateTimeV2Type.SYSTEM_DEFAULT, DateV2Type.INSTANCE), FunctionSignature.ret(BigIntType.INSTANCE).args(DateV2Type.INSTANCE, DateV2Type.INSTANCE), FunctionSignature.ret(BigIntType.INSTANCE).args(DateV2Type.INSTANCE, DateTimeType.INSTANCE), FunctionSignature.ret(BigIntType.INSTANCE).args(DateTimeType.INSTANCE, DateV2Type.INSTANCE), - FunctionSignature.ret(BigIntType.INSTANCE).args(DateTimeV2Type.INSTANCE, DateTimeType.INSTANCE), - FunctionSignature.ret(BigIntType.INSTANCE).args(DateTimeType.INSTANCE, DateTimeV2Type.INSTANCE) + FunctionSignature.ret(BigIntType.INSTANCE).args(DateTimeV2Type.SYSTEM_DEFAULT, DateTimeType.INSTANCE), + FunctionSignature.ret(BigIntType.INSTANCE).args(DateTimeType.INSTANCE, DateTimeV2Type.SYSTEM_DEFAULT) ); /** diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/SecondsSub.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/SecondsSub.java index 1f6f958315..cc6b1080c3 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/SecondsSub.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/SecondsSub.java @@ -41,9 +41,10 @@ public class SecondsSub extends ScalarFunction implements BinaryExpression, ExplicitlyCastableSignature, AlwaysNullable { public static final List SIGNATURES = ImmutableList.of( FunctionSignature.ret(DateTimeType.INSTANCE).args(DateTimeType.INSTANCE, IntegerType.INSTANCE), - FunctionSignature.ret(DateTimeV2Type.INSTANCE).args(DateTimeV2Type.INSTANCE, IntegerType.INSTANCE), + FunctionSignature.ret(DateTimeV2Type.SYSTEM_DEFAULT) + .args(DateTimeV2Type.SYSTEM_DEFAULT, IntegerType.INSTANCE), FunctionSignature.ret(DateTimeType.INSTANCE).args(DateType.INSTANCE, IntegerType.INSTANCE), - FunctionSignature.ret(DateTimeV2Type.INSTANCE).args(DateV2Type.INSTANCE, IntegerType.INSTANCE) + FunctionSignature.ret(DateTimeV2Type.SYSTEM_DEFAULT).args(DateV2Type.INSTANCE, IntegerType.INSTANCE) ); public SecondsSub(Expression arg0, Expression arg1) { diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/TimeDiff.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/TimeDiff.java index e6a09afb65..b3baff37b1 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/TimeDiff.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/TimeDiff.java @@ -42,11 +42,12 @@ public class TimeDiff extends ScalarFunction public static final List SIGNATURES = ImmutableList.of( FunctionSignature.ret(TimeType.INSTANCE).args(DateTimeType.INSTANCE, DateTimeType.INSTANCE), - FunctionSignature.ret(TimeV2Type.INSTANCE).args(DateTimeV2Type.INSTANCE, DateTimeV2Type.INSTANCE), - FunctionSignature.ret(TimeV2Type.INSTANCE).args(DateTimeV2Type.INSTANCE, DateV2Type.INSTANCE), - FunctionSignature.ret(TimeV2Type.INSTANCE).args(DateV2Type.INSTANCE, DateTimeV2Type.INSTANCE), + FunctionSignature.ret(TimeV2Type.INSTANCE) + .args(DateTimeV2Type.SYSTEM_DEFAULT, DateTimeV2Type.SYSTEM_DEFAULT), + FunctionSignature.ret(TimeV2Type.INSTANCE).args(DateTimeV2Type.SYSTEM_DEFAULT, DateV2Type.INSTANCE), + FunctionSignature.ret(TimeV2Type.INSTANCE).args(DateV2Type.INSTANCE, DateTimeV2Type.SYSTEM_DEFAULT), FunctionSignature.ret(TimeV2Type.INSTANCE).args(DateV2Type.INSTANCE, DateV2Type.INSTANCE), - FunctionSignature.ret(TimeV2Type.INSTANCE).args(DateTimeV2Type.INSTANCE, DateTimeType.INSTANCE), + FunctionSignature.ret(TimeV2Type.INSTANCE).args(DateTimeV2Type.SYSTEM_DEFAULT, DateTimeType.INSTANCE), FunctionSignature.ret(TimeV2Type.INSTANCE).args(DateV2Type.INSTANCE, DateTimeType.INSTANCE) ); diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/Timestamp.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/Timestamp.java index 5db0114207..d7c04e6f0a 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/Timestamp.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/Timestamp.java @@ -39,7 +39,7 @@ public class Timestamp extends ScalarFunction public static final List SIGNATURES = ImmutableList.of( FunctionSignature.ret(DateTimeType.INSTANCE).args(DateTimeType.INSTANCE), - FunctionSignature.ret(DateTimeV2Type.INSTANCE).args(DateTimeV2Type.INSTANCE) + FunctionSignature.ret(DateTimeV2Type.SYSTEM_DEFAULT).args(DateTimeV2Type.SYSTEM_DEFAULT) ); /** diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/ToDate.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/ToDate.java index 7b09e1d9c7..a4e84a7452 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/ToDate.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/ToDate.java @@ -41,7 +41,7 @@ public class ToDate extends ScalarFunction public static final List SIGNATURES = ImmutableList.of( FunctionSignature.ret(DateType.INSTANCE).args(DateTimeType.INSTANCE), - FunctionSignature.ret(DateV2Type.INSTANCE).args(DateTimeV2Type.INSTANCE) + FunctionSignature.ret(DateV2Type.INSTANCE).args(DateTimeV2Type.SYSTEM_DEFAULT) ); /** diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/ToDateV2.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/ToDateV2.java index 21f9d6c813..d545088836 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/ToDateV2.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/ToDateV2.java @@ -38,7 +38,7 @@ public class ToDateV2 extends ScalarFunction implements UnaryExpression, ExplicitlyCastableSignature, AlwaysNullable { public static final List SIGNATURES = ImmutableList.of( - FunctionSignature.ret(DateV2Type.INSTANCE).args(DateTimeV2Type.INSTANCE) + FunctionSignature.ret(DateV2Type.INSTANCE).args(DateTimeV2Type.SYSTEM_DEFAULT) ); /** diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/UnixTimestamp.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/UnixTimestamp.java index 9ad0a26354..d61a9ceb2c 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/UnixTimestamp.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/UnixTimestamp.java @@ -44,7 +44,7 @@ public class UnixTimestamp extends ScalarFunction FunctionSignature.ret(IntegerType.INSTANCE).args(), FunctionSignature.ret(IntegerType.INSTANCE).args(DateTimeType.INSTANCE), FunctionSignature.ret(IntegerType.INSTANCE).args(DateType.INSTANCE), - FunctionSignature.ret(IntegerType.INSTANCE).args(DateTimeV2Type.INSTANCE), + FunctionSignature.ret(IntegerType.INSTANCE).args(DateTimeV2Type.SYSTEM_DEFAULT), FunctionSignature.ret(IntegerType.INSTANCE).args(DateV2Type.INSTANCE), FunctionSignature.ret(IntegerType.INSTANCE).args(VarcharType.SYSTEM_DEFAULT, VarcharType.SYSTEM_DEFAULT), FunctionSignature.ret(IntegerType.INSTANCE).args(StringType.INSTANCE, StringType.INSTANCE) diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/Week.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/Week.java index b6650ba989..473b217597 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/Week.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/Week.java @@ -40,10 +40,10 @@ public class Week extends ScalarFunction public static final List SIGNATURES = ImmutableList.of( FunctionSignature.ret(IntegerType.INSTANCE).args(DateTimeType.INSTANCE), - FunctionSignature.ret(IntegerType.INSTANCE).args(DateTimeV2Type.INSTANCE), + FunctionSignature.ret(IntegerType.INSTANCE).args(DateTimeV2Type.SYSTEM_DEFAULT), FunctionSignature.ret(IntegerType.INSTANCE).args(DateV2Type.INSTANCE), FunctionSignature.ret(IntegerType.INSTANCE).args(DateTimeType.INSTANCE, IntegerType.INSTANCE), - FunctionSignature.ret(IntegerType.INSTANCE).args(DateTimeV2Type.INSTANCE, IntegerType.INSTANCE), + FunctionSignature.ret(IntegerType.INSTANCE).args(DateTimeV2Type.SYSTEM_DEFAULT, IntegerType.INSTANCE), FunctionSignature.ret(IntegerType.INSTANCE).args(DateV2Type.INSTANCE, IntegerType.INSTANCE) ); diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/WeekCeil.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/WeekCeil.java index b551e7dacb..0fedb615b8 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/WeekCeil.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/WeekCeil.java @@ -40,18 +40,20 @@ public class WeekCeil extends ScalarFunction public static final List SIGNATURES = ImmutableList.of( FunctionSignature.ret(DateTimeType.INSTANCE).args(DateTimeType.INSTANCE), - FunctionSignature.ret(DateTimeV2Type.INSTANCE).args(DateTimeV2Type.INSTANCE), + FunctionSignature.ret(DateTimeV2Type.SYSTEM_DEFAULT).args(DateTimeV2Type.SYSTEM_DEFAULT), FunctionSignature.ret(DateV2Type.INSTANCE).args(DateV2Type.INSTANCE), FunctionSignature.ret(DateTimeType.INSTANCE).args(DateTimeType.INSTANCE, DateTimeType.INSTANCE), FunctionSignature.ret(DateTimeType.INSTANCE).args(DateTimeType.INSTANCE, IntegerType.INSTANCE), - FunctionSignature.ret(DateTimeV2Type.INSTANCE).args(DateTimeV2Type.INSTANCE, DateTimeV2Type.INSTANCE), - FunctionSignature.ret(DateTimeV2Type.INSTANCE).args(DateTimeV2Type.INSTANCE, IntegerType.INSTANCE), + FunctionSignature.ret(DateTimeV2Type.SYSTEM_DEFAULT) + .args(DateTimeV2Type.SYSTEM_DEFAULT, DateTimeV2Type.SYSTEM_DEFAULT), + FunctionSignature.ret(DateTimeV2Type.SYSTEM_DEFAULT) + .args(DateTimeV2Type.SYSTEM_DEFAULT, IntegerType.INSTANCE), FunctionSignature.ret(DateV2Type.INSTANCE).args(DateV2Type.INSTANCE, DateV2Type.INSTANCE), FunctionSignature.ret(DateV2Type.INSTANCE).args(DateV2Type.INSTANCE, IntegerType.INSTANCE), FunctionSignature.ret(DateTimeType.INSTANCE) .args(DateTimeType.INSTANCE, IntegerType.INSTANCE, DateTimeType.INSTANCE), - FunctionSignature.ret(DateTimeV2Type.INSTANCE) - .args(DateTimeV2Type.INSTANCE, IntegerType.INSTANCE, DateTimeV2Type.INSTANCE), + FunctionSignature.ret(DateTimeV2Type.SYSTEM_DEFAULT) + .args(DateTimeV2Type.SYSTEM_DEFAULT, IntegerType.INSTANCE, DateTimeV2Type.SYSTEM_DEFAULT), FunctionSignature.ret(DateV2Type.INSTANCE) .args(DateV2Type.INSTANCE, IntegerType.INSTANCE, DateV2Type.INSTANCE) ); diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/WeekFloor.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/WeekFloor.java index e6f4398a9c..65d94082a3 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/WeekFloor.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/WeekFloor.java @@ -40,18 +40,20 @@ public class WeekFloor extends ScalarFunction public static final List SIGNATURES = ImmutableList.of( FunctionSignature.ret(DateTimeType.INSTANCE).args(DateTimeType.INSTANCE), - FunctionSignature.ret(DateTimeV2Type.INSTANCE).args(DateTimeV2Type.INSTANCE), + FunctionSignature.ret(DateTimeV2Type.SYSTEM_DEFAULT).args(DateTimeV2Type.SYSTEM_DEFAULT), FunctionSignature.ret(DateV2Type.INSTANCE).args(DateV2Type.INSTANCE), FunctionSignature.ret(DateTimeType.INSTANCE).args(DateTimeType.INSTANCE, DateTimeType.INSTANCE), FunctionSignature.ret(DateTimeType.INSTANCE).args(DateTimeType.INSTANCE, IntegerType.INSTANCE), - FunctionSignature.ret(DateTimeV2Type.INSTANCE).args(DateTimeV2Type.INSTANCE, DateTimeV2Type.INSTANCE), - FunctionSignature.ret(DateTimeV2Type.INSTANCE).args(DateTimeV2Type.INSTANCE, IntegerType.INSTANCE), + FunctionSignature.ret(DateTimeV2Type.SYSTEM_DEFAULT) + .args(DateTimeV2Type.SYSTEM_DEFAULT, DateTimeV2Type.SYSTEM_DEFAULT), + FunctionSignature.ret(DateTimeV2Type.SYSTEM_DEFAULT) + .args(DateTimeV2Type.SYSTEM_DEFAULT, IntegerType.INSTANCE), FunctionSignature.ret(DateV2Type.INSTANCE).args(DateV2Type.INSTANCE, DateV2Type.INSTANCE), FunctionSignature.ret(DateV2Type.INSTANCE).args(DateV2Type.INSTANCE, IntegerType.INSTANCE), FunctionSignature.ret(DateTimeType.INSTANCE) .args(DateTimeType.INSTANCE, IntegerType.INSTANCE, DateTimeType.INSTANCE), - FunctionSignature.ret(DateTimeV2Type.INSTANCE) - .args(DateTimeV2Type.INSTANCE, IntegerType.INSTANCE, DateTimeV2Type.INSTANCE), + FunctionSignature.ret(DateTimeV2Type.SYSTEM_DEFAULT) + .args(DateTimeV2Type.SYSTEM_DEFAULT, IntegerType.INSTANCE, DateTimeV2Type.SYSTEM_DEFAULT), FunctionSignature.ret(DateV2Type.INSTANCE) .args(DateV2Type.INSTANCE, IntegerType.INSTANCE, DateV2Type.INSTANCE) ); diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/WeekOfYear.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/WeekOfYear.java index 965601717e..1bb197070f 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/WeekOfYear.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/WeekOfYear.java @@ -41,7 +41,7 @@ public class WeekOfYear extends ScalarFunction public static final List SIGNATURES = ImmutableList.of( FunctionSignature.ret(IntegerType.INSTANCE).args(DateTimeType.INSTANCE), - FunctionSignature.ret(IntegerType.INSTANCE).args(DateTimeV2Type.INSTANCE), + FunctionSignature.ret(IntegerType.INSTANCE).args(DateTimeV2Type.SYSTEM_DEFAULT), FunctionSignature.ret(IntegerType.INSTANCE).args(DateV2Type.INSTANCE) ); diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/Weekday.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/Weekday.java index 01c5d3f544..617e7e6f45 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/Weekday.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/Weekday.java @@ -41,7 +41,7 @@ public class Weekday extends ScalarFunction public static final List SIGNATURES = ImmutableList.of( FunctionSignature.ret(IntegerType.INSTANCE).args(DateTimeType.INSTANCE), - FunctionSignature.ret(IntegerType.INSTANCE).args(DateTimeV2Type.INSTANCE), + FunctionSignature.ret(IntegerType.INSTANCE).args(DateTimeV2Type.SYSTEM_DEFAULT), FunctionSignature.ret(IntegerType.INSTANCE).args(DateV2Type.INSTANCE) ); diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/WeeksDiff.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/WeeksDiff.java index c02488f676..760a1b2553 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/WeeksDiff.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/WeeksDiff.java @@ -41,14 +41,15 @@ public class WeeksDiff extends ScalarFunction public static final List SIGNATURES = ImmutableList.of( FunctionSignature.ret(BigIntType.INSTANCE).args(DateTimeType.INSTANCE, DateTimeType.INSTANCE), - FunctionSignature.ret(BigIntType.INSTANCE).args(DateTimeV2Type.INSTANCE, DateTimeV2Type.INSTANCE), - FunctionSignature.ret(BigIntType.INSTANCE).args(DateV2Type.INSTANCE, DateTimeV2Type.INSTANCE), - FunctionSignature.ret(BigIntType.INSTANCE).args(DateTimeV2Type.INSTANCE, DateV2Type.INSTANCE), + FunctionSignature.ret(BigIntType.INSTANCE) + .args(DateTimeV2Type.SYSTEM_DEFAULT, DateTimeV2Type.SYSTEM_DEFAULT), + FunctionSignature.ret(BigIntType.INSTANCE).args(DateV2Type.INSTANCE, DateTimeV2Type.SYSTEM_DEFAULT), + FunctionSignature.ret(BigIntType.INSTANCE).args(DateTimeV2Type.SYSTEM_DEFAULT, DateV2Type.INSTANCE), FunctionSignature.ret(BigIntType.INSTANCE).args(DateV2Type.INSTANCE, DateV2Type.INSTANCE), FunctionSignature.ret(BigIntType.INSTANCE).args(DateV2Type.INSTANCE, DateTimeType.INSTANCE), FunctionSignature.ret(BigIntType.INSTANCE).args(DateTimeType.INSTANCE, DateV2Type.INSTANCE), - FunctionSignature.ret(BigIntType.INSTANCE).args(DateTimeV2Type.INSTANCE, DateTimeType.INSTANCE), - FunctionSignature.ret(BigIntType.INSTANCE).args(DateTimeType.INSTANCE, DateTimeV2Type.INSTANCE) + FunctionSignature.ret(BigIntType.INSTANCE).args(DateTimeV2Type.SYSTEM_DEFAULT, DateTimeType.INSTANCE), + FunctionSignature.ret(BigIntType.INSTANCE).args(DateTimeType.INSTANCE, DateTimeV2Type.SYSTEM_DEFAULT) ); /** diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/Year.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/Year.java index 58e6df906e..4f84e88627 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/Year.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/Year.java @@ -42,7 +42,7 @@ public class Year extends ScalarFunction public static final List SIGNATURES = ImmutableList.of( FunctionSignature.ret(IntegerType.INSTANCE).args(DateV2Type.INSTANCE), FunctionSignature.ret(IntegerType.INSTANCE).args(DateTimeType.INSTANCE), - FunctionSignature.ret(IntegerType.INSTANCE).args(DateTimeV2Type.INSTANCE) + FunctionSignature.ret(IntegerType.INSTANCE).args(DateTimeV2Type.SYSTEM_DEFAULT) ); /** diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/YearCeil.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/YearCeil.java index 9d7bbb38c8..ed2aef62cf 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/YearCeil.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/YearCeil.java @@ -40,18 +40,20 @@ public class YearCeil extends ScalarFunction public static final List SIGNATURES = ImmutableList.of( FunctionSignature.ret(DateTimeType.INSTANCE).args(DateTimeType.INSTANCE), - FunctionSignature.ret(DateTimeV2Type.INSTANCE).args(DateTimeV2Type.INSTANCE), + FunctionSignature.ret(DateTimeV2Type.SYSTEM_DEFAULT).args(DateTimeV2Type.SYSTEM_DEFAULT), FunctionSignature.ret(DateV2Type.INSTANCE).args(DateV2Type.INSTANCE), FunctionSignature.ret(DateTimeType.INSTANCE).args(DateTimeType.INSTANCE, DateTimeType.INSTANCE), FunctionSignature.ret(DateTimeType.INSTANCE).args(DateTimeType.INSTANCE, IntegerType.INSTANCE), - FunctionSignature.ret(DateTimeV2Type.INSTANCE).args(DateTimeV2Type.INSTANCE, DateTimeV2Type.INSTANCE), - FunctionSignature.ret(DateTimeV2Type.INSTANCE).args(DateTimeV2Type.INSTANCE, IntegerType.INSTANCE), + FunctionSignature.ret(DateTimeV2Type.SYSTEM_DEFAULT) + .args(DateTimeV2Type.SYSTEM_DEFAULT, DateTimeV2Type.SYSTEM_DEFAULT), + FunctionSignature.ret(DateTimeV2Type.SYSTEM_DEFAULT) + .args(DateTimeV2Type.SYSTEM_DEFAULT, IntegerType.INSTANCE), FunctionSignature.ret(DateV2Type.INSTANCE).args(DateV2Type.INSTANCE, DateV2Type.INSTANCE), FunctionSignature.ret(DateV2Type.INSTANCE).args(DateV2Type.INSTANCE, IntegerType.INSTANCE), FunctionSignature.ret(DateTimeType.INSTANCE) .args(DateTimeType.INSTANCE, IntegerType.INSTANCE, DateTimeType.INSTANCE), - FunctionSignature.ret(DateTimeV2Type.INSTANCE) - .args(DateTimeV2Type.INSTANCE, IntegerType.INSTANCE, DateTimeV2Type.INSTANCE), + FunctionSignature.ret(DateTimeV2Type.SYSTEM_DEFAULT) + .args(DateTimeV2Type.SYSTEM_DEFAULT, IntegerType.INSTANCE, DateTimeV2Type.SYSTEM_DEFAULT), FunctionSignature.ret(DateV2Type.INSTANCE) .args(DateV2Type.INSTANCE, IntegerType.INSTANCE, DateV2Type.INSTANCE) ); diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/YearFloor.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/YearFloor.java index bb590a0865..a460bbf758 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/YearFloor.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/YearFloor.java @@ -40,18 +40,20 @@ public class YearFloor extends ScalarFunction public static final List SIGNATURES = ImmutableList.of( FunctionSignature.ret(DateTimeType.INSTANCE).args(DateTimeType.INSTANCE), - FunctionSignature.ret(DateTimeV2Type.INSTANCE).args(DateTimeV2Type.INSTANCE), + FunctionSignature.ret(DateTimeV2Type.SYSTEM_DEFAULT).args(DateTimeV2Type.SYSTEM_DEFAULT), FunctionSignature.ret(DateV2Type.INSTANCE).args(DateV2Type.INSTANCE), FunctionSignature.ret(DateTimeType.INSTANCE).args(DateTimeType.INSTANCE, DateTimeType.INSTANCE), FunctionSignature.ret(DateTimeType.INSTANCE).args(DateTimeType.INSTANCE, IntegerType.INSTANCE), - FunctionSignature.ret(DateTimeV2Type.INSTANCE).args(DateTimeV2Type.INSTANCE, DateTimeV2Type.INSTANCE), - FunctionSignature.ret(DateTimeV2Type.INSTANCE).args(DateTimeV2Type.INSTANCE, IntegerType.INSTANCE), + FunctionSignature.ret(DateTimeV2Type.SYSTEM_DEFAULT) + .args(DateTimeV2Type.SYSTEM_DEFAULT, DateTimeV2Type.SYSTEM_DEFAULT), + FunctionSignature.ret(DateTimeV2Type.SYSTEM_DEFAULT) + .args(DateTimeV2Type.SYSTEM_DEFAULT, IntegerType.INSTANCE), FunctionSignature.ret(DateV2Type.INSTANCE).args(DateV2Type.INSTANCE, DateV2Type.INSTANCE), FunctionSignature.ret(DateV2Type.INSTANCE).args(DateV2Type.INSTANCE, IntegerType.INSTANCE), FunctionSignature.ret(DateTimeType.INSTANCE) .args(DateTimeType.INSTANCE, IntegerType.INSTANCE, DateTimeType.INSTANCE), - FunctionSignature.ret(DateTimeV2Type.INSTANCE) - .args(DateTimeV2Type.INSTANCE, IntegerType.INSTANCE, DateTimeV2Type.INSTANCE), + FunctionSignature.ret(DateTimeV2Type.SYSTEM_DEFAULT) + .args(DateTimeV2Type.SYSTEM_DEFAULT, IntegerType.INSTANCE, DateTimeV2Type.SYSTEM_DEFAULT), FunctionSignature.ret(DateV2Type.INSTANCE) .args(DateV2Type.INSTANCE, IntegerType.INSTANCE, DateV2Type.INSTANCE) ); diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/YearWeek.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/YearWeek.java index a53c46c4be..c96eb9a6c6 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/YearWeek.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/YearWeek.java @@ -40,10 +40,10 @@ public class YearWeek extends ScalarFunction public static final List SIGNATURES = ImmutableList.of( FunctionSignature.ret(IntegerType.INSTANCE).args(DateTimeType.INSTANCE), - FunctionSignature.ret(IntegerType.INSTANCE).args(DateTimeV2Type.INSTANCE), + FunctionSignature.ret(IntegerType.INSTANCE).args(DateTimeV2Type.SYSTEM_DEFAULT), FunctionSignature.ret(IntegerType.INSTANCE).args(DateV2Type.INSTANCE), FunctionSignature.ret(IntegerType.INSTANCE).args(DateTimeType.INSTANCE, IntegerType.INSTANCE), - FunctionSignature.ret(IntegerType.INSTANCE).args(DateTimeV2Type.INSTANCE, IntegerType.INSTANCE), + FunctionSignature.ret(IntegerType.INSTANCE).args(DateTimeV2Type.SYSTEM_DEFAULT, IntegerType.INSTANCE), FunctionSignature.ret(IntegerType.INSTANCE).args(DateV2Type.INSTANCE, IntegerType.INSTANCE) ); diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/YearsAdd.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/YearsAdd.java index 26b8db3c0d..9482de0591 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/YearsAdd.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/YearsAdd.java @@ -40,7 +40,8 @@ import java.util.List; public class YearsAdd extends ScalarFunction implements BinaryExpression, ExplicitlyCastableSignature, AlwaysNullable { public static final List SIGNATURES = ImmutableList.of( FunctionSignature.ret(DateTimeType.INSTANCE).args(DateTimeType.INSTANCE, IntegerType.INSTANCE), - FunctionSignature.ret(DateTimeV2Type.INSTANCE).args(DateTimeV2Type.INSTANCE, IntegerType.INSTANCE), + FunctionSignature.ret(DateTimeV2Type.SYSTEM_DEFAULT) + .args(DateTimeV2Type.SYSTEM_DEFAULT, IntegerType.INSTANCE), FunctionSignature.ret(DateType.INSTANCE).args(DateType.INSTANCE, IntegerType.INSTANCE), FunctionSignature.ret(DateV2Type.INSTANCE).args(DateV2Type.INSTANCE, IntegerType.INSTANCE) ); diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/YearsDiff.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/YearsDiff.java index 916559cddf..204eee486f 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/YearsDiff.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/YearsDiff.java @@ -41,14 +41,15 @@ public class YearsDiff extends ScalarFunction public static final List SIGNATURES = ImmutableList.of( FunctionSignature.ret(BigIntType.INSTANCE).args(DateTimeType.INSTANCE, DateTimeType.INSTANCE), - FunctionSignature.ret(BigIntType.INSTANCE).args(DateTimeV2Type.INSTANCE, DateTimeV2Type.INSTANCE), - FunctionSignature.ret(BigIntType.INSTANCE).args(DateV2Type.INSTANCE, DateTimeV2Type.INSTANCE), - FunctionSignature.ret(BigIntType.INSTANCE).args(DateTimeV2Type.INSTANCE, DateV2Type.INSTANCE), + FunctionSignature.ret(BigIntType.INSTANCE) + .args(DateTimeV2Type.SYSTEM_DEFAULT, DateTimeV2Type.SYSTEM_DEFAULT), + FunctionSignature.ret(BigIntType.INSTANCE).args(DateV2Type.INSTANCE, DateTimeV2Type.SYSTEM_DEFAULT), + FunctionSignature.ret(BigIntType.INSTANCE).args(DateTimeV2Type.SYSTEM_DEFAULT, DateV2Type.INSTANCE), FunctionSignature.ret(BigIntType.INSTANCE).args(DateV2Type.INSTANCE, DateV2Type.INSTANCE), FunctionSignature.ret(BigIntType.INSTANCE).args(DateV2Type.INSTANCE, DateTimeType.INSTANCE), FunctionSignature.ret(BigIntType.INSTANCE).args(DateTimeType.INSTANCE, DateV2Type.INSTANCE), - FunctionSignature.ret(BigIntType.INSTANCE).args(DateTimeV2Type.INSTANCE, DateTimeType.INSTANCE), - FunctionSignature.ret(BigIntType.INSTANCE).args(DateTimeType.INSTANCE, DateTimeV2Type.INSTANCE) + FunctionSignature.ret(BigIntType.INSTANCE).args(DateTimeV2Type.SYSTEM_DEFAULT, DateTimeType.INSTANCE), + FunctionSignature.ret(BigIntType.INSTANCE).args(DateTimeType.INSTANCE, DateTimeV2Type.SYSTEM_DEFAULT) ); /** diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/YearsSub.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/YearsSub.java index 671426da91..92cfbc51da 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/YearsSub.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/YearsSub.java @@ -40,7 +40,8 @@ import java.util.List; public class YearsSub extends ScalarFunction implements BinaryExpression, ExplicitlyCastableSignature, AlwaysNullable { public static final List SIGNATURES = ImmutableList.of( FunctionSignature.ret(DateTimeType.INSTANCE).args(DateTimeType.INSTANCE, IntegerType.INSTANCE), - FunctionSignature.ret(DateTimeV2Type.INSTANCE).args(DateTimeV2Type.INSTANCE, IntegerType.INSTANCE), + FunctionSignature.ret(DateTimeV2Type.SYSTEM_DEFAULT) + .args(DateTimeV2Type.SYSTEM_DEFAULT, IntegerType.INSTANCE), FunctionSignature.ret(DateType.INSTANCE).args(DateType.INSTANCE, IntegerType.INSTANCE), FunctionSignature.ret(DateV2Type.INSTANCE).args(DateV2Type.INSTANCE, IntegerType.INSTANCE) ); diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/literal/DateTimeV2Literal.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/literal/DateTimeV2Literal.java index 4706c87a0e..b425b38bdd 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/literal/DateTimeV2Literal.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/literal/DateTimeV2Literal.java @@ -28,11 +28,11 @@ import org.joda.time.LocalDateTime; public class DateTimeV2Literal extends DateTimeLiteral { public DateTimeV2Literal(String s) { - super(DateTimeV2Type.INSTANCE, s); + super(DateTimeV2Type.SYSTEM_DEFAULT, s); } public DateTimeV2Literal(long year, long month, long day, long hour, long minute, long second) { - super(DateTimeV2Type.INSTANCE, year, month, day, hour, minute, second); + super(DateTimeV2Type.SYSTEM_DEFAULT, year, month, day, hour, minute, second); } public DateTimeV2Literal(DateTimeV2Type dataType, diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/types/DataType.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/types/DataType.java index ab1fe13fc7..43486b528b 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/types/DataType.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/types/DataType.java @@ -21,6 +21,7 @@ import org.apache.doris.catalog.ScalarType; import org.apache.doris.catalog.Type; import org.apache.doris.nereids.annotation.Developing; import org.apache.doris.nereids.exceptions.AnalysisException; +import org.apache.doris.nereids.parser.NereidsParser; import org.apache.doris.nereids.trees.expressions.literal.BigIntLiteral; import org.apache.doris.nereids.trees.expressions.literal.DoubleLiteral; import org.apache.doris.nereids.trees.expressions.literal.IntegerLiteral; @@ -33,12 +34,10 @@ import org.apache.doris.nereids.types.coercion.PrimitiveType; import com.google.common.collect.ImmutableMap; +import java.util.List; import java.util.Locale; import java.util.Map; -import java.util.Optional; import java.util.function.Supplier; -import java.util.regex.Matcher; -import java.util.regex.Pattern; /** * Abstract class for all data type in Nereids. @@ -46,16 +45,8 @@ import java.util.regex.Pattern; public abstract class DataType implements AbstractDataType { public static final int DEFAULT_SCALE = 0; public static final int DEFAULT_PRECISION = 9; - public static final int DATETIME_PRECISION = 18; - private static final Pattern CHAR_PATTERN = Pattern.compile("char(\\s*\\(\\s*(\\d+)\\s*\\))?"); - private static final Pattern VARCHAR_PATTERN = Pattern.compile("varchar(\\s*\\(\\s*(\\d+)\\s*\\))?"); - private static final Pattern DATETIME_PATTERN = Pattern.compile("datetime(\\s*\\(\\s*(\\d+)\\s*\\))?"); - private static final Pattern DATETIME_V2_PATTERN = Pattern.compile("datetimev2(\\s*\\(\\s*(\\d+)\\s*\\))?"); - private static final Pattern DECIMAL_PATTERN = - Pattern.compile("decimal(\\s*\\(\\s*(\\d+)(\\s*,\\s*(\\d+))?\\s*\\))?"); - private static final Pattern DECIMAL_V3_PATTERN = - Pattern.compile("decimalv3(\\s*\\(\\s*(\\d+)(\\s*,\\s*(\\d+))?\\s*\\))?"); + protected static final NereidsParser PARSER = new NereidsParser(); // use class and supplier here to avoid class load deadlock. private static final Map, Supplier> PROMOTION_MAP @@ -166,41 +157,74 @@ public abstract class DataType implements AbstractDataType { * Convert to data type in Nereids. * throw exception when cannot convert to Nereids type * - * @param type data type in string representation + * @param types data type in string representation * @return data type in Nereids */ - public static DataType convertFromString(String type) { - // TODO: use a better way to resolve types - // TODO: support varchar, char, decimal - type = type.toLowerCase().trim(); + public static DataType convertPrimitiveFromStrings(List types) { + String type = types.get(0).toLowerCase().trim(); switch (type) { case "bool": case "boolean": return BooleanType.INSTANCE; case "tinyint": - case "tinyint(4)": return TinyIntType.INSTANCE; case "smallint": - case "smallint(6)": return SmallIntType.INSTANCE; case "int": - case "int(11)": return IntegerType.INSTANCE; case "bigint": - case "bigint(20)": return BigIntType.INSTANCE; case "largeint": - case "largeint(40)": return LargeIntType.INSTANCE; case "float": return FloatType.INSTANCE; case "double": return DoubleType.INSTANCE; case "decimal": - return fromCatalogType(ScalarType.createDecimalType()); + switch (types.size()) { + case 1: + return DecimalV2Type.SYSTEM_DEFAULT; + case 2: + return DecimalV2Type.createDecimalV2Type(Integer.parseInt(types.get(1)), 0); + case 3: + return DecimalV2Type.createDecimalV2Type( + Integer.parseInt(types.get(1)), Integer.parseInt(types.get(2))); + default: + throw new AnalysisException("Nereids do not support type: " + type); + } + case "decimalv3": + switch (types.size()) { + case 1: + return DecimalV3Type.SYSTEM_DEFAULT; + case 2: + return DecimalV3Type.createDecimalV3Type(Integer.parseInt(types.get(1))); + case 3: + return DecimalV3Type.createDecimalV3Type( + Integer.parseInt(types.get(1)), Integer.parseInt(types.get(2))); + default: + throw new AnalysisException("Nereids do not support type: " + type); + } case "text": case "string": return StringType.INSTANCE; + case "varchar": + switch (types.size()) { + case 1: + return VarcharType.SYSTEM_DEFAULT; + case 2: + return VarcharType.createVarcharType(Integer.parseInt(types.get(1))); + default: + throw new AnalysisException("Nereids do not support type: " + type); + } + case "char": + switch (types.size()) { + case 1: + return CharType.SYSTEM_DEFAULT; + case 2: + return CharType.createCharType(Integer.parseInt(types.get(1))); + default: + throw new AnalysisException("Nereids do not support type: " + type); + } case "null": case "null_type": // ScalarType.NULL.toSql() return "null_type", so support it return NullType.INSTANCE; @@ -210,6 +234,24 @@ public abstract class DataType implements AbstractDataType { return DateV2Type.INSTANCE; case "time": return TimeType.INSTANCE; + case "datetime": + switch (types.size()) { + case 1: + return DateTimeType.INSTANCE; + case 2: + return DateTimeV2Type.of(Integer.parseInt(types.get(1))); + default: + throw new AnalysisException("Nereids do not support type: " + type); + } + case "datetimev2": + switch (types.size()) { + case 1: + return DateTimeV2Type.SYSTEM_DEFAULT; + case 2: + return DateTimeV2Type.of(Integer.parseInt(types.get(1))); + default: + throw new AnalysisException("Nereids do not support type: " + type); + } case "hll": return HllType.INSTANCE; case "bitmap": @@ -219,32 +261,29 @@ public abstract class DataType implements AbstractDataType { case "json": return JsonType.INSTANCE; default: - Optional newType = matchVarchar(type); - if (newType.isPresent()) { - return newType.get(); - } - - newType = matchChar(type); - if (newType.isPresent()) { - return newType.get(); - } - - newType = matchDateTime(type); - if (newType.isPresent()) { - return newType.get(); - } - - newType = matchDecimalType(type); - if (newType.isPresent()) { - return newType.get(); - } - if (type.startsWith("array")) { - return resolveArrayType(type); - } throw new AnalysisException("Nereids do not support type: " + type); } } + /** + * Convert to data type in Nereids. + * throw exception when cannot convert to Nereids type + * + * @param type data type in string representation + * @return data type in Nereids + */ + public static DataType convertFromString(String type) { + try { + return PARSER.parseDataType(type); + } catch (Exception e) { + // TODO: remove it when Nereids parser support array + if (type.startsWith("array")) { + return resolveArrayType(type); + } + throw e; + } + } + /** * just for generate function and migrate to nereids * @param type legacy date type @@ -459,85 +498,6 @@ public abstract class DataType implements AbstractDataType { public abstract int width(); - private static Optional matchChar(String type) { - Matcher matcher = CHAR_PATTERN.matcher(type); - if (matcher.find() && matcher.group().equals(type)) { - String len = matcher.group(2); - CharType charType = len != null - ? CharType.createCharType(Integer.parseInt(len)) - : CharType.SYSTEM_DEFAULT; - return Optional.of(charType); - } - return Optional.empty(); - } - - private static Optional matchVarchar(String type) { - Matcher matcher = VARCHAR_PATTERN.matcher(type); - if (matcher.find() && matcher.group().equals(type)) { - String scale = matcher.group(2); - VarcharType varcharType = scale != null - ? VarcharType.createVarcharType(Integer.parseInt(scale)) - : VarcharType.SYSTEM_DEFAULT; - return Optional.of(varcharType); - } - return Optional.empty(); - } - - private static Optional matchDateTime(String type) { - Matcher matcher = DATETIME_PATTERN.matcher(type); - if (matcher.find() && matcher.group().equals(type)) { - String scale = matcher.group(2); - return Optional.of( - fromCatalogType(scale != null - ? ScalarType.createDatetimeV2Type(Integer.parseInt(scale)) - : ScalarType.createDatetimeType()) - ); - } - matcher = DATETIME_V2_PATTERN.matcher(type); - if (matcher.find()) { - String scale = matcher.group(2); - return Optional.of( - fromCatalogType(scale != null - ? ScalarType.createDatetimeV2Type(Integer.parseInt(scale)) - : ScalarType.createDatetimeV2Type(0)) - ); - } - return Optional.empty(); - } - - private static Optional matchDecimalType(String type) { - Matcher matcher = DECIMAL_PATTERN.matcher(type); - if (matcher.find() && matcher.group().equals(type)) { - String precision = matcher.group(2); - String scale = matcher.group(4); - if (scale != null) { - return Optional.of(fromCatalogType( - ScalarType.createDecimalType(Integer.parseInt(precision), Integer.parseInt(scale)))); - } - - if (precision != null) { - return Optional.of(fromCatalogType(ScalarType.createDecimalType(Integer.parseInt(precision)))); - } - return Optional.of(fromCatalogType(ScalarType.createDecimalType())); - } - - matcher = DECIMAL_V3_PATTERN.matcher(type); - if (matcher.find() && matcher.group().equals(type)) { - String precision = matcher.group(2); - String scale = matcher.group(4); - if (scale != null) { - return Optional.of(fromCatalogType( - ScalarType.createDecimalV3Type(Integer.parseInt(precision), Integer.parseInt(scale)))); - } - - if (precision != null) { - return Optional.of(fromCatalogType(ScalarType.createDecimalV3Type(Integer.parseInt(precision)))); - } - return Optional.of(fromCatalogType(ScalarType.createDecimalV3Type())); - } - return Optional.empty(); - } - private static ArrayType resolveArrayType(String type) { if (!type.startsWith("array")) { throw new AnalysisException("Not array type: " + type); diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/types/DateTimeV2Type.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/types/DateTimeV2Type.java index c6737a1618..c2e72e0cda 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/types/DateTimeV2Type.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/types/DateTimeV2Type.java @@ -19,6 +19,7 @@ package org.apache.doris.nereids.types; import org.apache.doris.catalog.ScalarType; import org.apache.doris.catalog.Type; +import org.apache.doris.nereids.exceptions.AnalysisException; import org.apache.doris.nereids.types.coercion.DateLikeType; import com.google.common.base.Preconditions; @@ -30,7 +31,7 @@ import java.util.Objects; */ public class DateTimeV2Type extends DateLikeType { public static final int MAX_SCALE = 6; - public static final DateTimeV2Type INSTANCE = new DateTimeV2Type(0); + public static final DateTimeV2Type SYSTEM_DEFAULT = new DateTimeV2Type(0); private static final int WIDTH = 8; @@ -41,9 +42,14 @@ public class DateTimeV2Type extends DateLikeType { this.scale = scale; } + /** + * create DateTimeV2Type from scale + */ public static DateTimeV2Type of(int scale) { - if (scale == INSTANCE.scale) { - return INSTANCE; + if (scale == SYSTEM_DEFAULT.scale) { + return SYSTEM_DEFAULT; + } else if (scale > MAX_SCALE || scale < 0) { + throw new AnalysisException("Scale of Datetime/Time must between 0 and 6. Scale was set to: " + scale); } else { return new DateTimeV2Type(scale); } diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/types/DecimalV2Type.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/types/DecimalV2Type.java index 1d2a3baf21..26a6b5f3ce 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/types/DecimalV2Type.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/types/DecimalV2Type.java @@ -38,6 +38,7 @@ public class DecimalV2Type extends FractionalType { public static int MAX_PRECISION = 27; public static int MAX_SCALE = 9; public static final DecimalV2Type SYSTEM_DEFAULT = new DecimalV2Type(MAX_PRECISION, MAX_SCALE); + public static final DecimalV2Type CATALOG_DEFAULT = new DecimalV2Type(DEFAULT_PRECISION, DEFAULT_SCALE); private static final DecimalV2Type BOOLEAN_DECIMAL = new DecimalV2Type(1, 0); private static final DecimalV2Type TINYINT_DECIMAL = new DecimalV2Type(3, 0); @@ -76,6 +77,9 @@ public class DecimalV2Type extends FractionalType { if (precision == SYSTEM_DEFAULT.precision && scale == SYSTEM_DEFAULT.scale) { return SYSTEM_DEFAULT; } + if (precision == CATALOG_DEFAULT.precision && scale == CATALOG_DEFAULT.scale) { + return CATALOG_DEFAULT; + } return new DecimalV2Type(Math.min(precision, MAX_PRECISION), Math.min(scale, MAX_SCALE)); } diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/types/DecimalV3Type.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/types/DecimalV3Type.java index 5420eb4490..ab16a932fa 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/types/DecimalV3Type.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/types/DecimalV3Type.java @@ -36,13 +36,12 @@ import java.util.Objects; */ @Developing public class DecimalV3Type extends FractionalType { - public static final int MAX_DECIMALV2_SCALE = 9; public static final int MAX_DECIMAL32_PRECISION = 9; public static final int MAX_DECIMAL64_PRECISION = 18; public static final int MAX_DECIMAL128_PRECISION = 38; - public static final DecimalV3Type DEFAULT_DECIMAL32 = new DecimalV3Type(DEFAULT_PRECISION, DEFAULT_SCALE); - public static final DecimalV3Type DEFAULT_DECIMAL64 = new DecimalV3Type(DEFAULT_PRECISION, DEFAULT_SCALE); + public static final DecimalV3Type DEFAULT_DECIMAL32 = new DecimalV3Type(MAX_DECIMAL32_PRECISION, DEFAULT_SCALE); + public static final DecimalV3Type DEFAULT_DECIMAL64 = new DecimalV3Type(MAX_DECIMAL64_PRECISION, DEFAULT_SCALE); public static final DecimalV3Type DEFAULT_DECIMAL128 = new DecimalV3Type(MAX_DECIMAL128_PRECISION, DEFAULT_SCALE); public static final DecimalV3Type SYSTEM_DEFAULT = DEFAULT_DECIMAL32; @@ -82,22 +81,21 @@ public class DecimalV3Type extends FractionalType { /** createDecimalV3Type. */ public static DecimalV3Type createDecimalV3Type(int precision) { - if (precision <= MAX_DECIMAL32_PRECISION) { - return DEFAULT_DECIMAL32; - } - if (precision <= MAX_DECIMAL64_PRECISION) { - return DEFAULT_DECIMAL64; - } - if (precision <= MAX_DECIMAL128_PRECISION) { - return DEFAULT_DECIMAL128; - } + return createDecimalV3Type(precision, DEFAULT_SCALE); + } - return new DecimalV3Type(Math.min(precision, MAX_DECIMAL128_PRECISION), DEFAULT_SCALE); + /** createDecimalV3Type. */ + public static DecimalV3Type createDecimalV3Type(int precision, int scale) { + Preconditions.checkArgument(precision > 0 && precision <= MAX_DECIMAL128_PRECISION); + Preconditions.checkArgument(scale >= 0); + Preconditions.checkArgument(precision >= scale); + return new DecimalV3Type(precision, scale); } public static DecimalV3Type createDecimalV3Type(BigDecimal bigDecimal) { int precision = org.apache.doris.analysis.DecimalLiteral.getBigDecimalPrecision(bigDecimal); - return createDecimalV3Type(precision); + int scale = org.apache.doris.analysis.DecimalLiteral.getBigDecimalScale(bigDecimal); + return createDecimalV3Type(precision, scale); } public static DecimalV3Type widerDecimalV3Type(DecimalV3Type left, DecimalV3Type right) { diff --git a/fe/fe-core/src/test/java/org/apache/doris/nereids/parser/NereidsParserTest.java b/fe/fe-core/src/test/java/org/apache/doris/nereids/parser/NereidsParserTest.java index f4d4222da8..1a91837836 100644 --- a/fe/fe-core/src/test/java/org/apache/doris/nereids/parser/NereidsParserTest.java +++ b/fe/fe-core/src/test/java/org/apache/doris/nereids/parser/NereidsParserTest.java @@ -23,6 +23,7 @@ import org.apache.doris.common.Pair; import org.apache.doris.nereids.StatementContext; import org.apache.doris.nereids.exceptions.ParseException; import org.apache.doris.nereids.glue.LogicalPlanAdapter; +import org.apache.doris.nereids.trees.expressions.Cast; import org.apache.doris.nereids.trees.expressions.literal.DecimalLiteral; import org.apache.doris.nereids.trees.plans.JoinHint; import org.apache.doris.nereids.trees.plans.JoinType; @@ -34,6 +35,7 @@ import org.apache.doris.nereids.trees.plans.logical.LogicalCTE; import org.apache.doris.nereids.trees.plans.logical.LogicalJoin; import org.apache.doris.nereids.trees.plans.logical.LogicalPlan; import org.apache.doris.nereids.trees.plans.logical.LogicalProject; +import org.apache.doris.nereids.types.DecimalV2Type; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; @@ -232,7 +234,7 @@ public class NereidsParserTest extends ParserTestBase { } @Test - public void parseDecimal() { + public void testParseDecimal() { String f1 = "SELECT col1 * 0.267081789095306 FROM t"; NereidsParser nereidsParser = new NereidsParser(); LogicalPlan logicalPlan = nereidsParser.parseSingle(f1); @@ -299,4 +301,15 @@ public class NereidsParserTest extends ParserTestBase { parsePlan("select * from t1 join [shuffle,broadcast] t2 on t1.key=t2.key") .assertThrowsExactly(ParseException.class); } + + @Test + public void testParseCast() { + String sql = "SELECT CAST(1 AS DECIMAL(20, 6)) FROM t"; + NereidsParser nereidsParser = new NereidsParser(); + LogicalPlan logicalPlan = nereidsParser.parseSingle(sql); + Cast cast = (Cast) logicalPlan.getExpressions().get(0).child(0); + DecimalV2Type decimalV2Type = (DecimalV2Type) cast.getDataType(); + Assertions.assertEquals(20, decimalV2Type.getPrecision()); + Assertions.assertEquals(6, decimalV2Type.getScale()); + } } diff --git a/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/expression/rewrite/ExpressionRewriteTest.java b/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/expression/rewrite/ExpressionRewriteTest.java index 19ee9affaf..2e55f76e05 100644 --- a/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/expression/rewrite/ExpressionRewriteTest.java +++ b/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/expression/rewrite/ExpressionRewriteTest.java @@ -236,68 +236,68 @@ public class ExpressionRewriteTest extends ExpressionRewriteTestHelper { // DateTimeV2 -> DateTime assertRewrite( - new GreaterThan(new Cast(dt, DateTimeV2Type.INSTANCE), dtv2), + new GreaterThan(new Cast(dt, DateTimeV2Type.SYSTEM_DEFAULT), dtv2), new GreaterThan(dt, dt)); // DateTimeV2 -> DateV2 assertRewrite( - new GreaterThan(new Cast(dv2, DateTimeV2Type.INSTANCE), dtv2), + new GreaterThan(new Cast(dv2, DateTimeV2Type.SYSTEM_DEFAULT), dtv2), new GreaterThan(dv2, dv2)); assertRewrite( - new LessThan(new Cast(dv2, DateTimeV2Type.INSTANCE), dtv2), + new LessThan(new Cast(dv2, DateTimeV2Type.SYSTEM_DEFAULT), dtv2), new LessThan(dv2, dv2PlusOne)); assertRewrite( - new EqualTo(new Cast(dv2, DateTimeV2Type.INSTANCE), dtv2), - new EqualTo(new Cast(dv2, DateTimeV2Type.INSTANCE), dtv2)); + new EqualTo(new Cast(dv2, DateTimeV2Type.SYSTEM_DEFAULT), dtv2), + new EqualTo(new Cast(dv2, DateTimeV2Type.SYSTEM_DEFAULT), dtv2)); // DateTime -> DateV2 assertRewrite( - new GreaterThan(new Cast(dv2, DateTimeV2Type.INSTANCE), dt), + new GreaterThan(new Cast(dv2, DateTimeV2Type.SYSTEM_DEFAULT), dt), new GreaterThan(dv2, dv2)); assertRewrite( - new LessThan(new Cast(dv2, DateTimeV2Type.INSTANCE), dt), + new LessThan(new Cast(dv2, DateTimeV2Type.SYSTEM_DEFAULT), dt), new LessThan(dv2, dv2PlusOne)); assertRewrite( - new EqualTo(new Cast(dv2, DateTimeV2Type.INSTANCE), dt), - new EqualTo(new Cast(dv2, DateTimeV2Type.INSTANCE), dt)); + new EqualTo(new Cast(dv2, DateTimeV2Type.SYSTEM_DEFAULT), dt), + new EqualTo(new Cast(dv2, DateTimeV2Type.SYSTEM_DEFAULT), dt)); // DateTimeV2 -> Date assertRewrite( - new GreaterThan(new Cast(d, DateTimeV2Type.INSTANCE), dtv2), + new GreaterThan(new Cast(d, DateTimeV2Type.SYSTEM_DEFAULT), dtv2), new GreaterThan(d, d)); assertRewrite( - new LessThan(new Cast(d, DateTimeV2Type.INSTANCE), dtv2), + new LessThan(new Cast(d, DateTimeV2Type.SYSTEM_DEFAULT), dtv2), new LessThan(d, dPlusOne)); assertRewrite( - new EqualTo(new Cast(d, DateTimeV2Type.INSTANCE), dtv2), - new EqualTo(new Cast(d, DateTimeV2Type.INSTANCE), dtv2)); + new EqualTo(new Cast(d, DateTimeV2Type.SYSTEM_DEFAULT), dtv2), + new EqualTo(new Cast(d, DateTimeV2Type.SYSTEM_DEFAULT), dtv2)); // DateTime -> Date assertRewrite( - new GreaterThan(new Cast(d, DateTimeV2Type.INSTANCE), dt), + new GreaterThan(new Cast(d, DateTimeV2Type.SYSTEM_DEFAULT), dt), new GreaterThan(d, d)); assertRewrite( - new LessThan(new Cast(d, DateTimeV2Type.INSTANCE), dt), + new LessThan(new Cast(d, DateTimeV2Type.SYSTEM_DEFAULT), dt), new LessThan(d, dPlusOne)); assertRewrite( - new EqualTo(new Cast(d, DateTimeV2Type.INSTANCE), dt), - new EqualTo(new Cast(d, DateTimeV2Type.INSTANCE), dt)); + new EqualTo(new Cast(d, DateTimeV2Type.SYSTEM_DEFAULT), dt), + new EqualTo(new Cast(d, DateTimeV2Type.SYSTEM_DEFAULT), dt)); // DateV2 -> Date assertRewrite( - new GreaterThan(new Cast(d, DateTimeV2Type.INSTANCE), dv2), + new GreaterThan(new Cast(d, DateTimeV2Type.SYSTEM_DEFAULT), dv2), new GreaterThan(d, d)); // test hour, minute and second all zero Expression dtv2AtZeroClock = new DateTimeV2Literal(1, 1, 1, 0, 0, 0); assertRewrite( - new GreaterThan(new Cast(dv2, DateTimeV2Type.INSTANCE), dtv2AtZeroClock), + new GreaterThan(new Cast(dv2, DateTimeV2Type.SYSTEM_DEFAULT), dtv2AtZeroClock), new GreaterThan(dv2, dv2)); assertRewrite( - new LessThan(new Cast(dv2, DateTimeV2Type.INSTANCE), dtv2AtZeroClock), + new LessThan(new Cast(dv2, DateTimeV2Type.SYSTEM_DEFAULT), dtv2AtZeroClock), new LessThan(dv2, dv2)); assertRewrite( - new EqualTo(new Cast(dv2, DateTimeV2Type.INSTANCE), dtv2AtZeroClock), + new EqualTo(new Cast(dv2, DateTimeV2Type.SYSTEM_DEFAULT), dtv2AtZeroClock), new EqualTo(dv2, dv2)); } diff --git a/fe/fe-core/src/test/java/org/apache/doris/nereids/types/DataTypeTest.java b/fe/fe-core/src/test/java/org/apache/doris/nereids/types/DataTypeTest.java index 6988fce65a..21e9c89280 100644 --- a/fe/fe-core/src/test/java/org/apache/doris/nereids/types/DataTypeTest.java +++ b/fe/fe-core/src/test/java/org/apache/doris/nereids/types/DataTypeTest.java @@ -50,4 +50,62 @@ public class DataTypeTest { Assertions.assertNotEquals(varcharType1, varcharType3); Assertions.assertNotEquals(varcharType1.hashCode(), varcharType3.hashCode()); } + + @Test + void testConvertFromString() { + // boolean + Assertions.assertEquals(BooleanType.INSTANCE, DataType.convertFromString("bool")); + Assertions.assertEquals(BooleanType.INSTANCE, DataType.convertFromString("boolean")); + // tinyint + Assertions.assertEquals(TinyIntType.INSTANCE, DataType.convertFromString("tinyint")); + // smallint + Assertions.assertEquals(SmallIntType.INSTANCE, DataType.convertFromString("smallint")); + // int + Assertions.assertEquals(IntegerType.INSTANCE, DataType.convertFromString("int")); + // bigint + Assertions.assertEquals(BigIntType.INSTANCE, DataType.convertFromString("bigint")); + // largeint + Assertions.assertEquals(LargeIntType.INSTANCE, DataType.convertFromString("largeint")); + // float + Assertions.assertEquals(FloatType.INSTANCE, DataType.convertFromString("float")); + // double + Assertions.assertEquals(DoubleType.INSTANCE, DataType.convertFromString("double")); + // decimalv2 + Assertions.assertEquals(DecimalV2Type.createDecimalV2Type(13, 9), + DataType.convertFromString("decimal(13, 9)")); + // decimalv3 + Assertions.assertEquals(DecimalV3Type.createDecimalV3Type(13, 9), + DataType.convertFromString("decimalv3(13, 9)")); + // text + Assertions.assertEquals(StringType.INSTANCE, DataType.convertFromString("text")); + // string + Assertions.assertEquals(StringType.INSTANCE, DataType.convertFromString("string")); + // char + Assertions.assertEquals(CharType.createCharType(10), DataType.convertFromString("char(10)")); + // varchar + Assertions.assertEquals(VarcharType.createVarcharType(10), DataType.convertFromString("varchar(10)")); + // null + Assertions.assertEquals(NullType.INSTANCE, DataType.convertFromString("null")); + Assertions.assertEquals(NullType.INSTANCE, DataType.convertFromString("null_type")); + // date + Assertions.assertEquals(DateType.INSTANCE, DataType.convertFromString("date")); + // datev2 + Assertions.assertEquals(DateV2Type.INSTANCE, DataType.convertFromString("datev2")); + // time + Assertions.assertEquals(TimeType.INSTANCE, DataType.convertFromString("time")); + // datetime + Assertions.assertEquals(DateTimeType.INSTANCE, DataType.convertFromString("datetime")); + // datetimev2 + Assertions.assertEquals(DateTimeV2Type.of(3), DataType.convertFromString("datetimev2(3)")); + // hll + Assertions.assertEquals(HllType.INSTANCE, DataType.convertFromString("hll")); + // bitmap + Assertions.assertEquals(BitmapType.INSTANCE, DataType.convertFromString("bitmap")); + // quantile_state + Assertions.assertEquals(QuantileStateType.INSTANCE, DataType.convertFromString("quantile_state")); + // json + Assertions.assertEquals(JsonType.INSTANCE, DataType.convertFromString("json")); + // array + Assertions.assertEquals(ArrayType.of(IntegerType.INSTANCE), DataType.convertFromString("array")); + } }