ClickHouse/src/Functions/toCustomWeek.cpp

29 lines
1.1 KiB
C++
Raw Normal View History

2019-05-07 11:27:20 +00:00
#include <DataTypes/DataTypesNumber.h>
2019-06-09 15:19:15 +00:00
#include <Functions/CustomWeekTransforms.h>
#include <Functions/FunctionCustomWeekToSomething.h>
#include <Functions/FunctionCustomWeekToDateOrDate32.h>
2019-05-07 11:27:20 +00:00
#include <Functions/FunctionFactory.h>
2021-05-17 07:30:42 +00:00
#include <Functions/IFunction.h>
namespace DB
{
using FunctionToWeek = FunctionCustomWeekToSomething<DataTypeUInt8, ToWeekImpl>;
using FunctionToYearWeek = FunctionCustomWeekToSomething<DataTypeUInt32, ToYearWeekImpl>;
using FunctionToStartOfWeek = FunctionCustomWeekToDateOrDate32<ToStartOfWeekImpl>;
2023-05-18 21:47:52 +00:00
using FunctionToLastDayOfWeek = FunctionCustomWeekToDateOrDate32<ToLastDayOfWeekImpl>;
REGISTER_FUNCTION(ToCustomWeek)
{
factory.registerFunction<FunctionToWeek>();
factory.registerFunction<FunctionToYearWeek>();
factory.registerFunction<FunctionToStartOfWeek>();
factory.registerFunction<FunctionToLastDayOfWeek>();
/// Compatibility aliases for mysql.
factory.registerAlias("week", "toWeek", FunctionFactory::CaseInsensitive);
factory.registerAlias("yearweek", "toYearWeek", FunctionFactory::CaseInsensitive);
}
}