[Improvement](functions)Optimized some datetime function's return value (#18369)
This commit is contained in:
@ -23,22 +23,22 @@
|
||||
|
||||
namespace doris::vectorized {
|
||||
|
||||
using FunctionYear = FunctionDateOrDateTimeToSomething<DataTypeInt32, ToYearImpl<Int64>>;
|
||||
using FunctionYearV2 = FunctionDateOrDateTimeToSomething<DataTypeInt32, ToYearImpl<UInt32>>;
|
||||
using FunctionQuarter = FunctionDateOrDateTimeToSomething<DataTypeInt32, ToQuarterImpl<Int64>>;
|
||||
using FunctionQuarterV2 = FunctionDateOrDateTimeToSomething<DataTypeInt32, ToQuarterImpl<UInt32>>;
|
||||
using FunctionMonth = FunctionDateOrDateTimeToSomething<DataTypeInt32, ToMonthImpl<Int64>>;
|
||||
using FunctionMonthV2 = FunctionDateOrDateTimeToSomething<DataTypeInt32, ToMonthImpl<UInt32>>;
|
||||
using FunctionDay = FunctionDateOrDateTimeToSomething<DataTypeInt32, ToDayImpl<Int64>>;
|
||||
using FunctionDayV2 = FunctionDateOrDateTimeToSomething<DataTypeInt32, ToDayImpl<UInt32>>;
|
||||
using FunctionWeek = FunctionDateOrDateTimeToSomething<DataTypeInt32, ToWeekOneArgImpl<Int64>>;
|
||||
using FunctionWeekV2 = FunctionDateOrDateTimeToSomething<DataTypeInt32, ToWeekOneArgImpl<UInt32>>;
|
||||
using FunctionHour = FunctionDateOrDateTimeToSomething<DataTypeInt32, ToHourImpl<Int64>>;
|
||||
using FunctionHourV2 = FunctionDateOrDateTimeToSomething<DataTypeInt32, ToHourImpl<UInt32>>;
|
||||
using FunctionMinute = FunctionDateOrDateTimeToSomething<DataTypeInt32, ToMinuteImpl<Int64>>;
|
||||
using FunctionMinuteV2 = FunctionDateOrDateTimeToSomething<DataTypeInt32, ToMinuteImpl<UInt32>>;
|
||||
using FunctionSecond = FunctionDateOrDateTimeToSomething<DataTypeInt32, ToSecondImpl<Int64>>;
|
||||
using FunctionSecondV2 = FunctionDateOrDateTimeToSomething<DataTypeInt32, ToSecondImpl<UInt32>>;
|
||||
using FunctionYear = FunctionDateOrDateTimeToSomething<DataTypeInt16, ToYearImpl<Int64>>;
|
||||
using FunctionYearV2 = FunctionDateOrDateTimeToSomething<DataTypeInt16, ToYearImpl<UInt32>>;
|
||||
using FunctionQuarter = FunctionDateOrDateTimeToSomething<DataTypeInt8, ToQuarterImpl<Int64>>;
|
||||
using FunctionQuarterV2 = FunctionDateOrDateTimeToSomething<DataTypeInt8, ToQuarterImpl<UInt32>>;
|
||||
using FunctionMonth = FunctionDateOrDateTimeToSomething<DataTypeInt8, ToMonthImpl<Int64>>;
|
||||
using FunctionMonthV2 = FunctionDateOrDateTimeToSomething<DataTypeInt8, ToMonthImpl<UInt32>>;
|
||||
using FunctionDay = FunctionDateOrDateTimeToSomething<DataTypeInt8, ToDayImpl<Int64>>;
|
||||
using FunctionDayV2 = FunctionDateOrDateTimeToSomething<DataTypeInt8, ToDayImpl<UInt32>>;
|
||||
using FunctionWeek = FunctionDateOrDateTimeToSomething<DataTypeInt8, ToWeekOneArgImpl<Int64>>;
|
||||
using FunctionWeekV2 = FunctionDateOrDateTimeToSomething<DataTypeInt8, ToWeekOneArgImpl<UInt32>>;
|
||||
using FunctionHour = FunctionDateOrDateTimeToSomething<DataTypeInt8, ToHourImpl<Int64>>;
|
||||
using FunctionHourV2 = FunctionDateOrDateTimeToSomething<DataTypeInt8, ToHourImpl<UInt32>>;
|
||||
using FunctionMinute = FunctionDateOrDateTimeToSomething<DataTypeInt8, ToMinuteImpl<Int64>>;
|
||||
using FunctionMinuteV2 = FunctionDateOrDateTimeToSomething<DataTypeInt8, ToMinuteImpl<UInt32>>;
|
||||
using FunctionSecond = FunctionDateOrDateTimeToSomething<DataTypeInt8, ToSecondImpl<Int64>>;
|
||||
using FunctionSecondV2 = FunctionDateOrDateTimeToSomething<DataTypeInt8, ToSecondImpl<UInt32>>;
|
||||
using FunctionToDays = FunctionDateOrDateTimeToSomething<DataTypeInt32, ToDaysImpl<Int64>>;
|
||||
using FunctionToDaysV2 = FunctionDateOrDateTimeToSomething<DataTypeInt32, ToDaysImpl<UInt32>>;
|
||||
using FunctionToDate = FunctionDateOrDateTimeToSomething<DataTypeDateTime, ToDateImpl<Int64>>;
|
||||
@ -46,19 +46,19 @@ using FunctionToDateV2 = FunctionDateOrDateTimeToSomething<DataTypeDateV2, ToDat
|
||||
using FunctionDate = FunctionDateOrDateTimeToSomething<DataTypeDateTime, DateImpl<Int64>>;
|
||||
using FunctionDateV2 = FunctionDateOrDateTimeToSomething<DataTypeDateV2, DateImpl<UInt32>>;
|
||||
|
||||
using FunctionDateTimeV2Year = FunctionDateOrDateTimeToSomething<DataTypeInt32, ToYearImpl<UInt64>>;
|
||||
using FunctionDateTimeV2Year = FunctionDateOrDateTimeToSomething<DataTypeInt16, ToYearImpl<UInt64>>;
|
||||
using FunctionDateTimeV2Quarter =
|
||||
FunctionDateOrDateTimeToSomething<DataTypeInt32, ToQuarterImpl<UInt64>>;
|
||||
FunctionDateOrDateTimeToSomething<DataTypeInt8, ToQuarterImpl<UInt64>>;
|
||||
using FunctionDateTimeV2Month =
|
||||
FunctionDateOrDateTimeToSomething<DataTypeInt32, ToMonthImpl<UInt64>>;
|
||||
using FunctionDateTimeV2Day = FunctionDateOrDateTimeToSomething<DataTypeInt32, ToDayImpl<UInt64>>;
|
||||
FunctionDateOrDateTimeToSomething<DataTypeInt8, ToMonthImpl<UInt64>>;
|
||||
using FunctionDateTimeV2Day = FunctionDateOrDateTimeToSomething<DataTypeInt8, ToDayImpl<UInt64>>;
|
||||
using FunctionDateTimeV2Week =
|
||||
FunctionDateOrDateTimeToSomething<DataTypeInt32, ToWeekOneArgImpl<UInt64>>;
|
||||
using FunctionDateTimeV2Hour = FunctionDateOrDateTimeToSomething<DataTypeInt32, ToHourImpl<UInt64>>;
|
||||
FunctionDateOrDateTimeToSomething<DataTypeInt8, ToWeekOneArgImpl<UInt64>>;
|
||||
using FunctionDateTimeV2Hour = FunctionDateOrDateTimeToSomething<DataTypeInt8, ToHourImpl<UInt64>>;
|
||||
using FunctionDateTimeV2Minute =
|
||||
FunctionDateOrDateTimeToSomething<DataTypeInt32, ToMinuteImpl<UInt64>>;
|
||||
FunctionDateOrDateTimeToSomething<DataTypeInt8, ToMinuteImpl<UInt64>>;
|
||||
using FunctionDateTimeV2Second =
|
||||
FunctionDateOrDateTimeToSomething<DataTypeInt32, ToSecondImpl<UInt64>>;
|
||||
FunctionDateOrDateTimeToSomething<DataTypeInt8, ToSecondImpl<UInt64>>;
|
||||
using FunctionDateTimeV2ToDays =
|
||||
FunctionDateOrDateTimeToSomething<DataTypeInt32, ToDaysImpl<UInt64>>;
|
||||
using FunctionDateTimeV2ToDate =
|
||||
@ -69,6 +69,42 @@ using FunctionTimeStamp = FunctionDateOrDateTimeToSomething<DataTypeDateTime, Ti
|
||||
using FunctionTimeStampV2 =
|
||||
FunctionDateOrDateTimeToSomething<DataTypeDateTimeV2, TimeStampImpl<UInt64>>;
|
||||
|
||||
/// @TEMPORARY: for be_exec_version=2
|
||||
using FunctionYearOld = FunctionDateOrDateTimeToSomething<DataTypeInt32, ToYearImpl<Int64>>;
|
||||
using FunctionYearV2Old = FunctionDateOrDateTimeToSomething<DataTypeInt32, ToYearImpl<UInt32>>;
|
||||
using FunctionQuarterOld = FunctionDateOrDateTimeToSomething<DataTypeInt32, ToQuarterImpl<Int64>>;
|
||||
using FunctionQuarterV2Old =
|
||||
FunctionDateOrDateTimeToSomething<DataTypeInt32, ToQuarterImpl<UInt32>>;
|
||||
using FunctionMonthOld = FunctionDateOrDateTimeToSomething<DataTypeInt32, ToMonthImpl<Int64>>;
|
||||
using FunctionMonthV2Old = FunctionDateOrDateTimeToSomething<DataTypeInt32, ToMonthImpl<UInt32>>;
|
||||
using FunctionWeekOld = FunctionDateOrDateTimeToSomething<DataTypeInt32, ToWeekOneArgImpl<Int64>>;
|
||||
using FunctionWeekV2Old =
|
||||
FunctionDateOrDateTimeToSomething<DataTypeInt32, ToWeekOneArgImpl<UInt32>>;
|
||||
using FunctionDayOld = FunctionDateOrDateTimeToSomething<DataTypeInt32, ToDayImpl<Int64>>;
|
||||
using FunctionDayV2Old = FunctionDateOrDateTimeToSomething<DataTypeInt32, ToDayImpl<UInt32>>;
|
||||
using FunctionHourOld = FunctionDateOrDateTimeToSomething<DataTypeInt32, ToHourImpl<Int64>>;
|
||||
using FunctionHourV2Old = FunctionDateOrDateTimeToSomething<DataTypeInt32, ToHourImpl<UInt32>>;
|
||||
using FunctionMinuteOld = FunctionDateOrDateTimeToSomething<DataTypeInt32, ToMinuteImpl<Int64>>;
|
||||
using FunctionMinuteV2Old = FunctionDateOrDateTimeToSomething<DataTypeInt32, ToMinuteImpl<UInt32>>;
|
||||
using FunctionSecondOld = FunctionDateOrDateTimeToSomething<DataTypeInt32, ToSecondImpl<Int64>>;
|
||||
using FunctionSecondV2Old = FunctionDateOrDateTimeToSomething<DataTypeInt32, ToSecondImpl<UInt32>>;
|
||||
using FunctionDateTimeV2YearOld =
|
||||
FunctionDateOrDateTimeToSomething<DataTypeInt32, ToYearImpl<UInt64>>;
|
||||
using FunctionDateTimeV2QuarterOld =
|
||||
FunctionDateOrDateTimeToSomething<DataTypeInt32, ToQuarterImpl<UInt64>>;
|
||||
using FunctionDateTimeV2MonthOld =
|
||||
FunctionDateOrDateTimeToSomething<DataTypeInt32, ToMonthImpl<UInt64>>;
|
||||
using FunctionDateTimeV2WeekOld =
|
||||
FunctionDateOrDateTimeToSomething<DataTypeInt32, ToWeekOneArgImpl<UInt64>>;
|
||||
using FunctionDateTimeV2DayOld =
|
||||
FunctionDateOrDateTimeToSomething<DataTypeInt32, ToDayImpl<UInt64>>;
|
||||
using FunctionDateTimeV2HourOld =
|
||||
FunctionDateOrDateTimeToSomething<DataTypeInt32, ToHourImpl<UInt64>>;
|
||||
using FunctionDateTimeV2MinuteOld =
|
||||
FunctionDateOrDateTimeToSomething<DataTypeInt32, ToMinuteImpl<UInt64>>;
|
||||
using FunctionDateTimeV2SecondOld =
|
||||
FunctionDateOrDateTimeToSomething<DataTypeInt32, ToSecondImpl<UInt64>>;
|
||||
|
||||
void register_function_to_time_function(SimpleFunctionFactory& factory) {
|
||||
factory.register_function<FunctionSecond>();
|
||||
factory.register_function<FunctionMinute>();
|
||||
@ -107,6 +143,32 @@ void register_function_to_time_function(SimpleFunctionFactory& factory) {
|
||||
factory.register_function<FunctionDateTimeV2Date>();
|
||||
factory.register_alias("date", "datev2");
|
||||
factory.register_alias("to_date", "to_datev2");
|
||||
|
||||
/// @TEMPORARY: for be_exec_version=2
|
||||
factory.register_alternative_function<FunctionYearOld>();
|
||||
factory.register_alternative_function<FunctionQuarterOld>();
|
||||
factory.register_alternative_function<FunctionMonthOld>();
|
||||
factory.register_alternative_function<FunctionDayOld>();
|
||||
factory.register_alternative_function<FunctionWeekOld>();
|
||||
factory.register_alternative_function<FunctionHourOld>();
|
||||
factory.register_alternative_function<FunctionMinuteOld>();
|
||||
factory.register_alternative_function<FunctionSecondOld>();
|
||||
factory.register_alternative_function<FunctionYearV2Old>();
|
||||
factory.register_alternative_function<FunctionQuarterV2Old>();
|
||||
factory.register_alternative_function<FunctionMonthV2Old>();
|
||||
factory.register_alternative_function<FunctionWeekV2Old>();
|
||||
factory.register_alternative_function<FunctionDayV2Old>();
|
||||
factory.register_alternative_function<FunctionHourV2Old>();
|
||||
factory.register_alternative_function<FunctionMinuteV2Old>();
|
||||
factory.register_alternative_function<FunctionSecondV2Old>();
|
||||
factory.register_alternative_function<FunctionDateTimeV2YearOld>();
|
||||
factory.register_alternative_function<FunctionDateTimeV2QuarterOld>();
|
||||
factory.register_alternative_function<FunctionDateTimeV2MonthOld>();
|
||||
factory.register_alternative_function<FunctionDateTimeV2WeekOld>();
|
||||
factory.register_alternative_function<FunctionDateTimeV2DayOld>();
|
||||
factory.register_alternative_function<FunctionDateTimeV2HourOld>();
|
||||
factory.register_alternative_function<FunctionDateTimeV2MinuteOld>();
|
||||
factory.register_alternative_function<FunctionDateTimeV2SecondOld>();
|
||||
}
|
||||
|
||||
} // namespace doris::vectorized
|
||||
|
||||
Reference in New Issue
Block a user