[feature][fix](vec)(function) Fix multi args function call the DATETIME type not effective in DATE type and add the alias function (#8050)

1. Support some function alias of mod/fmod, adddate/add_data
2. Support some function of multi args: week, yearweek
3. Fix bug of multi args function call the DATETIME type not effective in DATE type
This commit is contained in:
HappenLee
2022-02-17 10:49:25 +08:00
committed by GitHub
parent 79fd81f035
commit bef1b55c1f
14 changed files with 133 additions and 27 deletions

View File

@ -478,6 +478,48 @@ TEST(TimestampFunctionsTest, date_test) {
check_function<DataTypeDate, true>(func_name, input_types, data_set);
}
TEST(TimestampFunctionsTest, week_test) {
std::string func_name = "week";
InputTypeSet input_types = {TypeIndex::DateTime};
DataSet data_set = {
{{std::string("1989-03-21 06:00:00")}, 12},
{{std::string("")}, Null()},
{{std::string("9999-12-12 00:00:00")}, 50}};
check_function<DataTypeInt32, true>(func_name, input_types, data_set);
InputTypeSet new_input_types = {TypeIndex::Date};
DataSet new_data_set = {
{{std::string("1989-03-21")}, 12},
{{std::string("")}, Null()},
{{std::string("9999-12-12")}, 50}};
check_function<DataTypeInt32, true>(func_name, new_input_types, new_data_set);
}
TEST(TimestampFunctionsTest, yearweek_test) {
std::string func_name = "yearweek";
InputTypeSet input_types = {TypeIndex::DateTime};
DataSet data_set = {
{{std::string("1989-03-21 06:00:00")}, 198912},
{{std::string("")}, Null()},
{{std::string("9999-12-12 00:00:00")}, 999950}};
check_function<DataTypeInt32, true>(func_name, input_types, data_set);
InputTypeSet new_input_types = {TypeIndex::Date};
DataSet new_data_set = {
{{std::string("1989-03-21")}, 198912},
{{std::string("")}, Null()},
{{std::string("9999-12-12")}, 999950}};
check_function<DataTypeInt32, true>(func_name, new_input_types, new_data_set);
}
TEST(TimestampFunctionsTest, makedate_test) {
std::string func_name = "makedate";