be/src/exprs/function/to_time_function.cpp
Line | Count | Source |
1 | | |
2 | | // Licensed to the Apache Software Foundation (ASF) under one |
3 | | // or more contributor license agreements. See the NOTICE file |
4 | | // distributed with this work for additional information |
5 | | // regarding copyright ownership. The ASF licenses this file |
6 | | // to you under the Apache License, Version 2.0 (the |
7 | | // "License"); you may not use this file except in compliance |
8 | | // with the License. You may obtain a copy of the License at |
9 | | // |
10 | | // http://www.apache.org/licenses/LICENSE-2.0 |
11 | | // |
12 | | // Unless required by applicable law or agreed to in writing, |
13 | | // software distributed under the License is distributed on an |
14 | | // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
15 | | // KIND, either express or implied. See the License for the |
16 | | // specific language governing permissions and limitations |
17 | | // under the License. |
18 | | |
19 | | #include "core/data_type/data_type_date_or_datetime_v2.h" |
20 | | #include "core/data_type/data_type_date_time.h" |
21 | | #include "core/data_type/data_type_number.h" |
22 | | #include "core/types.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 FunctionYearV2 = FunctionDateOrDateTimeToSomething<DataTypeInt16, ToYearImpl<TYPE_DATEV2>>; |
30 | | using FunctionYearOfWeek = |
31 | | FunctionDateOrDateTimeToSomething<DataTypeInt16, ToYearOfWeekImpl<TYPE_DATEV2>>; |
32 | | using FunctionQuarterV2 = |
33 | | FunctionDateOrDateTimeToSomething<DataTypeInt8, ToQuarterImpl<TYPE_DATEV2>>; |
34 | | using FunctionMonthV2 = FunctionDateOrDateTimeToSomething<DataTypeInt8, ToMonthImpl<TYPE_DATEV2>>; |
35 | | using FunctionDayV2 = FunctionDateOrDateTimeToSomething<DataTypeInt8, ToDayImpl<TYPE_DATEV2>>; |
36 | | using FunctionWeekV2 = |
37 | | FunctionDateOrDateTimeToSomething<DataTypeInt8, ToWeekOneArgImpl<TYPE_DATEV2>>; |
38 | | using FunctionHourV2 = FunctionDateOrDateTimeToSomething<DataTypeInt8, ToHourImpl<TYPE_DATEV2>>; |
39 | | using FunctionMinuteV2 = FunctionDateOrDateTimeToSomething<DataTypeInt8, ToMinuteImpl<TYPE_DATEV2>>; |
40 | | using FunctionSecondV2 = FunctionDateOrDateTimeToSomething<DataTypeInt8, ToSecondImpl<TYPE_DATEV2>>; |
41 | | using FunctionToDaysV2 = FunctionDateOrDateTimeToSomething<DataTypeInt32, ToDaysImpl<TYPE_DATEV2>>; |
42 | | using FunctionToDateV2 = FunctionDateOrDateTimeToSomething<DataTypeDateV2, ToDateImpl<TYPE_DATEV2>>; |
43 | | using FunctionDateV2 = FunctionDateOrDateTimeToSomething<DataTypeDateV2, DateImpl<TYPE_DATEV2>>; |
44 | | using FunctionToSeconds = |
45 | | FunctionDateOrDateTimeToSomething<DataTypeInt64, ToSecondsImpl<TYPE_DATETIMEV2>>; |
46 | | |
47 | | using FunctionDateTimeV2Year = |
48 | | FunctionDateOrDateTimeToSomething<DataTypeInt16, ToYearImpl<TYPE_DATETIMEV2>>; |
49 | | using FunctionDateTimeV2Quarter = |
50 | | FunctionDateOrDateTimeToSomething<DataTypeInt8, ToQuarterImpl<TYPE_DATETIMEV2>>; |
51 | | using FunctionDateTimeV2Month = |
52 | | FunctionDateOrDateTimeToSomething<DataTypeInt8, ToMonthImpl<TYPE_DATETIMEV2>>; |
53 | | using FunctionDateTimeV2Day = |
54 | | FunctionDateOrDateTimeToSomething<DataTypeInt8, ToDayImpl<TYPE_DATETIMEV2>>; |
55 | | using FunctionDateTimeV2Week = |
56 | | FunctionDateOrDateTimeToSomething<DataTypeInt8, ToWeekOneArgImpl<TYPE_DATETIMEV2>>; |
57 | | using FunctionDateTimeV2Hour = |
58 | | FunctionDateOrDateTimeToSomething<DataTypeInt8, ToHourImpl<TYPE_DATETIMEV2>>; |
59 | | using FunctionDateTimeV2Minute = |
60 | | FunctionDateOrDateTimeToSomething<DataTypeInt8, ToMinuteImpl<TYPE_DATETIMEV2>>; |
61 | | using FunctionDateTimeV2Second = |
62 | | FunctionDateOrDateTimeToSomething<DataTypeInt8, ToSecondImpl<TYPE_DATETIMEV2>>; |
63 | | using FunctionDateTimeV2MicroSecond = |
64 | | FunctionDateOrDateTimeToSomething<DataTypeInt32, ToMicroSecondImpl<TYPE_DATETIMEV2>>; |
65 | | using FunctionDateTimeV2ToDate = |
66 | | FunctionDateOrDateTimeToSomething<DataTypeDateV2, ToDateImpl<TYPE_DATETIMEV2>>; |
67 | | using FunctionDateTimeV2Date = |
68 | | FunctionDateOrDateTimeToSomething<DataTypeDateV2, DateImpl<TYPE_DATETIMEV2>>; |
69 | | using FunctionTimeStampV2 = |
70 | | FunctionDateOrDateTimeToSomething<DataTypeDateTimeV2, TimeStampImpl<TYPE_DATETIMEV2>>; |
71 | | using FunctionCenturyV2 = |
72 | | FunctionDateOrDateTimeToSomething<DataTypeInt16, ToCenturyImpl<TYPE_DATEV2>>; |
73 | | using FunctionDateTimeV2Century = |
74 | | FunctionDateOrDateTimeToSomething<DataTypeInt16, ToCenturyImpl<TYPE_DATETIMEV2>>; |
75 | 8 | void register_function_to_time_function(SimpleFunctionFactory& factory) { |
76 | 8 | factory.register_function<FunctionTimeStampV2>(); |
77 | 8 | factory.register_function<FunctionSecondV2>(); |
78 | 8 | factory.register_function<FunctionMinuteV2>(); |
79 | 8 | factory.register_function<FunctionHourV2>(); |
80 | 8 | factory.register_function<FunctionDayV2>(); |
81 | 8 | factory.register_function<FunctionWeekV2>(); |
82 | 8 | factory.register_function<FunctionMonthV2>(); |
83 | 8 | factory.register_function<FunctionYearV2>(); |
84 | 8 | factory.register_function<FunctionYearOfWeek>(); |
85 | 8 | factory.register_function<FunctionQuarterV2>(); |
86 | 8 | factory.register_function<FunctionToDaysV2>(); |
87 | 8 | factory.register_function<FunctionToDateV2>(); |
88 | 8 | factory.register_function<FunctionDateV2>(); |
89 | 8 | factory.register_function<FunctionDateTimeV2MicroSecond>(); |
90 | 8 | factory.register_function<FunctionDateTimeV2Second>(); |
91 | 8 | factory.register_function<FunctionDateTimeV2Minute>(); |
92 | 8 | factory.register_function<FunctionDateTimeV2Hour>(); |
93 | 8 | factory.register_function<FunctionDateTimeV2Day>(); |
94 | 8 | factory.register_function<FunctionDateTimeV2Week>(); |
95 | 8 | factory.register_function<FunctionDateTimeV2Month>(); |
96 | 8 | factory.register_function<FunctionDateTimeV2Year>(); |
97 | 8 | factory.register_function<FunctionDateTimeV2Quarter>(); |
98 | 8 | factory.register_function<FunctionDateTimeV2ToDate>(); |
99 | 8 | factory.register_function<FunctionDateTimeV2Date>(); |
100 | 8 | factory.register_function<FunctionCenturyV2>(); |
101 | 8 | factory.register_function<FunctionDateTimeV2Century>(); |
102 | 8 | factory.register_function<FunctionToSeconds>(); |
103 | 8 | factory.register_alias("date", "datev2"); |
104 | 8 | factory.register_alias("to_date", "to_datev2"); |
105 | 8 | } |
106 | | |
107 | | } // namespace doris |