From 76f63fdac6bec92a03abddf02d1e0f2605e8029d Mon Sep 17 00:00:00 2001 From: Zhao Xin Date: Tue, 17 Mar 2020 13:36:53 +0800 Subject: [PATCH] planner: add error message for group_concat (#15345) --- planner/core/logical_plan_builder.go | 3 +++ planner/core/testdata/plan_suite_unexported_in.json | 4 +++- planner/core/testdata/plan_suite_unexported_out.json | 3 ++- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/planner/core/logical_plan_builder.go b/planner/core/logical_plan_builder.go index a289a90c44e3a..b8afcc0f220f1 100644 --- a/planner/core/logical_plan_builder.go +++ b/planner/core/logical_plan_builder.go @@ -3829,6 +3829,9 @@ func (b *PlanBuilder) buildWindowFunctionFrame(ctx context.Context, spec *ast.Wi func (b *PlanBuilder) checkWindowFuncArgs(ctx context.Context, p LogicalPlan, windowFuncExprs []*ast.WindowFuncExpr, windowAggMap map[*ast.AggregateFuncExpr]int) error { for _, windowFuncExpr := range windowFuncExprs { + if strings.ToLower(windowFuncExpr.F) == ast.AggFuncGroupConcat { + return ErrNotSupportedYet.GenWithStackByArgs("group_concat as window function") + } args, err := b.buildArgs4WindowFunc(ctx, p, windowFuncExpr.Args, windowAggMap) if err != nil { return err diff --git a/planner/core/testdata/plan_suite_unexported_in.json b/planner/core/testdata/plan_suite_unexported_in.json index b4e25a7cae1a1..d92bac11542ba 100644 --- a/planner/core/testdata/plan_suite_unexported_in.json +++ b/planner/core/testdata/plan_suite_unexported_in.json @@ -264,7 +264,9 @@ "SELECT SUM(a) OVER w AS 'sum' FROM t WINDOW w AS (ROWS BETWEEN CURRENT ROW AND 1 PRECEDING )", "SELECT SUM(a) OVER w AS 'sum' FROM t WINDOW w AS (ROWS BETWEEN 1 FOLLOWING AND 1 PRECEDING )", // Test issue 11943 - "SELECT ROW_NUMBER() OVER (partition by b) + a FROM t" + "SELECT ROW_NUMBER() OVER (partition by b) + a FROM t", + // Test issue 10996 + "SELECT GROUP_CONCAT(a) OVER () FROM t" ] }, { diff --git a/planner/core/testdata/plan_suite_unexported_out.json b/planner/core/testdata/plan_suite_unexported_out.json index 3ce6f64b92c1f..567486bedb5fd 100644 --- a/planner/core/testdata/plan_suite_unexported_out.json +++ b/planner/core/testdata/plan_suite_unexported_out.json @@ -243,7 +243,8 @@ "[planner:3586]Window 'w': frame start or end is negative, NULL or of non-integral type", "[planner:3586]Window 'w': frame start or end is negative, NULL or of non-integral type", "[planner:3586]Window 'w': frame start or end is negative, NULL or of non-integral type", - "TableReader(Table(t))->Sort->Window(row_number()->Column#14 over(partition by test.t.b))->Projection" + "TableReader(Table(t))->Sort->Window(row_number()->Column#14 over(partition by test.t.b))->Projection", + "[planner:1235]This version of TiDB doesn't yet support 'group_concat as window function'" ] }, {