Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions be/src/exprs/aggregate/aggregate_function_simple_factory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ void register_aggregate_function_percentile(AggregateFunctionSimpleFactory& fact
void register_aggregate_function_percentile_old(AggregateFunctionSimpleFactory& factory);
void register_aggregate_function_window_funnel(AggregateFunctionSimpleFactory& factory);
void register_aggregate_function_window_funnel_old(AggregateFunctionSimpleFactory& factory);
void register_aggregate_function_window_funnel_v2(AggregateFunctionSimpleFactory& factory);
void register_aggregate_function_regr_union(AggregateFunctionSimpleFactory& factory);
void register_aggregate_function_retention(AggregateFunctionSimpleFactory& factory);
void register_aggregate_function_percentile_approx(AggregateFunctionSimpleFactory& factory);
Expand Down Expand Up @@ -109,6 +110,7 @@ AggregateFunctionSimpleFactory& AggregateFunctionSimpleFactory::instance() {
register_aggregate_function_percentile_approx(instance);
register_aggregate_function_window_funnel(instance);
register_aggregate_function_window_funnel_old(instance);
register_aggregate_function_window_funnel_v2(instance);
register_aggregate_function_regr_union(instance);
register_aggregate_function_retention(instance);
register_aggregate_function_orthogonal_bitmap(instance);
Expand Down
3 changes: 2 additions & 1 deletion be/src/exprs/aggregate/aggregate_function_window_funnel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ AggregateFunctionPtr create_aggregate_function_window_funnel(const std::string&
}

void register_aggregate_function_window_funnel(AggregateFunctionSimpleFactory& factory) {
factory.register_function_both("window_funnel", create_aggregate_function_window_funnel);
factory.register_function_both("window_funnel_v1", create_aggregate_function_window_funnel);
factory.register_alias("window_funnel_v1", "window_funnel");
}
void register_aggregate_function_window_funnel_old(AggregateFunctionSimpleFactory& factory) {
BeExecVersionManager::registe_restrict_function_compatibility("window_funnel");
Expand Down
2 changes: 1 addition & 1 deletion be/src/exprs/aggregate/aggregate_function_window_funnel.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ namespace doris {

enum class WindowFunnelMode : Int64 { INVALID, DEFAULT, DEDUPLICATION, FIXED, INCREASE };

WindowFunnelMode string_to_window_funnel_mode(const String& string) {
inline WindowFunnelMode string_to_window_funnel_mode(const String& string) {
if (string == "default") {
return WindowFunnelMode::DEFAULT;
} else if (string == "deduplication") {
Expand Down
53 changes: 53 additions & 0 deletions be/src/exprs/aggregate/aggregate_function_window_funnel_v2.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
// 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.

#include "exprs/aggregate/aggregate_function_window_funnel_v2.h"

#include <string>

#include "common/logging.h"
#include "core/data_type/data_type.h"
#include "core/types.h"
#include "exprs/aggregate/aggregate_function_simple_factory.h"
#include "exprs/aggregate/helpers.h"

namespace doris {
#include "common/compile_check_begin.h"

AggregateFunctionPtr create_aggregate_function_window_funnel_v2(const std::string& name,
const DataTypes& argument_types,
const DataTypePtr& result_type,
const bool result_is_nullable,
const AggregateFunctionAttr& attr) {
if (argument_types.size() < 3) {
LOG(WARNING) << "window_funnel_v2's argument less than 3.";
return nullptr;
}
if (argument_types[2]->get_primitive_type() == TYPE_DATETIMEV2) {
return creator_without_type::create<AggregateFunctionWindowFunnelV2>(
argument_types, result_is_nullable, attr);
} else {
LOG(WARNING) << "Only support DateTime type as window argument!";
return nullptr;
Comment on lines +36 to +45
Copy link

Copilot AI Mar 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

create_aggregate_function_window_funnel_v2 allows argument_types.size() == 3, but the function requires at least 4 arguments (window, mode, timestamp, and >=1 boolean condition). With 3 args, event_count becomes 0 and the function silently returns 0 instead of rejecting invalid SQL. Update the arity check (and warning message) to require >=4 arguments.

Copilot uses AI. Check for mistakes.
}
}

void register_aggregate_function_window_funnel_v2(AggregateFunctionSimpleFactory& factory) {
factory.register_function_both("window_funnel_v2", create_aggregate_function_window_funnel_v2);
}

} // namespace doris
Loading
Loading