[Improvement](functions)Optimized some datetime function's return value (#18369)

This commit is contained in:
zclllyybb
2023-04-19 15:51:11 +08:00
committed by GitHub
parent 1f5f5a12b6
commit fb377a9da9
31 changed files with 462 additions and 279 deletions

View File

@ -22,34 +22,62 @@
namespace doris::vectorized {
using FunctionWeekOfYear = FunctionDateOrDateTimeToSomething<DataTypeInt32, WeekOfYearImpl<Int64>>;
using FunctionWeekOfYear = FunctionDateOrDateTimeToSomething<DataTypeInt8, WeekOfYearImpl<Int64>>;
using FunctionWeekOfYearV2 =
FunctionDateOrDateTimeToSomething<DataTypeInt32, WeekOfYearImpl<UInt32>>;
using FunctionDayOfYear = FunctionDateOrDateTimeToSomething<DataTypeInt32, DayOfYearImpl<Int64>>;
using FunctionDayOfYearV2 = FunctionDateOrDateTimeToSomething<DataTypeInt32, DayOfYearImpl<UInt32>>;
using FunctionDayOfWeek = FunctionDateOrDateTimeToSomething<DataTypeInt32, DayOfWeekImpl<Int64>>;
using FunctionDayOfWeekV2 = FunctionDateOrDateTimeToSomething<DataTypeInt32, DayOfWeekImpl<UInt32>>;
using FunctionDayOfMonth = FunctionDateOrDateTimeToSomething<DataTypeInt32, DayOfMonthImpl<Int64>>;
FunctionDateOrDateTimeToSomething<DataTypeInt8, WeekOfYearImpl<UInt32>>;
using FunctionDayOfYear = FunctionDateOrDateTimeToSomething<DataTypeInt16, DayOfYearImpl<Int64>>;
using FunctionDayOfYearV2 = FunctionDateOrDateTimeToSomething<DataTypeInt16, DayOfYearImpl<UInt32>>;
using FunctionDayOfWeek = FunctionDateOrDateTimeToSomething<DataTypeInt8, DayOfWeekImpl<Int64>>;
using FunctionDayOfWeekV2 = FunctionDateOrDateTimeToSomething<DataTypeInt8, DayOfWeekImpl<UInt32>>;
using FunctionDayOfMonth = FunctionDateOrDateTimeToSomething<DataTypeInt8, DayOfMonthImpl<Int64>>;
using FunctionDayOfMonthV2 =
FunctionDateOrDateTimeToSomething<DataTypeInt32, DayOfMonthImpl<UInt32>>;
FunctionDateOrDateTimeToSomething<DataTypeInt8, DayOfMonthImpl<UInt32>>;
using FunctionYearWeek =
FunctionDateOrDateTimeToSomething<DataTypeInt32, ToYearWeekOneArgImpl<Int64>>;
using FunctionYearWeekV2 =
FunctionDateOrDateTimeToSomething<DataTypeInt32, ToYearWeekOneArgImpl<UInt32>>;
using FunctionWeekDay = FunctionDateOrDateTimeToSomething<DataTypeInt32, WeekDayImpl<Int64>>;
using FunctionWeekDayV2 = FunctionDateOrDateTimeToSomething<DataTypeInt32, WeekDayImpl<UInt32>>;
using FunctionWeekDay = FunctionDateOrDateTimeToSomething<DataTypeInt8, WeekDayImpl<Int64>>;
using FunctionWeekDayV2 = FunctionDateOrDateTimeToSomething<DataTypeInt8, WeekDayImpl<UInt32>>;
using FunctionDateTimeV2WeekOfYear =
FunctionDateOrDateTimeToSomething<DataTypeInt32, WeekOfYearImpl<UInt64>>;
FunctionDateOrDateTimeToSomething<DataTypeInt8, WeekOfYearImpl<UInt64>>;
using FunctionDateTimeV2DayOfYear =
FunctionDateOrDateTimeToSomething<DataTypeInt32, DayOfYearImpl<UInt64>>;
FunctionDateOrDateTimeToSomething<DataTypeInt16, DayOfYearImpl<UInt64>>;
using FunctionDateTimeV2DayOfWeek =
FunctionDateOrDateTimeToSomething<DataTypeInt32, DayOfWeekImpl<UInt64>>;
FunctionDateOrDateTimeToSomething<DataTypeInt8, DayOfWeekImpl<UInt64>>;
using FunctionDateTimeV2DayOfMonth =
FunctionDateOrDateTimeToSomething<DataTypeInt32, DayOfMonthImpl<UInt64>>;
FunctionDateOrDateTimeToSomething<DataTypeInt8, DayOfMonthImpl<UInt64>>;
using FunctionDateTimeV2YearWeek =
FunctionDateOrDateTimeToSomething<DataTypeInt32, ToYearWeekOneArgImpl<UInt64>>;
using FunctionDateTimeV2WeekDay =
FunctionDateOrDateTimeToSomething<DataTypeInt8, WeekDayImpl<UInt64>>;
/// @TEMPORARY: for be_exec_version=2
using FunctionWeekOfYearOld =
FunctionDateOrDateTimeToSomething<DataTypeInt32, WeekOfYearImpl<Int64>>;
using FunctionWeekOfYearV2Old =
FunctionDateOrDateTimeToSomething<DataTypeInt32, WeekOfYearImpl<UInt32>>;
using FunctionDayOfYearOld = FunctionDateOrDateTimeToSomething<DataTypeInt32, DayOfYearImpl<Int64>>;
using FunctionDayOfYearV2Old =
FunctionDateOrDateTimeToSomething<DataTypeInt32, DayOfYearImpl<UInt32>>;
using FunctionDayOfWeekOld = FunctionDateOrDateTimeToSomething<DataTypeInt32, DayOfWeekImpl<Int64>>;
using FunctionDayOfWeekV2Old =
FunctionDateOrDateTimeToSomething<DataTypeInt32, DayOfWeekImpl<UInt32>>;
using FunctionDayOfMonthOld =
FunctionDateOrDateTimeToSomething<DataTypeInt32, DayOfMonthImpl<Int64>>;
using FunctionDayOfMonthV2Old =
FunctionDateOrDateTimeToSomething<DataTypeInt32, DayOfMonthImpl<UInt32>>;
using FunctionWeekDayOld = FunctionDateOrDateTimeToSomething<DataTypeInt32, WeekDayImpl<Int64>>;
using FunctionWeekDayV2Old = FunctionDateOrDateTimeToSomething<DataTypeInt32, WeekDayImpl<UInt32>>;
using FunctionDateTimeV2WeekOfYearOld =
FunctionDateOrDateTimeToSomething<DataTypeInt32, WeekOfYearImpl<UInt64>>;
using FunctionDateTimeV2DayOfYearOld =
FunctionDateOrDateTimeToSomething<DataTypeInt32, DayOfYearImpl<UInt64>>;
using FunctionDateTimeV2DayOfWeekOld =
FunctionDateOrDateTimeToSomething<DataTypeInt32, DayOfWeekImpl<UInt64>>;
using FunctionDateTimeV2DayOfMonthOld =
FunctionDateOrDateTimeToSomething<DataTypeInt32, DayOfMonthImpl<UInt64>>;
using FunctionDateTimeV2WeekDayOld =
FunctionDateOrDateTimeToSomething<DataTypeInt32, WeekDayImpl<UInt64>>;
void register_function_time_of_function(SimpleFunctionFactory& factory) {
@ -71,5 +99,22 @@ void register_function_time_of_function(SimpleFunctionFactory& factory) {
factory.register_function<FunctionDateTimeV2DayOfMonth>();
factory.register_function<FunctionDateTimeV2YearWeek>();
factory.register_function<FunctionDateTimeV2WeekDay>();
/// @TEMPORARY: for be_exec_version=2
factory.register_alternative_function<FunctionWeekOfYearOld>();
factory.register_alternative_function<FunctionWeekOfYearV2Old>();
factory.register_alternative_function<FunctionDateTimeV2WeekOfYearOld>();
factory.register_alternative_function<FunctionDayOfYearOld>();
factory.register_alternative_function<FunctionDayOfYearV2Old>();
factory.register_alternative_function<FunctionDateTimeV2DayOfYearOld>();
factory.register_alternative_function<FunctionDayOfWeekOld>();
factory.register_alternative_function<FunctionDayOfWeekV2Old>();
factory.register_alternative_function<FunctionDateTimeV2DayOfWeekOld>();
factory.register_alternative_function<FunctionDayOfMonthOld>();
factory.register_alternative_function<FunctionDayOfMonthV2Old>();
factory.register_alternative_function<FunctionDateTimeV2DayOfMonthOld>();
factory.register_alternative_function<FunctionWeekDayOld>();
factory.register_alternative_function<FunctionWeekDayV2Old>();
factory.register_alternative_function<FunctionDateTimeV2WeekDayOld>();
}
} // namespace doris::vectorized