diff --git a/fe/fe-core/src/main/java/com/starrocks/sql/parser/AstBuilder.java b/fe/fe-core/src/main/java/com/starrocks/sql/parser/AstBuilder.java index b5926f2bb15e73..56c159eead592d 100644 --- a/fe/fe-core/src/main/java/com/starrocks/sql/parser/AstBuilder.java +++ b/fe/fe-core/src/main/java/com/starrocks/sql/parser/AstBuilder.java @@ -6478,7 +6478,8 @@ public ParseNode visitAggregationFunctionCall(StarRocksParser.AggregationFunctio } // GROUP_CONCAT: use higher version of group_concat if there is order by or distinct clause - if (isGroupConcat && (isDistinct || !CollectionUtils.isEmpty(orderByElements))) { + if (isGroupConcat && (isDistinct || !CollectionUtils.isEmpty(orderByElements) + || context.aggregationFunction().SEPARATOR() != null)) { functionName = FunctionSet.GROUP_CONCAT_V2; if (!exprs.isEmpty() && context.aggregationFunction().SEPARATOR() == null) { Expr sepExpr; diff --git a/fe/fe-core/src/test/java/com/starrocks/sql/plan/DistributedEnvPlanWithCostTest.java b/fe/fe-core/src/test/java/com/starrocks/sql/plan/DistributedEnvPlanWithCostTest.java index fda82fcb680c65..dd46c88e400777 100644 --- a/fe/fe-core/src/test/java/com/starrocks/sql/plan/DistributedEnvPlanWithCostTest.java +++ b/fe/fe-core/src/test/java/com/starrocks/sql/plan/DistributedEnvPlanWithCostTest.java @@ -1606,7 +1606,7 @@ public void testOneTabletDistinctAgg() throws Exception { String sql = "select sum(id), group_concat(distinct name) from skew_table where id = 1 group by id"; String plan = getFragmentPlan(sql); assertContains(plan, "2:AGGREGATE (update finalize)\n" + - " | output: sum(3: sum), group_concat(2: name, ',')\n" + + " | output: sum(3: sum), group_concat2(2: name, ',')\n" + " | group by: 1: id\n" + " | \n" + " 1:AGGREGATE (update serialize)\n" + diff --git a/fe/fe-core/src/test/java/com/starrocks/sql/plan/MetricTypeTest.java b/fe/fe-core/src/test/java/com/starrocks/sql/plan/MetricTypeTest.java index 4a8f8fa741a617..d0a2b7041f5162 100644 --- a/fe/fe-core/src/test/java/com/starrocks/sql/plan/MetricTypeTest.java +++ b/fe/fe-core/src/test/java/com/starrocks/sql/plan/MetricTypeTest.java @@ -32,7 +32,7 @@ public void testBitmapQuery() throws Exception { "PREAGGREGATION: OFF. Reason: Aggregate Operator not match: COUNT <--> BITMAP_UNION"); starRocksAssert.query("select group_concat(id2) from test.bitmap_table;") - .analysisError("No matching function with signature: group_concat(bitmap"); + .analysisError("group_concat requires first parameter to be of getType() STRING"); starRocksAssert.query("select sum(id2) from test.bitmap_table;").analysisError( "No matching function with signature: sum(bitmap)."); @@ -61,7 +61,7 @@ public void testHLLTypeQuery() throws Exception { "PREAGGREGATION: OFF. Reason: Aggregate Operator not match: COUNT <--> HLL_UNION"); starRocksAssert.query("select group_concat(id2) from test.hll_table;") - .analysisError("No matching function with signature: group_concat(hll"); + .analysisError("group_concat requires first parameter to be of getType() STRING"); starRocksAssert.query("select sum(id2) from test.hll_table;") .analysisError("No matching function with signature: sum(hll).");