From d2a8f611fde764abc916d1039bc3294f2297d388 Mon Sep 17 00:00:00 2001 From: 924060929 Date: Wed, 4 Dec 2024 16:43:25 +0800 Subject: [PATCH] fix --- .../aggregate_function_orthogonal_bitmap.h | 2 +- .../functions/agg/OrthogonalBitmapExprCalculate.java | 10 ++++------ .../agg/OrthogonalBitmapExprCalculateCount.java | 11 +++++------ .../test_orthogonal_bitmap_expr_calculate.groovy | 11 +++++++++-- 4 files changed, 19 insertions(+), 15 deletions(-) diff --git a/be/src/vec/aggregate_functions/aggregate_function_orthogonal_bitmap.h b/be/src/vec/aggregate_functions/aggregate_function_orthogonal_bitmap.h index a81bdcddaa33100..d7d00140b497f79 100644 --- a/be/src/vec/aggregate_functions/aggregate_function_orthogonal_bitmap.h +++ b/be/src/vec/aggregate_functions/aggregate_function_orthogonal_bitmap.h @@ -234,7 +234,7 @@ struct AggOrthBitmapExprCalBaseData { if (first_init) { DCHECK(argument_size > 1); const auto& col = - assert_cast(*columns[2]); + assert_cast(*columns[2]); std::string expr = col.get_data_at(row_num).to_string(); bitmap_expr_cal.bitmap_calculation_init(expr); first_init = false; diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/agg/OrthogonalBitmapExprCalculate.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/agg/OrthogonalBitmapExprCalculate.java index 53a0d2d3cede036..f68c9f5b93ab75d 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/agg/OrthogonalBitmapExprCalculate.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/agg/OrthogonalBitmapExprCalculate.java @@ -35,12 +35,10 @@ public class OrthogonalBitmapExprCalculate extends NotNullableAggregateFunction implements OrthogonalBitmapFunction, ExplicitlyCastableSignature { - static final List FUNCTION_SIGNATURES = SUPPORTED_TYPES.stream() - .map(type -> - FunctionSignature.ret(BitmapType.INSTANCE) - .varArgs(BitmapType.INSTANCE, type, VarcharType.SYSTEM_DEFAULT) - ) - .collect(ImmutableList.toImmutableList()); + static final List FUNCTION_SIGNATURES = ImmutableList.of( + FunctionSignature.ret(BitmapType.INSTANCE) + .varArgs(BitmapType.INSTANCE, VarcharType.SYSTEM_DEFAULT, VarcharType.SYSTEM_DEFAULT) + ); /** * constructor with 3 arguments. diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/agg/OrthogonalBitmapExprCalculateCount.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/agg/OrthogonalBitmapExprCalculateCount.java index 21ffe74cf3049a3..9bdacf180732f47 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/agg/OrthogonalBitmapExprCalculateCount.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/agg/OrthogonalBitmapExprCalculateCount.java @@ -22,6 +22,7 @@ import org.apache.doris.nereids.trees.expressions.functions.ExplicitlyCastableSignature; import org.apache.doris.nereids.trees.expressions.functions.scalar.BitmapEmpty; import org.apache.doris.nereids.trees.expressions.literal.VarcharLiteral; +import org.apache.doris.nereids.types.BigIntType; import org.apache.doris.nereids.types.BitmapType; import org.apache.doris.nereids.types.VarcharType; import org.apache.doris.nereids.util.ExpressionUtils; @@ -35,12 +36,10 @@ public class OrthogonalBitmapExprCalculateCount extends NotNullableAggregateFunction implements OrthogonalBitmapFunction, ExplicitlyCastableSignature { - static final List FUNCTION_SIGNATURES = SUPPORTED_TYPES.stream() - .map(type -> - FunctionSignature.ret(BitmapType.INSTANCE) - .varArgs(BitmapType.INSTANCE, type, VarcharType.SYSTEM_DEFAULT) - ) - .collect(ImmutableList.toImmutableList()); + static final List FUNCTION_SIGNATURES = ImmutableList.of( + FunctionSignature.ret(BigIntType.INSTANCE) + .varArgs(BitmapType.INSTANCE, VarcharType.SYSTEM_DEFAULT, VarcharType.SYSTEM_DEFAULT) + ); /** * constructor with 3 arguments. diff --git a/regression-test/suites/nereids_function_p0/agg_function/test_orthogonal_bitmap_expr_calculate.groovy b/regression-test/suites/nereids_function_p0/agg_function/test_orthogonal_bitmap_expr_calculate.groovy index bc2ee7f69dd94fd..b47315e96dbcecc 100644 --- a/regression-test/suites/nereids_function_p0/agg_function/test_orthogonal_bitmap_expr_calculate.groovy +++ b/regression-test/suites/nereids_function_p0/agg_function/test_orthogonal_bitmap_expr_calculate.groovy @@ -25,7 +25,7 @@ suite("test_orthogonal_bitmap_expr_calculate") { user_id bitmap bitmap_union ) aggregate key(id, tag) - distributed by hash(id) buckets 10 + distributed by hash(id) buckets 1 properties( 'replication_num'='1' ); @@ -37,7 +37,6 @@ suite("test_orthogonal_bitmap_expr_calculate") { set enable_fallback_to_original_planner=false; """ - test { sql """ select bitmap_to_string(orthogonal_bitmap_expr_calculate(user_id, tag, '(100&200)')) @@ -45,4 +44,12 @@ suite("test_orthogonal_bitmap_expr_calculate") { """ result([['3,4,5']]) } + + test { + sql """ + select orthogonal_bitmap_expr_calculate_count(user_id, tag, '(100&200)') + from test_orthogonal_bitmap_expr_calculate + """ + result([[3L]]) + } }