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

plan: refactor errors #6377

Merged
merged 11 commits into from
May 9, 2018
Merged

plan: refactor errors #6377

merged 11 commits into from
May 9, 2018

Conversation

zz-jason
Copy link
Member

  1. move all error definitions into errors.go
  2. remove terror.ClassOptimizerPlan

@zz-jason
Copy link
Member Author

@winoros @XuHuaiyu PTAL

@XuHuaiyu
Copy link
Contributor

/go/src/github.com/pingcap/tidb/plan/errors.go:50:2: exported var ErrUnsupportedType should have comment or be unexported

@@ -260,5 +260,5 @@ func (s *testSuite) TestPreparedNameResolver(c *C) {
tk.MustExec("create table t (id int, KEY id (id))")
tk.MustExec("prepare stmt from 'select * from t limit ? offset ?'")
_, err := tk.Exec("prepare stmt from 'select b from t'")
c.Assert(err.Error(), Equals, "[plan:1054]Unknown column 'b' in 'field list'")
c.Assert(err.Error(), Equals, "[optimizer:1054]Unknown column 'b' in 'field list'")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

planner?

@zz-jason
Copy link
Member Author

/run-all-tests

@zz-jason
Copy link
Member Author

@XuHuaiyu @winoros PTAL again

@winoros
Copy link
Member

winoros commented Apr 28, 2018

/run-common-test
/run-integration-common-test

@@ -1177,7 +1177,7 @@ func (er *expressionRewriter) funcCallToExpression(v *ast.FuncCallExpr) {
func (er *expressionRewriter) toColumn(v *ast.ColumnName) {
column, err := er.schema.FindColumn(v)
if err != nil {
er.err = ErrAmbiguous.GenByArgs(v.Name)
er.err = ErrAmbiguous.GenByArgs(v.Name, "field list")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/ "field list"/ clauseMsg[fieldList]
so as the others.

@@ -774,14 +774,14 @@ func (b *planBuilder) buildLimit(src LogicalPlan, limit *ast.Limit) LogicalPlan
if limit.Offset != nil {
offset, err = getUintForLimitOffset(sc, limit.Offset.GetValue())
if err != nil {
b.err = ErrWrongArguments
b.err = ErrWrongArguments.GenByArgs("LIMIT")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add test case for this in TestNameResolver?

Copy link
Member Author

@zz-jason zz-jason May 3, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the Offset and Count of ast.Limit is guaranteed to be a value of uint64 by parser, maybe we should delete this check.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But if offset and count are paramMarker, they are not guaranteed to be uint64.

@XuHuaiyu
Copy link
Contributor

XuHuaiyu commented May 3, 2018

LGTM

@zz-jason
Copy link
Member Author

zz-jason commented May 7, 2018

@winoros PTAL

@zz-jason zz-jason added the status/LGT1 Indicates that a PR has LGTM 1. label May 7, 2018
winoros
winoros previously approved these changes May 8, 2018
Copy link
Member

@winoros winoros left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@zimulala
Copy link
Contributor

zimulala commented May 9, 2018

@zz-jason Please fix the confliction

@zz-jason
Copy link
Member Author

zz-jason commented May 9, 2018

@zimulala done, PTAL

@zz-jason
Copy link
Member Author

zz-jason commented May 9, 2018

/run-all-tests

Copy link
Contributor

@zimulala zimulala left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@zimulala zimulala added status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels May 9, 2018
@zz-jason zz-jason merged commit 6248a74 into pingcap:master May 9, 2018
@zz-jason zz-jason deleted the dev/planerr branch May 9, 2018 05:07
zz-jason added a commit that referenced this pull request Jun 7, 2018
zz-jason added a commit that referenced this pull request Jun 7, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status/LGT2 Indicates that a PR has LGTM 2.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants