From 34c1b1ae66f5ffa1d375a7283ce5c88db2b75691 Mon Sep 17 00:00:00 2001 From: xiedeyantu Date: Wed, 20 Mar 2024 16:18:21 +0800 Subject: [PATCH 1/5] add aggregate function sum0 --- .../aggregate_function_simple_factory.cpp | 2 + .../aggregate_function_sum.cpp | 4 + .../catalog/BuiltinAggregateFunctions.java | 2 + .../org/apache/doris/catalog/FunctionSet.java | 54 ++++---- .../trees/expressions/functions/agg/Sum0.java | 125 ++++++++++++++++++ .../visitor/AggregateFunctionVisitor.java | 5 + 6 files changed, 168 insertions(+), 24 deletions(-) create mode 100644 fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/agg/Sum0.java diff --git a/be/src/vec/aggregate_functions/aggregate_function_simple_factory.cpp b/be/src/vec/aggregate_functions/aggregate_function_simple_factory.cpp index c33b8b50609635..2069e8ae8a49de 100644 --- a/be/src/vec/aggregate_functions/aggregate_function_simple_factory.cpp +++ b/be/src/vec/aggregate_functions/aggregate_function_simple_factory.cpp @@ -31,6 +31,7 @@ void register_aggregate_function_combinator_distinct(AggregateFunctionSimpleFact void register_aggregate_function_combinator_foreach(AggregateFunctionSimpleFactory& factory); void register_aggregate_function_sum(AggregateFunctionSimpleFactory& factory); +void register_aggregate_function_sum0(AggregateFunctionSimpleFactory& factory); void register_aggregate_function_minmax(AggregateFunctionSimpleFactory& factory); void register_aggregate_function_min_by(AggregateFunctionSimpleFactory& factory); void register_aggregate_function_max_by(AggregateFunctionSimpleFactory& factory); @@ -70,6 +71,7 @@ AggregateFunctionSimpleFactory& AggregateFunctionSimpleFactory::instance() { static AggregateFunctionSimpleFactory instance; std::call_once(oc, [&]() { register_aggregate_function_sum(instance); + register_aggregate_function_sum0(instance); register_aggregate_function_minmax(instance); register_aggregate_function_min_by(instance); register_aggregate_function_max_by(instance); diff --git a/be/src/vec/aggregate_functions/aggregate_function_sum.cpp b/be/src/vec/aggregate_functions/aggregate_function_sum.cpp index 3ee7dc6ff48333..e0676957d467df 100644 --- a/be/src/vec/aggregate_functions/aggregate_function_sum.cpp +++ b/be/src/vec/aggregate_functions/aggregate_function_sum.cpp @@ -31,4 +31,8 @@ void register_aggregate_function_sum(AggregateFunctionSimpleFactory& factory) { "sum_decimal256", creator_with_type::creator); } +void register_aggregate_function_sum0(AggregateFunctionSimpleFactory& factory) { + factory.register_function_both("sum0", creator_with_type::creator); +} + } // namespace doris::vectorized diff --git a/fe/fe-core/src/main/java/org/apache/doris/catalog/BuiltinAggregateFunctions.java b/fe/fe-core/src/main/java/org/apache/doris/catalog/BuiltinAggregateFunctions.java index e6134cfc31f9e5..1e631329e28ac3 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/catalog/BuiltinAggregateFunctions.java +++ b/fe/fe-core/src/main/java/org/apache/doris/catalog/BuiltinAggregateFunctions.java @@ -64,6 +64,7 @@ import org.apache.doris.nereids.trees.expressions.functions.agg.Stddev; import org.apache.doris.nereids.trees.expressions.functions.agg.StddevSamp; import org.apache.doris.nereids.trees.expressions.functions.agg.Sum; +import org.apache.doris.nereids.trees.expressions.functions.agg.Sum0; import org.apache.doris.nereids.trees.expressions.functions.agg.TopN; import org.apache.doris.nereids.trees.expressions.functions.agg.TopNArray; import org.apache.doris.nereids.trees.expressions.functions.agg.TopNWeighted; @@ -132,6 +133,7 @@ public class BuiltinAggregateFunctions implements FunctionHelper { agg(Stddev.class, "stddev_pop", "stddev"), agg(StddevSamp.class, "stddev_samp"), agg(Sum.class, "sum"), + agg(Sum0.class, "sum0"), agg(TopN.class, "topn"), agg(TopNArray.class, "topn_array"), agg(TopNWeighted.class, "topn_weighted"), diff --git a/fe/fe-core/src/main/java/org/apache/doris/catalog/FunctionSet.java b/fe/fe-core/src/main/java/org/apache/doris/catalog/FunctionSet.java index b69d52b2c11c1b..5b22d5bbc08470 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/catalog/FunctionSet.java +++ b/fe/fe-core/src/main/java/org/apache/doris/catalog/FunctionSet.java @@ -46,6 +46,7 @@ import java.util.HashSet; import java.util.List; import java.util.Map; +import java.util.Map.Entry; import java.util.Set; public class FunctionSet { @@ -1174,86 +1175,91 @@ private void initAggregateBuiltins() { } // Sum - String []sumNames = {"sum", "sum_distinct"}; - for (String name : sumNames) { - addBuiltin(AggregateFunction.createBuiltin(name, + // functionName(String) -> returnsNonNullOnEmpty(Boolean) + Map sumNames = ImmutableMap.of( + "sum", false, + "sum_distinct", false, + "sum0", true + ); + for (Entry nameWithReturn : sumNames.entrySet()) { + addBuiltin(AggregateFunction.createBuiltin(nameWithReturn.getKey(), Lists.newArrayList(Type.BOOLEAN), Type.BIGINT, Type.BIGINT, "", "", "", null, null, "", - null, false, true, false, true)); + null, false, true, nameWithReturn.getValue(), true)); - addBuiltin(AggregateFunction.createBuiltin(name, + addBuiltin(AggregateFunction.createBuiltin(nameWithReturn.getKey(), Lists.newArrayList(Type.TINYINT), Type.BIGINT, Type.BIGINT, "", "", "", null, null, "", - null, false, true, false, true)); - addBuiltin(AggregateFunction.createBuiltin(name, + null, false, true, nameWithReturn.getValue(), true)); + addBuiltin(AggregateFunction.createBuiltin(nameWithReturn.getKey(), Lists.newArrayList(Type.SMALLINT), Type.BIGINT, Type.BIGINT, "", "", "", null, null, "", - null, false, true, false, true)); - addBuiltin(AggregateFunction.createBuiltin(name, + null, false, true, nameWithReturn.getValue(), true)); + addBuiltin(AggregateFunction.createBuiltin(nameWithReturn.getKey(), Lists.newArrayList(Type.INT), Type.BIGINT, Type.BIGINT, "", "", "", null, null, "", - null, false, true, false, true)); - addBuiltin(AggregateFunction.createBuiltin(name, + null, false, true, nameWithReturn.getValue(), true)); + addBuiltin(AggregateFunction.createBuiltin(nameWithReturn.getKey(), Lists.newArrayList(Type.BIGINT), Type.BIGINT, Type.BIGINT, "", "", "", null, null, "", - null, false, true, false, true)); - addBuiltin(AggregateFunction.createBuiltin(name, + null, false, true, nameWithReturn.getValue(), true)); + addBuiltin(AggregateFunction.createBuiltin(nameWithReturn.getKey(), Lists.newArrayList(Type.DOUBLE), Type.DOUBLE, Type.DOUBLE, "", "", "", null, null, "", - null, false, true, false, true)); - addBuiltin(AggregateFunction.createBuiltin(name, + null, false, true, nameWithReturn.getValue(), true)); + addBuiltin(AggregateFunction.createBuiltin(nameWithReturn.getKey(), Lists.newArrayList(Type.MAX_DECIMALV2_TYPE), Type.MAX_DECIMALV2_TYPE, Type.MAX_DECIMALV2_TYPE, "", "", "", null, null, "", - null, false, true, false, true)); - addBuiltin(AggregateFunction.createBuiltin(name, + null, false, true, nameWithReturn.getValue(), true)); + addBuiltin(AggregateFunction.createBuiltin(nameWithReturn.getKey(), Lists.newArrayList(Type.DECIMAL32), ScalarType.DECIMAL128, Type.DECIMAL128, "", "", "", null, null, "", - null, false, true, false, true)); - addBuiltin(AggregateFunction.createBuiltin(name, + null, false, true, nameWithReturn.getValue(), true)); + addBuiltin(AggregateFunction.createBuiltin(nameWithReturn.getKey(), Lists.newArrayList(Type.DECIMAL64), Type.DECIMAL128, Type.DECIMAL128, "", "", "", null, null, "", - null, false, true, false, true)); - addBuiltin(AggregateFunction.createBuiltin(name, + null, false, true, nameWithReturn.getValue(), true)); + addBuiltin(AggregateFunction.createBuiltin(nameWithReturn.getKey(), Lists.newArrayList(Type.DECIMAL128), Type.DECIMAL128, Type.DECIMAL128, "", "", "", null, null, "", - null, false, true, false, true)); - addBuiltin(AggregateFunction.createBuiltin(name, + null, false, true, nameWithReturn.getValue(), true)); + addBuiltin(AggregateFunction.createBuiltin(nameWithReturn.getKey(), Lists.newArrayList(Type.LARGEINT), Type.LARGEINT, Type.LARGEINT, "", "", "", null, null, "", - null, false, true, false, true)); + null, false, true, nameWithReturn.getValue(), true)); } Type[] types = {Type.SMALLINT, Type.TINYINT, Type.INT, Type.BIGINT, Type.FLOAT, Type.DOUBLE, Type.CHAR, diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/agg/Sum0.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/agg/Sum0.java new file mode 100644 index 00000000000000..da84d0dc75940a --- /dev/null +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/agg/Sum0.java @@ -0,0 +1,125 @@ +// 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. + +package org.apache.doris.nereids.trees.expressions.functions.agg; + +import org.apache.doris.catalog.FunctionSignature; +import org.apache.doris.nereids.exceptions.AnalysisException; +import org.apache.doris.nereids.trees.expressions.Expression; +import org.apache.doris.nereids.trees.expressions.functions.AlwaysNotNullable; +import org.apache.doris.nereids.trees.expressions.functions.ComputePrecisionForSum; +import org.apache.doris.nereids.trees.expressions.functions.ExplicitlyCastableSignature; +import org.apache.doris.nereids.trees.expressions.functions.Function; +import org.apache.doris.nereids.trees.expressions.functions.window.SupportWindowAnalytic; +import org.apache.doris.nereids.trees.expressions.shape.UnaryExpression; +import org.apache.doris.nereids.trees.expressions.visitor.ExpressionVisitor; +import org.apache.doris.nereids.types.BigIntType; +import org.apache.doris.nereids.types.BooleanType; +import org.apache.doris.nereids.types.DataType; +import org.apache.doris.nereids.types.DecimalV3Type; +import org.apache.doris.nereids.types.DoubleType; +import org.apache.doris.nereids.types.FloatType; +import org.apache.doris.nereids.types.IntegerType; +import org.apache.doris.nereids.types.LargeIntType; +import org.apache.doris.nereids.types.SmallIntType; +import org.apache.doris.nereids.types.TinyIntType; + +import com.google.common.base.Preconditions; +import com.google.common.collect.ImmutableList; + +import java.util.List; + +/** + * AggregateFunction 'sum0'. sum0 returns the sum of the values which go into it like sum. + * It differs in that when no non null values are applied zero is returned instead of null. + */ +public class Sum0 extends AggregateFunction + implements UnaryExpression, AlwaysNotNullable, ExplicitlyCastableSignature, ComputePrecisionForSum, + SupportWindowAnalytic, CouldRollUp { + + public static final List SIGNATURES = ImmutableList.of( + FunctionSignature.ret(BigIntType.INSTANCE).args(BooleanType.INSTANCE), + FunctionSignature.ret(BigIntType.INSTANCE).args(TinyIntType.INSTANCE), + FunctionSignature.ret(BigIntType.INSTANCE).args(SmallIntType.INSTANCE), + FunctionSignature.ret(BigIntType.INSTANCE).args(IntegerType.INSTANCE), + FunctionSignature.ret(BigIntType.INSTANCE).args(BigIntType.INSTANCE), + FunctionSignature.ret(LargeIntType.INSTANCE).args(LargeIntType.INSTANCE), + FunctionSignature.ret(DecimalV3Type.WILDCARD).args(DecimalV3Type.WILDCARD), + FunctionSignature.ret(DoubleType.INSTANCE).args(DoubleType.INSTANCE) + ); + + /** + * constructor with 1 argument. + */ + public Sum0(Expression arg) { + this(false, arg); + } + + /** + * constructor with 2 argument. + */ + public Sum0(boolean distinct, Expression arg) { + super("sum0", distinct, arg); + } + + public MultiDistinctSum convertToMultiDistinct() { + Preconditions.checkArgument(distinct, + "can't convert to multi_distinct_sum because there is no distinct args"); + return new MultiDistinctSum(false, child()); + } + + @Override + public void checkLegalityBeforeTypeCoercion() { + DataType argType = child().getDataType(); + if ((!argType.isNumericType() && !argType.isBooleanType() && !argType.isNullType()) + || argType.isOnlyMetricType()) { + throw new AnalysisException("sum requires a numeric or boolean parameter: " + this.toSql()); + } + } + + /** + * withDistinctAndChildren. + */ + @Override + public Sum0 withDistinctAndChildren(boolean distinct, List children) { + Preconditions.checkArgument(children.size() == 1); + return new Sum0(distinct, children.get(0)); + } + + @Override + public R accept(ExpressionVisitor visitor, C context) { + return visitor.visitSum0(this, context); + } + + @Override + public List getSignatures() { + return SIGNATURES; + } + + @Override + public FunctionSignature searchSignature(List signatures) { + if (getArgument(0).getDataType() instanceof FloatType) { + return FunctionSignature.ret(DoubleType.INSTANCE).args(FloatType.INSTANCE); + } + return ExplicitlyCastableSignature.super.searchSignature(signatures); + } + + @Override + public Function constructRollUp(Expression param, Expression... varParams) { + return new Sum0(this.distinct, param); + } +} diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/visitor/AggregateFunctionVisitor.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/visitor/AggregateFunctionVisitor.java index 594f9c754335aa..bb7c9286d4912a 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/visitor/AggregateFunctionVisitor.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/visitor/AggregateFunctionVisitor.java @@ -66,6 +66,7 @@ import org.apache.doris.nereids.trees.expressions.functions.agg.Stddev; import org.apache.doris.nereids.trees.expressions.functions.agg.StddevSamp; import org.apache.doris.nereids.trees.expressions.functions.agg.Sum; +import org.apache.doris.nereids.trees.expressions.functions.agg.Sum0; import org.apache.doris.nereids.trees.expressions.functions.agg.TopN; import org.apache.doris.nereids.trees.expressions.functions.agg.TopNArray; import org.apache.doris.nereids.trees.expressions.functions.agg.TopNWeighted; @@ -274,6 +275,10 @@ default R visitSum(Sum sum, C context) { return visitNullableAggregateFunction(sum, context); } + default R visitSum0(Sum0 sum0, C context) { + return visitAggregateFunction(sum0, context); + } + default R visitTopN(TopN topN, C context) { return visitAggregateFunction(topN, context); } From 8b9375649f16bbd7d1d0b2c3eeb70d81d0bba699 Mon Sep 17 00:00:00 2001 From: chen Date: Fri, 22 Mar 2024 19:02:48 +0800 Subject: [PATCH 2/5] Update fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/agg/Sum0.java Co-authored-by: morrySnow <101034200+morrySnow@users.noreply.github.com> --- .../doris/nereids/trees/expressions/functions/agg/Sum0.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/agg/Sum0.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/agg/Sum0.java index da84d0dc75940a..980d368ec2e873 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/agg/Sum0.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/agg/Sum0.java @@ -87,7 +87,7 @@ public void checkLegalityBeforeTypeCoercion() { DataType argType = child().getDataType(); if ((!argType.isNumericType() && !argType.isBooleanType() && !argType.isNullType()) || argType.isOnlyMetricType()) { - throw new AnalysisException("sum requires a numeric or boolean parameter: " + this.toSql()); + throw new AnalysisException("sum0 requires a numeric or boolean parameter: " + this.toSql()); } } From b428757d3708cb5b41f9abd222463ad5cc11ebcb Mon Sep 17 00:00:00 2001 From: xiedeyantu Date: Fri, 22 Mar 2024 23:47:41 +0800 Subject: [PATCH 3/5] add --- .../functions/agg/MultiDistinctSum0.java | 82 +++++++++++++++++++ .../trees/expressions/functions/agg/Sum0.java | 4 +- .../visitor/AggregateFunctionVisitor.java | 61 ++------------ 3 files changed, 89 insertions(+), 58 deletions(-) create mode 100644 fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/agg/MultiDistinctSum0.java diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/agg/MultiDistinctSum0.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/agg/MultiDistinctSum0.java new file mode 100644 index 00000000000000..89999258713e50 --- /dev/null +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/agg/MultiDistinctSum0.java @@ -0,0 +1,82 @@ +// 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. + +package org.apache.doris.nereids.trees.expressions.functions.agg; + +import org.apache.doris.catalog.FunctionSignature; +import org.apache.doris.nereids.exceptions.AnalysisException; +import org.apache.doris.nereids.trees.expressions.Expression; +import org.apache.doris.nereids.trees.expressions.functions.AlwaysNotNullable; +import org.apache.doris.nereids.trees.expressions.functions.ComputePrecisionForSum; +import org.apache.doris.nereids.trees.expressions.functions.ExplicitlyCastableSignature; +import org.apache.doris.nereids.trees.expressions.shape.UnaryExpression; +import org.apache.doris.nereids.trees.expressions.visitor.ExpressionVisitor; +import org.apache.doris.nereids.types.BigIntType; +import org.apache.doris.nereids.types.DoubleType; +import org.apache.doris.nereids.types.LargeIntType; + +import com.google.common.base.Preconditions; +import com.google.common.collect.ImmutableList; + +import java.util.List; + +/** MultiDistinctSum0 */ +public class MultiDistinctSum0 extends AggregateFunction implements UnaryExpression, + ExplicitlyCastableSignature, ComputePrecisionForSum, MultiDistinction, AlwaysNotNullable { + + public static final List SIGNATURES = ImmutableList.of( + FunctionSignature.ret(BigIntType.INSTANCE).varArgs(BigIntType.INSTANCE), + FunctionSignature.ret(BigIntType.INSTANCE).varArgs(DoubleType.INSTANCE), + FunctionSignature.ret(BigIntType.INSTANCE).varArgs(LargeIntType.INSTANCE) + ); + + public MultiDistinctSum0(Expression arg0) { + super("multi_distinct_sum0", true, arg0); + } + + public MultiDistinctSum0(boolean distinct, Expression arg0) { + super("multi_distinct_sum0", true, arg0); + } + + @Override + public void checkLegalityBeforeTypeCoercion() { + if (child().getDataType().isDateLikeType()) { + throw new AnalysisException("Sum0 in multi distinct functions do not support Date/Datetime type"); + } + } + + @Override + public List getSignatures() { + return new Sum0(getArgument(0)).getSignatures(); + } + + @Override + public FunctionSignature searchSignature(List signatures) { + return new Sum0(getArgument(0)).searchSignature(signatures); + } + + @Override + public MultiDistinctSum0 withDistinctAndChildren(boolean distinct, List children) { + Preconditions.checkArgument(children.size() == 1); + return new MultiDistinctSum0(distinct, children.get(0)); + } + + @Override + public R accept(ExpressionVisitor visitor, C context) { + return visitor.visitMultiDistinctSum0(this, context); + } +} diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/agg/Sum0.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/agg/Sum0.java index 980d368ec2e873..b25dd5fe60e786 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/agg/Sum0.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/agg/Sum0.java @@ -76,10 +76,10 @@ public Sum0(boolean distinct, Expression arg) { super("sum0", distinct, arg); } - public MultiDistinctSum convertToMultiDistinct() { + public MultiDistinctSum0 convertToMultiDistinct() { Preconditions.checkArgument(distinct, "can't convert to multi_distinct_sum because there is no distinct args"); - return new MultiDistinctSum(false, child()); + return new MultiDistinctSum0(false, child()); } @Override diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/visitor/AggregateFunctionVisitor.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/visitor/AggregateFunctionVisitor.java index bb7c9286d4912a..a9a6caf2c98a34 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/visitor/AggregateFunctionVisitor.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/visitor/AggregateFunctionVisitor.java @@ -17,62 +17,7 @@ package org.apache.doris.nereids.trees.expressions.visitor; -import org.apache.doris.nereids.trees.expressions.functions.agg.AggregateFunction; -import org.apache.doris.nereids.trees.expressions.functions.agg.AnyValue; -import org.apache.doris.nereids.trees.expressions.functions.agg.ArrayAgg; -import org.apache.doris.nereids.trees.expressions.functions.agg.Avg; -import org.apache.doris.nereids.trees.expressions.functions.agg.AvgWeighted; -import org.apache.doris.nereids.trees.expressions.functions.agg.BitmapAgg; -import org.apache.doris.nereids.trees.expressions.functions.agg.BitmapIntersect; -import org.apache.doris.nereids.trees.expressions.functions.agg.BitmapUnion; -import org.apache.doris.nereids.trees.expressions.functions.agg.BitmapUnionCount; -import org.apache.doris.nereids.trees.expressions.functions.agg.BitmapUnionInt; -import org.apache.doris.nereids.trees.expressions.functions.agg.CollectList; -import org.apache.doris.nereids.trees.expressions.functions.agg.CollectSet; -import org.apache.doris.nereids.trees.expressions.functions.agg.Corr; -import org.apache.doris.nereids.trees.expressions.functions.agg.Count; -import org.apache.doris.nereids.trees.expressions.functions.agg.CountByEnum; -import org.apache.doris.nereids.trees.expressions.functions.agg.Covar; -import org.apache.doris.nereids.trees.expressions.functions.agg.CovarSamp; -import org.apache.doris.nereids.trees.expressions.functions.agg.GroupBitAnd; -import org.apache.doris.nereids.trees.expressions.functions.agg.GroupBitOr; -import org.apache.doris.nereids.trees.expressions.functions.agg.GroupBitXor; -import org.apache.doris.nereids.trees.expressions.functions.agg.GroupBitmapXor; -import org.apache.doris.nereids.trees.expressions.functions.agg.GroupConcat; -import org.apache.doris.nereids.trees.expressions.functions.agg.Histogram; -import org.apache.doris.nereids.trees.expressions.functions.agg.HllUnion; -import org.apache.doris.nereids.trees.expressions.functions.agg.HllUnionAgg; -import org.apache.doris.nereids.trees.expressions.functions.agg.IntersectCount; -import org.apache.doris.nereids.trees.expressions.functions.agg.MapAgg; -import org.apache.doris.nereids.trees.expressions.functions.agg.Max; -import org.apache.doris.nereids.trees.expressions.functions.agg.MaxBy; -import org.apache.doris.nereids.trees.expressions.functions.agg.Min; -import org.apache.doris.nereids.trees.expressions.functions.agg.MinBy; -import org.apache.doris.nereids.trees.expressions.functions.agg.MultiDistinctCount; -import org.apache.doris.nereids.trees.expressions.functions.agg.MultiDistinctGroupConcat; -import org.apache.doris.nereids.trees.expressions.functions.agg.MultiDistinctSum; -import org.apache.doris.nereids.trees.expressions.functions.agg.Ndv; -import org.apache.doris.nereids.trees.expressions.functions.agg.NullableAggregateFunction; -import org.apache.doris.nereids.trees.expressions.functions.agg.OrthogonalBitmapIntersect; -import org.apache.doris.nereids.trees.expressions.functions.agg.OrthogonalBitmapIntersectCount; -import org.apache.doris.nereids.trees.expressions.functions.agg.OrthogonalBitmapUnionCount; -import org.apache.doris.nereids.trees.expressions.functions.agg.Percentile; -import org.apache.doris.nereids.trees.expressions.functions.agg.PercentileApprox; -import org.apache.doris.nereids.trees.expressions.functions.agg.PercentileArray; -import org.apache.doris.nereids.trees.expressions.functions.agg.QuantileUnion; -import org.apache.doris.nereids.trees.expressions.functions.agg.Retention; -import org.apache.doris.nereids.trees.expressions.functions.agg.SequenceCount; -import org.apache.doris.nereids.trees.expressions.functions.agg.SequenceMatch; -import org.apache.doris.nereids.trees.expressions.functions.agg.Stddev; -import org.apache.doris.nereids.trees.expressions.functions.agg.StddevSamp; -import org.apache.doris.nereids.trees.expressions.functions.agg.Sum; -import org.apache.doris.nereids.trees.expressions.functions.agg.Sum0; -import org.apache.doris.nereids.trees.expressions.functions.agg.TopN; -import org.apache.doris.nereids.trees.expressions.functions.agg.TopNArray; -import org.apache.doris.nereids.trees.expressions.functions.agg.TopNWeighted; -import org.apache.doris.nereids.trees.expressions.functions.agg.Variance; -import org.apache.doris.nereids.trees.expressions.functions.agg.VarianceSamp; -import org.apache.doris.nereids.trees.expressions.functions.agg.WindowFunnel; +import org.apache.doris.nereids.trees.expressions.functions.agg.*; import org.apache.doris.nereids.trees.expressions.functions.combinator.ForEachCombinator; import org.apache.doris.nereids.trees.expressions.functions.combinator.MergeCombinator; import org.apache.doris.nereids.trees.expressions.functions.combinator.UnionCombinator; @@ -163,6 +108,10 @@ default R visitMultiDistinctSum(MultiDistinctSum multiDistinctSum, C context) { return visitAggregateFunction(multiDistinctSum, context); } + default R visitMultiDistinctSum0(MultiDistinctSum0 multiDistinctSum0, C context) { + return visitAggregateFunction(multiDistinctSum0, context); + } + default R visitGroupBitAnd(GroupBitAnd groupBitAnd, C context) { return visitNullableAggregateFunction(groupBitAnd, context); } From fcc79fc3b0dd966cdcb79c727147cc8889e601a3 Mon Sep 17 00:00:00 2001 From: xiedeyantu Date: Sat, 23 Mar 2024 00:08:58 +0800 Subject: [PATCH 4/5] add multi_distinct_sum0 --- .../catalog/BuiltinAggregateFunctions.java | 56 +--------------- .../org/apache/doris/catalog/FunctionSet.java | 65 +++++++++++++++++-- 2 files changed, 62 insertions(+), 59 deletions(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/catalog/BuiltinAggregateFunctions.java b/fe/fe-core/src/main/java/org/apache/doris/catalog/BuiltinAggregateFunctions.java index 1e631329e28ac3..79404a85746fe8 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/catalog/BuiltinAggregateFunctions.java +++ b/fe/fe-core/src/main/java/org/apache/doris/catalog/BuiltinAggregateFunctions.java @@ -17,60 +17,7 @@ package org.apache.doris.catalog; -import org.apache.doris.nereids.trees.expressions.functions.agg.AnyValue; -import org.apache.doris.nereids.trees.expressions.functions.agg.ArrayAgg; -import org.apache.doris.nereids.trees.expressions.functions.agg.Avg; -import org.apache.doris.nereids.trees.expressions.functions.agg.AvgWeighted; -import org.apache.doris.nereids.trees.expressions.functions.agg.BitmapAgg; -import org.apache.doris.nereids.trees.expressions.functions.agg.BitmapIntersect; -import org.apache.doris.nereids.trees.expressions.functions.agg.BitmapUnion; -import org.apache.doris.nereids.trees.expressions.functions.agg.BitmapUnionCount; -import org.apache.doris.nereids.trees.expressions.functions.agg.BitmapUnionInt; -import org.apache.doris.nereids.trees.expressions.functions.agg.CollectList; -import org.apache.doris.nereids.trees.expressions.functions.agg.CollectSet; -import org.apache.doris.nereids.trees.expressions.functions.agg.Corr; -import org.apache.doris.nereids.trees.expressions.functions.agg.Count; -import org.apache.doris.nereids.trees.expressions.functions.agg.CountByEnum; -import org.apache.doris.nereids.trees.expressions.functions.agg.Covar; -import org.apache.doris.nereids.trees.expressions.functions.agg.CovarSamp; -import org.apache.doris.nereids.trees.expressions.functions.agg.GroupBitAnd; -import org.apache.doris.nereids.trees.expressions.functions.agg.GroupBitOr; -import org.apache.doris.nereids.trees.expressions.functions.agg.GroupBitXor; -import org.apache.doris.nereids.trees.expressions.functions.agg.GroupBitmapXor; -import org.apache.doris.nereids.trees.expressions.functions.agg.GroupConcat; -import org.apache.doris.nereids.trees.expressions.functions.agg.Histogram; -import org.apache.doris.nereids.trees.expressions.functions.agg.HllUnion; -import org.apache.doris.nereids.trees.expressions.functions.agg.HllUnionAgg; -import org.apache.doris.nereids.trees.expressions.functions.agg.IntersectCount; -import org.apache.doris.nereids.trees.expressions.functions.agg.MapAgg; -import org.apache.doris.nereids.trees.expressions.functions.agg.Max; -import org.apache.doris.nereids.trees.expressions.functions.agg.MaxBy; -import org.apache.doris.nereids.trees.expressions.functions.agg.Min; -import org.apache.doris.nereids.trees.expressions.functions.agg.MinBy; -import org.apache.doris.nereids.trees.expressions.functions.agg.MultiDistinctCount; -import org.apache.doris.nereids.trees.expressions.functions.agg.MultiDistinctGroupConcat; -import org.apache.doris.nereids.trees.expressions.functions.agg.MultiDistinctSum; -import org.apache.doris.nereids.trees.expressions.functions.agg.Ndv; -import org.apache.doris.nereids.trees.expressions.functions.agg.OrthogonalBitmapIntersect; -import org.apache.doris.nereids.trees.expressions.functions.agg.OrthogonalBitmapIntersectCount; -import org.apache.doris.nereids.trees.expressions.functions.agg.OrthogonalBitmapUnionCount; -import org.apache.doris.nereids.trees.expressions.functions.agg.Percentile; -import org.apache.doris.nereids.trees.expressions.functions.agg.PercentileApprox; -import org.apache.doris.nereids.trees.expressions.functions.agg.PercentileArray; -import org.apache.doris.nereids.trees.expressions.functions.agg.QuantileUnion; -import org.apache.doris.nereids.trees.expressions.functions.agg.Retention; -import org.apache.doris.nereids.trees.expressions.functions.agg.SequenceCount; -import org.apache.doris.nereids.trees.expressions.functions.agg.SequenceMatch; -import org.apache.doris.nereids.trees.expressions.functions.agg.Stddev; -import org.apache.doris.nereids.trees.expressions.functions.agg.StddevSamp; -import org.apache.doris.nereids.trees.expressions.functions.agg.Sum; -import org.apache.doris.nereids.trees.expressions.functions.agg.Sum0; -import org.apache.doris.nereids.trees.expressions.functions.agg.TopN; -import org.apache.doris.nereids.trees.expressions.functions.agg.TopNArray; -import org.apache.doris.nereids.trees.expressions.functions.agg.TopNWeighted; -import org.apache.doris.nereids.trees.expressions.functions.agg.Variance; -import org.apache.doris.nereids.trees.expressions.functions.agg.VarianceSamp; -import org.apache.doris.nereids.trees.expressions.functions.agg.WindowFunnel; +import org.apache.doris.nereids.trees.expressions.functions.agg.*; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableSet; @@ -119,6 +66,7 @@ public class BuiltinAggregateFunctions implements FunctionHelper { agg(MultiDistinctCount.class, "multi_distinct_count"), agg(MultiDistinctGroupConcat.class, "multi_distinct_group_concat"), agg(MultiDistinctSum.class, "multi_distinct_sum"), + agg(MultiDistinctSum0.class, "multi_distinct_sum0"), agg(Ndv.class, "approx_count_distinct", "ndv"), agg(OrthogonalBitmapIntersect.class, "orthogonal_bitmap_intersect"), agg(OrthogonalBitmapIntersectCount.class, "orthogonal_bitmap_intersect_count"), diff --git a/fe/fe-core/src/main/java/org/apache/doris/catalog/FunctionSet.java b/fe/fe-core/src/main/java/org/apache/doris/catalog/FunctionSet.java index 5b22d5bbc08470..b5ae304b7555de 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/catalog/FunctionSet.java +++ b/fe/fe-core/src/main/java/org/apache/doris/catalog/FunctionSet.java @@ -934,7 +934,18 @@ private void initAggregateBuiltins() { null, null, "", - false, true, true, true)); + false, true, false, true)); + addBuiltin(AggregateFunction.createBuiltin("multi_distinct_sum0", Lists.newArrayList(t), + t, + t, + "", + "", + "", + "", + null, + null, + "", + false, true, true, true)); } else if (t.equals(Type.MAX_DECIMALV2_TYPE)) { // vectorized addBuiltin(AggregateFunction.createBuiltin("multi_distinct_sum", Lists.newArrayList(t), @@ -947,7 +958,18 @@ private void initAggregateBuiltins() { null, null, "", - false, true, true, true)); + false, true, false, true)); + addBuiltin(AggregateFunction.createBuiltin("multi_distinct_sum0", Lists.newArrayList(t), + MULTI_DISTINCT_SUM_RETURN_TYPE.get(t), + Type.MAX_DECIMALV2_TYPE, + "", + "", + "", + "", + null, + null, + "", + false, true, true, true)); } else if (t.equals(Type.DECIMAL32)) { // vectorized addBuiltin(AggregateFunction.createBuiltin("multi_distinct_sum", Lists.newArrayList(t), @@ -960,7 +982,18 @@ private void initAggregateBuiltins() { null, null, "", - false, true, true, true)); + false, true, false, true)); + addBuiltin(AggregateFunction.createBuiltin("multi_distinct_sum0", Lists.newArrayList(t), + MULTI_DISTINCT_SUM_RETURN_TYPE.get(t), + Type.DECIMAL32, + "", + "", + "", + "", + null, + null, + "", + false, true, true, true)); } else if (t.equals(Type.DECIMAL64)) { addBuiltin(AggregateFunction.createBuiltin("multi_distinct_sum", Lists.newArrayList(t), MULTI_DISTINCT_SUM_RETURN_TYPE.get(t), @@ -972,7 +1005,18 @@ private void initAggregateBuiltins() { null, null, "", - false, true, true, true)); + false, true, false, true)); + addBuiltin(AggregateFunction.createBuiltin("multi_distinct_sum0", Lists.newArrayList(t), + MULTI_DISTINCT_SUM_RETURN_TYPE.get(t), + Type.DECIMAL64, + "", + "", + "", + "", + null, + null, + "", + false, true, true, true)); } else if (t.equals(Type.DECIMAL128)) { addBuiltin(AggregateFunction.createBuiltin("multi_distinct_sum", Lists.newArrayList(t), MULTI_DISTINCT_SUM_RETURN_TYPE.get(t), @@ -984,7 +1028,18 @@ private void initAggregateBuiltins() { null, null, "", - false, true, true, true)); + false, true, false, true)); + addBuiltin(AggregateFunction.createBuiltin("multi_distinct_sum0", Lists.newArrayList(t), + MULTI_DISTINCT_SUM_RETURN_TYPE.get(t), + Type.DECIMAL128, + "", + "", + "", + "", + null, + null, + "", + false, true, true, true)); } // Min addBuiltin(AggregateFunction.createBuiltin("min", From a0540bd55cda57bac573d77902973f187ed9fb2d Mon Sep 17 00:00:00 2001 From: xiedeyantu Date: Sat, 23 Mar 2024 21:54:26 +0800 Subject: [PATCH 5/5] fix style --- .../catalog/BuiltinAggregateFunctions.java | 56 +++++++++- .../org/apache/doris/catalog/FunctionSet.java | 100 +++++++++--------- .../visitor/AggregateFunctionVisitor.java | 58 +++++++++- 3 files changed, 162 insertions(+), 52 deletions(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/catalog/BuiltinAggregateFunctions.java b/fe/fe-core/src/main/java/org/apache/doris/catalog/BuiltinAggregateFunctions.java index 79404a85746fe8..49e6d66f50e1e2 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/catalog/BuiltinAggregateFunctions.java +++ b/fe/fe-core/src/main/java/org/apache/doris/catalog/BuiltinAggregateFunctions.java @@ -17,7 +17,61 @@ package org.apache.doris.catalog; -import org.apache.doris.nereids.trees.expressions.functions.agg.*; +import org.apache.doris.nereids.trees.expressions.functions.agg.AnyValue; +import org.apache.doris.nereids.trees.expressions.functions.agg.ArrayAgg; +import org.apache.doris.nereids.trees.expressions.functions.agg.Avg; +import org.apache.doris.nereids.trees.expressions.functions.agg.AvgWeighted; +import org.apache.doris.nereids.trees.expressions.functions.agg.BitmapAgg; +import org.apache.doris.nereids.trees.expressions.functions.agg.BitmapIntersect; +import org.apache.doris.nereids.trees.expressions.functions.agg.BitmapUnion; +import org.apache.doris.nereids.trees.expressions.functions.agg.BitmapUnionCount; +import org.apache.doris.nereids.trees.expressions.functions.agg.BitmapUnionInt; +import org.apache.doris.nereids.trees.expressions.functions.agg.CollectList; +import org.apache.doris.nereids.trees.expressions.functions.agg.CollectSet; +import org.apache.doris.nereids.trees.expressions.functions.agg.Corr; +import org.apache.doris.nereids.trees.expressions.functions.agg.Count; +import org.apache.doris.nereids.trees.expressions.functions.agg.CountByEnum; +import org.apache.doris.nereids.trees.expressions.functions.agg.Covar; +import org.apache.doris.nereids.trees.expressions.functions.agg.CovarSamp; +import org.apache.doris.nereids.trees.expressions.functions.agg.GroupBitAnd; +import org.apache.doris.nereids.trees.expressions.functions.agg.GroupBitOr; +import org.apache.doris.nereids.trees.expressions.functions.agg.GroupBitXor; +import org.apache.doris.nereids.trees.expressions.functions.agg.GroupBitmapXor; +import org.apache.doris.nereids.trees.expressions.functions.agg.GroupConcat; +import org.apache.doris.nereids.trees.expressions.functions.agg.Histogram; +import org.apache.doris.nereids.trees.expressions.functions.agg.HllUnion; +import org.apache.doris.nereids.trees.expressions.functions.agg.HllUnionAgg; +import org.apache.doris.nereids.trees.expressions.functions.agg.IntersectCount; +import org.apache.doris.nereids.trees.expressions.functions.agg.MapAgg; +import org.apache.doris.nereids.trees.expressions.functions.agg.Max; +import org.apache.doris.nereids.trees.expressions.functions.agg.MaxBy; +import org.apache.doris.nereids.trees.expressions.functions.agg.Min; +import org.apache.doris.nereids.trees.expressions.functions.agg.MinBy; +import org.apache.doris.nereids.trees.expressions.functions.agg.MultiDistinctCount; +import org.apache.doris.nereids.trees.expressions.functions.agg.MultiDistinctGroupConcat; +import org.apache.doris.nereids.trees.expressions.functions.agg.MultiDistinctSum; +import org.apache.doris.nereids.trees.expressions.functions.agg.MultiDistinctSum0; +import org.apache.doris.nereids.trees.expressions.functions.agg.Ndv; +import org.apache.doris.nereids.trees.expressions.functions.agg.OrthogonalBitmapIntersect; +import org.apache.doris.nereids.trees.expressions.functions.agg.OrthogonalBitmapIntersectCount; +import org.apache.doris.nereids.trees.expressions.functions.agg.OrthogonalBitmapUnionCount; +import org.apache.doris.nereids.trees.expressions.functions.agg.Percentile; +import org.apache.doris.nereids.trees.expressions.functions.agg.PercentileApprox; +import org.apache.doris.nereids.trees.expressions.functions.agg.PercentileArray; +import org.apache.doris.nereids.trees.expressions.functions.agg.QuantileUnion; +import org.apache.doris.nereids.trees.expressions.functions.agg.Retention; +import org.apache.doris.nereids.trees.expressions.functions.agg.SequenceCount; +import org.apache.doris.nereids.trees.expressions.functions.agg.SequenceMatch; +import org.apache.doris.nereids.trees.expressions.functions.agg.Stddev; +import org.apache.doris.nereids.trees.expressions.functions.agg.StddevSamp; +import org.apache.doris.nereids.trees.expressions.functions.agg.Sum; +import org.apache.doris.nereids.trees.expressions.functions.agg.Sum0; +import org.apache.doris.nereids.trees.expressions.functions.agg.TopN; +import org.apache.doris.nereids.trees.expressions.functions.agg.TopNArray; +import org.apache.doris.nereids.trees.expressions.functions.agg.TopNWeighted; +import org.apache.doris.nereids.trees.expressions.functions.agg.Variance; +import org.apache.doris.nereids.trees.expressions.functions.agg.VarianceSamp; +import org.apache.doris.nereids.trees.expressions.functions.agg.WindowFunnel; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableSet; diff --git a/fe/fe-core/src/main/java/org/apache/doris/catalog/FunctionSet.java b/fe/fe-core/src/main/java/org/apache/doris/catalog/FunctionSet.java index b5ae304b7555de..29ff913b8aabac 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/catalog/FunctionSet.java +++ b/fe/fe-core/src/main/java/org/apache/doris/catalog/FunctionSet.java @@ -936,16 +936,16 @@ private void initAggregateBuiltins() { "", false, true, false, true)); addBuiltin(AggregateFunction.createBuiltin("multi_distinct_sum0", Lists.newArrayList(t), - t, - t, - "", - "", - "", - "", - null, - null, - "", - false, true, true, true)); + t, + t, + "", + "", + "", + "", + null, + null, + "", + false, true, true, true)); } else if (t.equals(Type.MAX_DECIMALV2_TYPE)) { // vectorized addBuiltin(AggregateFunction.createBuiltin("multi_distinct_sum", Lists.newArrayList(t), @@ -960,16 +960,16 @@ private void initAggregateBuiltins() { "", false, true, false, true)); addBuiltin(AggregateFunction.createBuiltin("multi_distinct_sum0", Lists.newArrayList(t), - MULTI_DISTINCT_SUM_RETURN_TYPE.get(t), - Type.MAX_DECIMALV2_TYPE, - "", - "", - "", - "", - null, - null, - "", - false, true, true, true)); + MULTI_DISTINCT_SUM_RETURN_TYPE.get(t), + Type.MAX_DECIMALV2_TYPE, + "", + "", + "", + "", + null, + null, + "", + false, true, true, true)); } else if (t.equals(Type.DECIMAL32)) { // vectorized addBuiltin(AggregateFunction.createBuiltin("multi_distinct_sum", Lists.newArrayList(t), @@ -984,16 +984,16 @@ private void initAggregateBuiltins() { "", false, true, false, true)); addBuiltin(AggregateFunction.createBuiltin("multi_distinct_sum0", Lists.newArrayList(t), - MULTI_DISTINCT_SUM_RETURN_TYPE.get(t), - Type.DECIMAL32, - "", - "", - "", - "", - null, - null, - "", - false, true, true, true)); + MULTI_DISTINCT_SUM_RETURN_TYPE.get(t), + Type.DECIMAL32, + "", + "", + "", + "", + null, + null, + "", + false, true, true, true)); } else if (t.equals(Type.DECIMAL64)) { addBuiltin(AggregateFunction.createBuiltin("multi_distinct_sum", Lists.newArrayList(t), MULTI_DISTINCT_SUM_RETURN_TYPE.get(t), @@ -1007,16 +1007,16 @@ private void initAggregateBuiltins() { "", false, true, false, true)); addBuiltin(AggregateFunction.createBuiltin("multi_distinct_sum0", Lists.newArrayList(t), - MULTI_DISTINCT_SUM_RETURN_TYPE.get(t), - Type.DECIMAL64, - "", - "", - "", - "", - null, - null, - "", - false, true, true, true)); + MULTI_DISTINCT_SUM_RETURN_TYPE.get(t), + Type.DECIMAL64, + "", + "", + "", + "", + null, + null, + "", + false, true, true, true)); } else if (t.equals(Type.DECIMAL128)) { addBuiltin(AggregateFunction.createBuiltin("multi_distinct_sum", Lists.newArrayList(t), MULTI_DISTINCT_SUM_RETURN_TYPE.get(t), @@ -1030,16 +1030,16 @@ private void initAggregateBuiltins() { "", false, true, false, true)); addBuiltin(AggregateFunction.createBuiltin("multi_distinct_sum0", Lists.newArrayList(t), - MULTI_DISTINCT_SUM_RETURN_TYPE.get(t), - Type.DECIMAL128, - "", - "", - "", - "", - null, - null, - "", - false, true, true, true)); + MULTI_DISTINCT_SUM_RETURN_TYPE.get(t), + Type.DECIMAL128, + "", + "", + "", + "", + null, + null, + "", + false, true, true, true)); } // Min addBuiltin(AggregateFunction.createBuiltin("min", diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/visitor/AggregateFunctionVisitor.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/visitor/AggregateFunctionVisitor.java index a9a6caf2c98a34..febe93974f264a 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/visitor/AggregateFunctionVisitor.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/visitor/AggregateFunctionVisitor.java @@ -17,7 +17,63 @@ package org.apache.doris.nereids.trees.expressions.visitor; -import org.apache.doris.nereids.trees.expressions.functions.agg.*; +import org.apache.doris.nereids.trees.expressions.functions.agg.AggregateFunction; +import org.apache.doris.nereids.trees.expressions.functions.agg.AnyValue; +import org.apache.doris.nereids.trees.expressions.functions.agg.ArrayAgg; +import org.apache.doris.nereids.trees.expressions.functions.agg.Avg; +import org.apache.doris.nereids.trees.expressions.functions.agg.AvgWeighted; +import org.apache.doris.nereids.trees.expressions.functions.agg.BitmapAgg; +import org.apache.doris.nereids.trees.expressions.functions.agg.BitmapIntersect; +import org.apache.doris.nereids.trees.expressions.functions.agg.BitmapUnion; +import org.apache.doris.nereids.trees.expressions.functions.agg.BitmapUnionCount; +import org.apache.doris.nereids.trees.expressions.functions.agg.BitmapUnionInt; +import org.apache.doris.nereids.trees.expressions.functions.agg.CollectList; +import org.apache.doris.nereids.trees.expressions.functions.agg.CollectSet; +import org.apache.doris.nereids.trees.expressions.functions.agg.Corr; +import org.apache.doris.nereids.trees.expressions.functions.agg.Count; +import org.apache.doris.nereids.trees.expressions.functions.agg.CountByEnum; +import org.apache.doris.nereids.trees.expressions.functions.agg.Covar; +import org.apache.doris.nereids.trees.expressions.functions.agg.CovarSamp; +import org.apache.doris.nereids.trees.expressions.functions.agg.GroupBitAnd; +import org.apache.doris.nereids.trees.expressions.functions.agg.GroupBitOr; +import org.apache.doris.nereids.trees.expressions.functions.agg.GroupBitXor; +import org.apache.doris.nereids.trees.expressions.functions.agg.GroupBitmapXor; +import org.apache.doris.nereids.trees.expressions.functions.agg.GroupConcat; +import org.apache.doris.nereids.trees.expressions.functions.agg.Histogram; +import org.apache.doris.nereids.trees.expressions.functions.agg.HllUnion; +import org.apache.doris.nereids.trees.expressions.functions.agg.HllUnionAgg; +import org.apache.doris.nereids.trees.expressions.functions.agg.IntersectCount; +import org.apache.doris.nereids.trees.expressions.functions.agg.MapAgg; +import org.apache.doris.nereids.trees.expressions.functions.agg.Max; +import org.apache.doris.nereids.trees.expressions.functions.agg.MaxBy; +import org.apache.doris.nereids.trees.expressions.functions.agg.Min; +import org.apache.doris.nereids.trees.expressions.functions.agg.MinBy; +import org.apache.doris.nereids.trees.expressions.functions.agg.MultiDistinctCount; +import org.apache.doris.nereids.trees.expressions.functions.agg.MultiDistinctGroupConcat; +import org.apache.doris.nereids.trees.expressions.functions.agg.MultiDistinctSum; +import org.apache.doris.nereids.trees.expressions.functions.agg.MultiDistinctSum0; +import org.apache.doris.nereids.trees.expressions.functions.agg.Ndv; +import org.apache.doris.nereids.trees.expressions.functions.agg.NullableAggregateFunction; +import org.apache.doris.nereids.trees.expressions.functions.agg.OrthogonalBitmapIntersect; +import org.apache.doris.nereids.trees.expressions.functions.agg.OrthogonalBitmapIntersectCount; +import org.apache.doris.nereids.trees.expressions.functions.agg.OrthogonalBitmapUnionCount; +import org.apache.doris.nereids.trees.expressions.functions.agg.Percentile; +import org.apache.doris.nereids.trees.expressions.functions.agg.PercentileApprox; +import org.apache.doris.nereids.trees.expressions.functions.agg.PercentileArray; +import org.apache.doris.nereids.trees.expressions.functions.agg.QuantileUnion; +import org.apache.doris.nereids.trees.expressions.functions.agg.Retention; +import org.apache.doris.nereids.trees.expressions.functions.agg.SequenceCount; +import org.apache.doris.nereids.trees.expressions.functions.agg.SequenceMatch; +import org.apache.doris.nereids.trees.expressions.functions.agg.Stddev; +import org.apache.doris.nereids.trees.expressions.functions.agg.StddevSamp; +import org.apache.doris.nereids.trees.expressions.functions.agg.Sum; +import org.apache.doris.nereids.trees.expressions.functions.agg.Sum0; +import org.apache.doris.nereids.trees.expressions.functions.agg.TopN; +import org.apache.doris.nereids.trees.expressions.functions.agg.TopNArray; +import org.apache.doris.nereids.trees.expressions.functions.agg.TopNWeighted; +import org.apache.doris.nereids.trees.expressions.functions.agg.Variance; +import org.apache.doris.nereids.trees.expressions.functions.agg.VarianceSamp; +import org.apache.doris.nereids.trees.expressions.functions.agg.WindowFunnel; import org.apache.doris.nereids.trees.expressions.functions.combinator.ForEachCombinator; import org.apache.doris.nereids.trees.expressions.functions.combinator.MergeCombinator; import org.apache.doris.nereids.trees.expressions.functions.combinator.UnionCombinator;