From b43af42d6c910f92f469a24bb8725f7573942c17 Mon Sep 17 00:00:00 2001 From: kanchairen Date: Wed, 3 Jul 2019 11:10:26 +0800 Subject: [PATCH] window function: function name of error message should be lowercase --- planner/core/logical_plan_builder.go | 2 +- planner/core/logical_plan_test.go | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/planner/core/logical_plan_builder.go b/planner/core/logical_plan_builder.go index 2c7bf7c5572e1..bb4fbb9306c88 100644 --- a/planner/core/logical_plan_builder.go +++ b/planner/core/logical_plan_builder.go @@ -3148,7 +3148,7 @@ func (b *PlanBuilder) buildWindowFunctions(p LogicalPlan, groupedFuncs map[*ast. return nil, nil, err } if desc == nil { - return nil, nil, ErrWrongArguments.GenWithStackByArgs(windowFunc.F) + return nil, nil, ErrWrongArguments.GenWithStackByArgs(strings.ToLower(windowFunc.F)) } preArgs += len(windowFunc.Args) desc.WrapCastForAggArgs(b.ctx) diff --git a/planner/core/logical_plan_test.go b/planner/core/logical_plan_test.go index 71598d87d2203..693db38bc0747 100644 --- a/planner/core/logical_plan_test.go +++ b/planner/core/logical_plan_test.go @@ -2263,6 +2263,10 @@ func (s *testPlanSuite) TestWindowFunction(c *C) { sql: "select nth_value(a, 1.0) over() from t", result: "[planner:1210]Incorrect arguments to nth_value", }, + { + sql: "SELECT NTH_VALUE(a, 1.0) OVER() FROM t", + result: "[planner:1210]Incorrect arguments to nth_value", + }, { sql: "select nth_value(a, 0) over() from t", result: "[planner:1210]Incorrect arguments to nth_value",