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>
|
2019-05-07 11:27:20 +00:00
|
|
|
#include <Functions/FunctionFactory.h>
|
2019-12-09 13:12:54 +00:00
|
|
|
#include <Functions/IFunctionImpl.h>
|
2019-05-05 07:54:51 +00:00
|
|
|
|
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
2019-06-18 09:48:07 +00:00
|
|
|
using FunctionToWeek = FunctionCustomWeekToSomething<DataTypeUInt8, ToWeekImpl>;
|
|
|
|
using FunctionToYearWeek = FunctionCustomWeekToSomething<DataTypeUInt32, ToYearWeekImpl>;
|
|
|
|
using FunctionToStartOfWeek = FunctionCustomWeekToSomething<DataTypeDate, ToStartOfWeekImpl>;
|
2019-05-05 07:54:51 +00:00
|
|
|
|
|
|
|
void registerFunctionToCustomWeek(FunctionFactory & factory)
|
|
|
|
{
|
2019-06-18 09:48:07 +00:00
|
|
|
factory.registerFunction<FunctionToWeek>();
|
|
|
|
factory.registerFunction<FunctionToYearWeek>();
|
|
|
|
factory.registerFunction<FunctionToStartOfWeek>();
|
|
|
|
|
|
|
|
/// Compatibility aliases for mysql.
|
|
|
|
factory.registerAlias("week", "toWeek", FunctionFactory::CaseInsensitive);
|
|
|
|
factory.registerAlias("yearweek", "toYearWeek", FunctionFactory::CaseInsensitive);
|
2019-05-05 07:54:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|