Skip to content

Commit

Permalink
add multi_distinct_sum0
Browse files Browse the repository at this point in the history
  • Loading branch information
xiedeyantu committed Mar 22, 2024
1 parent b428757 commit fcc79fc
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 59 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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"),
Expand Down
65 changes: 60 additions & 5 deletions fe/fe-core/src/main/java/org/apache/doris/catalog/FunctionSet.java
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand All @@ -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),
Expand All @@ -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),
Expand All @@ -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),
Expand All @@ -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",
Expand Down

0 comments on commit fcc79fc

Please sign in to comment.