Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

planner: fix different err msg from MySQL when group by window function #16134

Merged
merged 3 commits into from
Apr 8, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions planner/core/logical_plan_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -1733,6 +1733,10 @@ func (g *gbyResolver) Leave(inNode ast.Node) (ast.Node, bool) {
g.err = ErrWrongGroupField.GenWithStackByArgs(g.fields[pos-1].Text())
return inNode, false
}
if _, ok := ret.(*ast.WindowFuncExpr); ok {
g.err = ErrWrongGroupField.GenWithStackByArgs(g.fields[pos-1].Text())
return inNode, false
}
return ret, true
case *ast.ValuesExpr:
if v.Column == nil {
Expand Down
3 changes: 2 additions & 1 deletion planner/core/logical_plan_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1221,7 +1221,8 @@ func (s *testPlanSuite) TestNameResolver(c *C) {
{"delete a from (select * from t ) as a, t", "[planner:1288]The target table a of the DELETE is not updatable"},
{"delete b from (select * from t ) as a, t", "[planner:1109]Unknown table 'b' in MULTI DELETE"},
{"select '' as fakeCol from t group by values(fakeCol)", "[planner:1054]Unknown column '' in 'VALUES() function'"},
{"update t, (select * from t) as b set b.a = t.a", "[planner:1288]The target table b of the UPDATE is not updatable"},
{"update t, (select * from ht) as b set b.a = t.a", "[planner:1288]The target table b of the UPDATE is not updatable"},
{"select row_number() over () from t group by 1", "[planner:1056]Can't group on 'row_number() over ()'"},
}

ctx := context.Background()
Expand Down