24
24
#include " common/logging.h"
25
25
#include " vec/aggregate_functions/aggregate_function_simple_factory.h"
26
26
#include " vec/aggregate_functions/helpers.h"
27
+ #include " vec/core/types.h"
27
28
#include " vec/data_types/data_type.h"
28
29
#include " vec/data_types/data_type_nullable.h"
29
30
@@ -38,11 +39,33 @@ AggregateFunctionPtr create_aggregate_function_window_funnel(const std::string&
38
39
}
39
40
if (WhichDataType (remove_nullable (argument_types[2 ])).is_date_time_v2 ()) {
40
41
return creator_without_type::create<
41
- AggregateFunctionWindowFunnel<DateV2Value<DateTimeV2ValueType> , UInt64 >>(
42
- argument_types, result_is_nullable);
42
+ AggregateFunctionWindowFunnel<TypeIndex::DateTimeV2 , UInt64 >>(argument_types,
43
+ result_is_nullable);
43
44
} else if (WhichDataType (remove_nullable (argument_types[2 ])).is_date_time ()) {
44
- return creator_without_type::create<AggregateFunctionWindowFunnel<VecDateTimeValue, Int64>>(
45
+ return creator_without_type::create<
46
+ AggregateFunctionWindowFunnel<TypeIndex::DateTime, Int64>>(argument_types,
47
+ result_is_nullable);
48
+ } else {
49
+ LOG (WARNING) << " Only support DateTime type as window argument!" ;
50
+ return nullptr ;
51
+ }
52
+ }
53
+
54
+ AggregateFunctionPtr create_aggregate_function_window_funnel_old (const std::string& name,
55
+ const DataTypes& argument_types,
56
+ const bool result_is_nullable) {
57
+ if (argument_types.size () < 3 ) {
58
+ LOG (WARNING) << " window_funnel's argument less than 3." ;
59
+ return nullptr ;
60
+ }
61
+ if (WhichDataType (remove_nullable (argument_types[2 ])).is_date_time_v2 ()) {
62
+ return creator_without_type::create<
63
+ AggregateFunctionWindowFunnelOld<DateV2Value<DateTimeV2ValueType>, UInt64 >>(
45
64
argument_types, result_is_nullable);
65
+ } else if (WhichDataType (remove_nullable (argument_types[2 ])).is_date_time ()) {
66
+ return creator_without_type::create<
67
+ AggregateFunctionWindowFunnelOld<VecDateTimeValue, Int64>>(argument_types,
68
+ result_is_nullable);
46
69
} else {
47
70
LOG (WARNING) << " Only support DateTime type as window argument!" ;
48
71
return nullptr ;
@@ -52,4 +75,10 @@ AggregateFunctionPtr create_aggregate_function_window_funnel(const std::string&
52
75
void register_aggregate_function_window_funnel (AggregateFunctionSimpleFactory& factory) {
53
76
factory.register_function_both (" window_funnel" , create_aggregate_function_window_funnel);
54
77
}
78
+ void register_aggregate_function_window_funnel_old (AggregateFunctionSimpleFactory& factory) {
79
+ factory.register_alternative_function (" window_funnel" ,
80
+ create_aggregate_function_window_funnel_old, true );
81
+ factory.register_alternative_function (" window_funnel" ,
82
+ create_aggregate_function_window_funnel_old, false );
83
+ }
55
84
} // namespace doris::vectorized
0 commit comments