be/src/exprs/function/time_of_function.cpp
Line | Count | Source |
1 | | // Licensed to the Apache Software Foundation (ASF) under one |
2 | | // or more contributor license agreements. See the NOTICE file |
3 | | // distributed with this work for additional information |
4 | | // regarding copyright ownership. The ASF licenses this file |
5 | | // to you under the Apache License, Version 2.0 (the |
6 | | // "License"); you may not use this file except in compliance |
7 | | // with the License. You may obtain a copy of the License at |
8 | | // |
9 | | // http://www.apache.org/licenses/LICENSE-2.0 |
10 | | // |
11 | | // Unless required by applicable law or agreed to in writing, |
12 | | // software distributed under the License is distributed on an |
13 | | // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
14 | | // KIND, either express or implied. See the License for the |
15 | | // specific language governing permissions and limitations |
16 | | // under the License. |
17 | | |
18 | | #include <boost/iterator/iterator_facade.hpp> |
19 | | |
20 | | #include "core/data_type/data_type_date_or_datetime_v2.h" // IWYU pragma: keep |
21 | | #include "core/data_type/data_type_nullable.h" |
22 | | #include "core/data_type/data_type_number.h" |
23 | | #include "exprs/function/date_time_transforms.h" |
24 | | #include "exprs/function/function_date_or_datetime_to_something.h" |
25 | | #include "exprs/function/simple_function_factory.h" |
26 | | |
27 | | namespace doris { |
28 | | |
29 | | using FunctionWeekOfYearV2 = |
30 | | FunctionDateOrDateTimeToSomething<DataTypeInt8, WeekOfYearImpl<TYPE_DATEV2>>; |
31 | | using FunctionDayOfYearV2 = |
32 | | FunctionDateOrDateTimeToSomething<DataTypeInt16, DayOfYearImpl<TYPE_DATEV2>>; |
33 | | using FunctionDayOfWeekV2 = |
34 | | FunctionDateOrDateTimeToSomething<DataTypeInt8, DayOfWeekImpl<TYPE_DATEV2>>; |
35 | | using FunctionDayOfMonthV2 = |
36 | | FunctionDateOrDateTimeToSomething<DataTypeInt8, DayOfMonthImpl<TYPE_DATEV2>>; |
37 | | using FunctionYearWeekV2 = |
38 | | FunctionDateOrDateTimeToSomething<DataTypeInt32, ToYearWeekOneArgImpl<TYPE_DATEV2>>; |
39 | | using FunctionWeekDayV2 = FunctionDateOrDateTimeToSomething<DataTypeInt8, WeekDayImpl<TYPE_DATEV2>>; |
40 | | |
41 | | using FunctionDateTimeV2WeekOfYear = |
42 | | FunctionDateOrDateTimeToSomething<DataTypeInt8, WeekOfYearImpl<TYPE_DATETIMEV2>>; |
43 | | using FunctionDateTimeV2DayOfYear = |
44 | | FunctionDateOrDateTimeToSomething<DataTypeInt16, DayOfYearImpl<TYPE_DATETIMEV2>>; |
45 | | using FunctionDateTimeV2DayOfWeek = |
46 | | FunctionDateOrDateTimeToSomething<DataTypeInt8, DayOfWeekImpl<TYPE_DATETIMEV2>>; |
47 | | using FunctionDateTimeV2DayOfMonth = |
48 | | FunctionDateOrDateTimeToSomething<DataTypeInt8, DayOfMonthImpl<TYPE_DATETIMEV2>>; |
49 | | using FunctionDateTimeV2YearWeek = |
50 | | FunctionDateOrDateTimeToSomething<DataTypeInt32, ToYearWeekOneArgImpl<TYPE_DATETIMEV2>>; |
51 | | using FunctionDateTimeV2WeekDay = |
52 | | FunctionDateOrDateTimeToSomething<DataTypeInt8, WeekDayImpl<TYPE_DATETIMEV2>>; |
53 | | |
54 | 8 | void register_function_time_of_function(SimpleFunctionFactory& factory) { |
55 | 8 | factory.register_function<FunctionDayOfWeekV2>(); |
56 | 8 | factory.register_function<FunctionDayOfMonthV2>(); |
57 | 8 | factory.register_function<FunctionDayOfYearV2>(); |
58 | 8 | factory.register_function<FunctionWeekOfYearV2>(); |
59 | 8 | factory.register_function<FunctionYearWeekV2>(); |
60 | 8 | factory.register_function<FunctionWeekDayV2>(); |
61 | 8 | factory.register_function<FunctionDateTimeV2WeekOfYear>(); |
62 | 8 | factory.register_function<FunctionDateTimeV2DayOfYear>(); |
63 | 8 | factory.register_function<FunctionDateTimeV2DayOfWeek>(); |
64 | 8 | factory.register_function<FunctionDateTimeV2DayOfMonth>(); |
65 | 8 | factory.register_function<FunctionDateTimeV2YearWeek>(); |
66 | 8 | factory.register_function<FunctionDateTimeV2WeekDay>(); |
67 | 8 | } |
68 | | } // namespace doris |