EmmyMiao87 commented on a change in pull request #8485:
URL: https://github.com/apache/incubator-doris/pull/8485#discussion_r826712755



##########
File path: be/src/vec/aggregate_functions/aggregate_function_window_funnel.h
##########
@@ -0,0 +1,212 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+// Refer to AggregateFunctionWindowFunnel.h in 
https://github.com/ClickHouse/ClickHouse.git

Review comment:
       // This file is copied from
   // 
https://github.com/ClickHouse/ClickHouse/blob/master/AggregateFunctionWindowFunnel.h
 
   // and modified by Doris

##########
File path: fe/fe-core/src/main/java/org/apache/doris/catalog/FunctionSet.java
##########
@@ -1242,6 +1242,36 @@ private void initAggregateBuiltins() {
                 prefix + 
"17count_star_removeEPN9doris_udf15FunctionContextEPNS1_9BigIntValE",
                 null, false, true, true, true));
 
+        // windowFunnel
+        addBuiltin(AggregateFunction.createBuiltin("window_funnel",

Review comment:
       Add a const param to save  the name of "window_funnel" ~

##########
File path: 
fe/fe-core/src/main/java/org/apache/doris/catalog/AggregateFunction.java
##########
@@ -49,7 +49,7 @@
     private static final Logger LOG = 
LogManager.getLogger(AggregateFunction.class);
 
     public static ImmutableSet<String> 
NOT_NULLABLE_AGGREGATE_FUNCTION_NAME_SET =
-            ImmutableSet.of("row_number", "rank", "dense_rank", 
"hll_union_agg", "hll_union", "bitmap_union", "bitmap_intersect", 
FunctionSet.COUNT, "ndv", FunctionSet.BITMAP_UNION_INT, 
FunctionSet.BITMAP_UNION_COUNT, "ndv_no_finalize");
+            ImmutableSet.of("row_number", "rank", "dense_rank", 
"hll_union_agg", "hll_union", "bitmap_union", "bitmap_intersect", 
FunctionSet.COUNT, "ndv", FunctionSet.BITMAP_UNION_INT, 
FunctionSet.BITMAP_UNION_COUNT, "ndv_no_finalize", "window_funnel");

Review comment:
       Use const param instead ~

##########
File path: 
fe/fe-core/src/main/java/org/apache/doris/analysis/FunctionCallExpr.java
##########
@@ -766,6 +775,34 @@ public void analyzeImpl(Analyzer analyzer) throws 
AnalysisException {
 
             fn = getBuiltinFunction(analyzer, fnName.getFunction(), new 
Type[]{compatibleType},
                     Function.CompareMode.IS_NONSTRICT_SUPERTYPE_OF);
+        } else if (fnName.getFunction().equalsIgnoreCase("window_funnel")) {

Review comment:
       Use const param instead ~

##########
File path: 
fe/fe-core/src/main/java/org/apache/doris/analysis/FunctionCallExpr.java
##########
@@ -766,6 +775,34 @@ public void analyzeImpl(Analyzer analyzer) throws 
AnalysisException {
 
             fn = getBuiltinFunction(analyzer, fnName.getFunction(), new 
Type[]{compatibleType},
                     Function.CompareMode.IS_NONSTRICT_SUPERTYPE_OF);
+        } else if (fnName.getFunction().equalsIgnoreCase("window_funnel")) {
+            if (fnParams.exprs() == null || fnParams.exprs().size() < 4) {

Review comment:
       Please add some UT to check the function grammar ~

##########
File path: fe/fe-core/src/main/java/org/apache/doris/catalog/FunctionSet.java
##########
@@ -1242,6 +1242,36 @@ private void initAggregateBuiltins() {
                 prefix + 
"17count_star_removeEPN9doris_udf15FunctionContextEPNS1_9BigIntValE",
                 null, false, true, true, true));
 
+        // windowFunnel
+        addBuiltin(AggregateFunction.createBuiltin("window_funnel",
+                Lists.newArrayList(Type.BIGINT, Type.STRING, Type.DATETIME, 
Type.BOOLEAN),
+                Type.INT,
+                Type.VARCHAR,
+                true,
+                prefix + 
"18window_funnel_initEPN9doris_udf15FunctionContextEPNS1_9StringValE",
+                prefix + 
"20window_funnel_updateEPN9doris_udf15FunctionContextERKNS1_9BigIntValERKNS1_9StringValERKNS1_11DateTimeValEiPKNS1_10BooleanValEPS7_",
+                prefix + 
"19window_funnel_mergeEPN9doris_udf15FunctionContextERKNS1_9StringValEPS4_",
+                prefix + 
"23window_funnel_serializeEPN9doris_udf15FunctionContextERKNS1_9StringValE",
+                "",
+                "",
+                prefix + 
"22window_funnel_finalizeEPN9doris_udf15FunctionContextERKNS1_9StringValE",
+                true, false, true));
+
+        // Vectorization does not need symbol any more, we should clean it in 
the future.
+        addBuiltin(AggregateFunction.createBuiltin("window_funnel",

Review comment:
       Use const param instead ~

##########
File path: 
fe/fe-core/src/main/java/org/apache/doris/analysis/FunctionCallExpr.java
##########
@@ -703,6 +711,7 @@ protected String getFunctionNotFoundError(Type[] argTypes) {
 
     @Override
     public void analyzeImpl(Analyzer analyzer) throws AnalysisException {
+

Review comment:
       ```suggestion
   
   ```




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to