| 1 | #include <DataTypes/DataTypesNumber.h> |
|---|---|
| 2 | #include <Functions/CustomWeekTransforms.h> |
| 3 | #include <Functions/FunctionCustomWeekToSomething.h> |
| 4 | #include <Functions/FunctionFactory.h> |
| 5 | #include <Functions/IFunctionImpl.h> |
| 6 | |
| 7 | |
| 8 | namespace DB |
| 9 | { |
| 10 | using FunctionToWeek = FunctionCustomWeekToSomething<DataTypeUInt8, ToWeekImpl>; |
| 11 | using FunctionToYearWeek = FunctionCustomWeekToSomething<DataTypeUInt32, ToYearWeekImpl>; |
| 12 | using FunctionToStartOfWeek = FunctionCustomWeekToSomething<DataTypeDate, ToStartOfWeekImpl>; |
| 13 | |
| 14 | void registerFunctionToCustomWeek(FunctionFactory & factory) |
| 15 | { |
| 16 | factory.registerFunction<FunctionToWeek>(); |
| 17 | factory.registerFunction<FunctionToYearWeek>(); |
| 18 | factory.registerFunction<FunctionToStartOfWeek>(); |
| 19 | |
| 20 | /// Compatibility aliases for mysql. |
| 21 | factory.registerAlias("week", "toWeek", FunctionFactory::CaseInsensitive); |
| 22 | factory.registerAlias("yearweek", "toYearWeek", FunctionFactory::CaseInsensitive); |
| 23 | } |
| 24 | |
| 25 | } |
| 26 |